Bot is logged in and online but none of the commands are working

Basically, my bot is online and the status is enabled but none of the commands are working even after I reformatted and there were no errors.

Could you please share your code with us?

3 Likes

Can you try testing locally to see if you get the same result?

1 Like

if bot not replying, bot probably is down, discord checks activity of accounts slowly

Not true, sure it may be down, but it would still respond. Discord has about a 5-15 minute interval for checking presences. But, the bot should still be up. @huangsushi Are you using a handler, or just one script.

If you could share the code would be easier to help, this are the possible problems:

  • You are writing wrongly the commands.
  • Wrong prefix, maybe it have an extra space

( Solution )

Write this on your code:

client.on("message", message => { if (message.content == "test") {message.channel.send("tested")}});
//If you write test, and the bot answers tested, means isn't some of the problems above
  • Using if/else chain
  • Using basic command handler
  • Using advanced command handler

( Solution )

Then it’s a typo, look for the problem searching guides for making command handlers on google, like this one:

3 Likes

same thing is happening to me and my code is : import discord
import youtube_dl
import requests
import json
import random

intents = discord.Intents.default()
intents.members = True
client = discord.Client(intents=intents)

@client.event
async def on_ready():
print(‘Bot is ready.’)

@client.event
async def on_message(message):
print(f"Received message: {message.content}")
if message.author == client.user:
return

if message.content.startswith('!play'):
    voice_channel = message.author.voice.channel
    await voice_channel.connect()

    query = message.content[6:]
    url = await get_youtube_url(query)

    voice_client = message.guild.voice_client

    player = await voice_client.create_ytdl_player(url)
    player.start()

    await message.channel.send(f'Playing {player.title}')


elif message.content.startswith('!cat'):
    response = requests.get('https://api.thecatapi.com/v1/images/search')
    data = json.loads(response.text)
    cat_url = data[0]['url']
    await message.channel.send(cat_url)

elif message.content.startswith('$waifu'):
    query = message.content[7:].strip()
    if query == '':
        response = requests.get('https://api.waifu.pics/sfw/waifu')
    else:
        response = requests.get(f'https://api.jikan.moe/v3/search/character?q={query}&limit=1')
        data = json.loads(response.content)
        if data['results']:
            character_id = data['results'][0]['mal_id']
            response = requests.get(f'https://api.jikan.moe/v3/character/{character_id}')
            data = json.loads(response.content)
            image_url = data['image_url']
        else:
            image_url = 'https://api.waifu.pics/sfw/waifu'

    await message.channel.send(image_url)

elif message.content.startswith('!8ball'):
    responses = [
        'It is certain.',
        'It is decidedly so.',
        'Without a doubt.',
        'Yes – definitely.',
        'You may rely on it.',
        'As I see it, yes.',
        'Most likely.',
        'Outlook good.',
        'Yes.',
        'Signs point to yes.',
        'Reply hazy, try again.',
        'Better not tell you now.',
        'Ask again later.',
        'Cannot predict now.',
        'Concentrate and ask again.',
        'Don\'t count on it.',
        'Outlook not so good.',
        'My sources say no.',
        'Very doubtful.'
    ]
    response = random.choice(responses)
    await message.channel.send(response)

async def get_youtube_url(query):
ydl_opts = {
‘format’: ‘bestaudio/best’,
‘quiet’: True,
‘default_search’: ‘auto’,
‘source_address’: ‘0.0.0.0’
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(query, download=False)
url = info[‘url’]
return url
client.run(‘my token id which i cannot share here’)

Hi, maybe your website went to sleep?