Python Discord Bot unable to reply to messages

Python Discord Bot unable to reply to messages

[import asyncioimport randomimport discordfrom discord import Member, Guild, Userfrom webserver import keep_aliveimport osclient = discord.Client(intents=discord.Intents.all())answers = [ "Yes", "No", "Maybe", " Probably", "Looks like it", "Very likely", "Very unlikely"]@client.eventasync def on_ready(): print("Logged in as bot {}".format(client.user.name)) client.loop .create_task (status_task())async def status_task(): color = [ discord.Colour.red(), discord.Colour.orange(), discord.Colour.gold(), discord.Colour.green(), discord. colour. blue(), discord.Colour.purple() ] while True: wait client.change_presence( activity=discord.Game("with a knife."), status=discord.Status.online) wait asyncio.sleep(40) wait client.change_presence(activity=discord.Game("under development"), status=discord.Status.online) wait asyncio.sleep(25) wait client.change_presence(activity=discord.Game( "Do not join this server now: [URL]https://discord.gg/8F2XjMk[/URL]"), status=discord.Status.online) wait asyncio.sleep(60) wait client.change_presence( activity=discord.Game("Update Loading.. . 42 %"), status=discord.Status.online) wait asyncio.sleep( 70) Guild: Guild = client.get_guild(772190779299987506) if guild: role = guild.get_role(772501470394318868) if role: ...def is_not_pinned (mess): return not mess.pinned@client.eventasync def on_member_join(member): guild: Guild = member.guild if not member.bot: embed = discord.Embed( title="Welcome to our server, {} ". format(member.name), description= "Please accept the rules to get started !", color=0x22a7f0) try: if not member.dm_channel: wait member.create_dm() await member.dm_channel.send(embed=embed ) except discord.errors.Forbidden: print( "A welcome message could not be sent to {}.".format(member.name))@client.eventasync def on_message(message): if message.author.bot: return if " .help" in message.content: wait message.channel.send( "[I]Serverbot command help. [/I] " "\r\n \r\n" "``.help - Displays this help.\r\n" ".userinfo [name] - Displays info about the specified user.\r\ n" ".8ball [question]- Pops up an oracle allowing to predict any event.\r\n" ".clear [count]- Command to clear chat messages. // Only delete messages from the last 2 weeks. / /\r\n" ".ban [name] - To ban a specific user from the server. For moderators only.\r\n" ".kick [name] - To kick a specific user from the server. For moderators only.``\r\n" ) if message.content.startswith( ".ban") and message.author.guild_permissions.ban_members: args = message.content.split(" ") if len(args) = = 2: member: member = discord.utils.find(lambda m: args[1] in m.name, message.guild.members) if member: wait member.ban() wait message.channel.send( f"[ I]Player {member.name} was kicked successfully.[/I]") else: wait message.channel.send( f"No user with the name {args[1]} found.") if message.content.startswith ( ".unban") and message.author.guild_permissions.kick_members: args = message.content.split(" ") if len(args) == 2: user: User = discord.utils.find( lambda banentry: args[ 1] in banentry.user.name, message.guild.bans()).user if user: wait message.guild.unban(user) wait message.channel.send(f"Member {member.name .) } unbanned" ) else: wait message.channel.send( f"No user found with the name {args[1]}.") if message.content.startswith( ".kick") and message.author.guild_permissions.kick_members : args = message.content.split(" ") if len(args) == 2: Member: Member = discord.utils.find(lambda m: args[1] in m.name, message.guild.members) if member: wait member.kick() await message.channel.send( f"[I]Player {member.name} was kicked successfully.[/I]") else: await message.channel.send( f"No user with the name { args[1]} found.") if message.content.startswith(".userinfo"): args = message.content.split(" ") if len(args) == 2: Member: Member = discord.utils. find( lambda m: args[1] in m.name, message.guild.members) if member: embed = discord.Embed( title="Userinfo for {}".format(member.name), description="This is a user info for the user {}".format(member.mention), color=0x22a7f0) embed.add_field( name="Server joined!", value=member.joined_at.strftime("%d/%m/%Y, %H:%M:%S" ), inline=True) embed.add_field( name="Discord joined", value=member.created_at.strftime("%d/%m/%Y, %H:%M: %S"), inline=True) rolen = "" for role in member.roles: if not role.is_default(): rolen += "{} \r\n".format(role.mention) if rolen: embed .add_field(name="Rollen", value=Rollen, inline=True) embed.set_thumbnail(url=member.avatar_url) embed.set_footer(text="Userinfo created by Kowalski") wait message.channel.send(embed=embed ) if message.content.startswith(" .clear"): if message.author.permissions_in(message.channel).manage_messages: args = message.content.split(" ") if len(args) == 2: if args[1].isdigit(): count = int(args[1]) + 1 delete = wait message.channel.purge(limit=count, check= is_not_pinned) wait message.channel.send( "{} messages deleted.".format(len(deleted) - 1 )) if message.content.startswith(.8ball"): args = message.content.split(" ") if len(args) >= 2: ask = " ".join(args[1:]) mess = wait message.channel.send( "I'm trying to answer your question [ICODE]{0}[ /ICODE]. ".format(question)) wait asyncio.sleep(2) await mess.edit(content="I am contacting the oracle...") await asyncio.sleep(2) await mess.edit( content ="Your answer to the question [ICODE]{0}[/ICODE] is: [ICODE]{1}[/ICODE]".format( ask, random.choice(answer))) if message.content.startswith(" Test"): wait message .channel.send("Hey")keep_alive()TOKEN = os.environ.get("DISCORD_BOT_SECRET")client.

Unable to reply to messages with Python Discord Bot