Python Forum
[Discord.py] Bot not responding?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Discord.py] Bot not responding?
#1
Here is the code : https://hastebin.com/fugurelagu.py

So the error is that the _help does not respond, whenever a user types _help, nothing happens.
There is no error in the console which is really weird, and something else that is weird
is that the _magicball command works correctly with no problem/error.

It's my first time here so i'm trying to explain my problem the most clearly i can (sorry if my english is bad i don't speak english)

The code (added by buran)
import discord
import asyncio
import random
import pickle
import os

client = discord.Client()

@client.event
async def on_ready():
    print('Ready and with')
    print(client.user.name)

@client.event
async def on_message(message):
    if message.content.startswith('_help'):
        msg1 = await client.send_message(message.channel, ('```Heres what i can do :```'))
        msg2 = await client.send_message(message.channel, ('```-_help for help```'))
        msg3 = await client.send_message(message.channel, ('```-_8ball to ask the magic 8ball```'))
        msg4 = await client.send_message(message.channel, ('```Bot powered by Ouindoze™, message will auto destruct in 15s :boom: ```'))


@client.event
async def on_message(message):
    if message.content.startswith('_magicball'):
        ball8 = random.choice(['It is certain','As i see it, yes', 'Dont count on it', 'Without a doubt', 'Definitely', 'Very doubtful', 'Outlook not so good', 'My sources say no', 'My reply is no', 'Most likely', 'You may rely on it', 'Ask again later'])
        msg5 = await client.send_message(message.channel, ball8)



client.run('My token here, i will obviously not give it freely')
COol Dudes love programmING
Reply
#2
it doesn't make sense to have two functions with same signature:
@client.event
async def on_message(message):
the second one will overwrite the first one. that is why magic_ball is working and _help - not.
look at the example here how they use if/else in on_message function:
https://github.com/Rapptz/discord.py
ho
Reply
#3
Alright thanks a lot, sorry for the late response i was busy all day so
COol Dudes love programmING
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  elif not responding on print EddieG 3 862 Jul-20-2023, 09:44 PM
Last Post: Pedroski55
  Help discord bot Edward 0 2,105 Sep-15-2022, 09:55 PM
Last Post: Edward
  Discord Bot Dark_Sovereign_193 0 36,385 Jun-03-2021, 03:24 PM
Last Post: Dark_Sovereign_193
  Pygame Rect Not Responding SomebodyImportant 1 1,525 May-02-2021, 01:27 PM
Last Post: BashBedlam
  Discord Bot Help Oshadha 0 1,400 Jan-26-2021, 04:23 PM
Last Post: Oshadha
  IDLE stops responding upon saving tompi1 2 1,928 Oct-01-2020, 05:44 PM
Last Post: Larz60+
  Code is not responding abhishek81py 0 1,489 Jul-07-2020, 12:40 PM
Last Post: abhishek81py
  Sublime text not responding Mat 1 1,968 Mar-23-2020, 11:42 AM
Last Post: Fre3k
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,540 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy
  IDLE not responding (Mac) Selinal 1 2,955 Aug-05-2019, 10:27 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020