Struggling to make my discord.py bot work in Python, I've attempted it 50 times without success. I'm determined to get it online at least once. Need guidance and troubleshooting help to achieve this goal.
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
@bot.command()
async def hello(ctx):
await ctx.send('Hello!')
bot.run('YOUR_TOKEN_HERE ')
I'll guide you through it.
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!",intents=discord.Intents.all())
@bot.event
async def on_ready():
print("Bot is online")
@bot.command()
async def test(ctx:commands.Context):
await ctx.channel.purge(limit=1)
await ctx.channel.send(f"Hello {ctx.author.mention}")
bot.run("token")