Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I wanted to try my hand at making a discord bot however I'm running into an issue where my bot will not come online. I've tried 2 different codes I've found from internet tutorials but neither of them will make the bot appear online or do anything. I've seen someone ask a similar question on here using a similar code to what I have implemented and was currently working with and said that their issues were coming from a certificate error (Discord Bot not coming online) but I'm not sure how I would go about resolving it. For context I'm using Python 3.9 on PyCharm and my code looks like this (I have used an actual token but I've heard its not good to give that out) :

import discord

from discord.ext import commands

client = commands.Bot(command_prefix='.')

@client.event
async def on_ready():
    print('bot is ready')

client.run('TOKEN')

Please ask if you need any more information that what I've already provided.

edit1:pycharm says that the import 'import discord' is unused is that why im having issues?

edit2:I have tried using the following command to get the bot to do something but it is still not working-

@client.event

async def ping(ctx):
    
    await ctx.send('pong!')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
202 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...