Discord bot code not working


Joined
Jul 27, 2022
Messages
2
Reaction score
0
import discord
import random
from discord.ext import commands
admin = ['Admin']
economy_channels = ['economy']
cuss = ['poopoo']
slurs = ['stupid']
TOKEN = 'MTAwMDd5MDkD6DU1MjY4OTY5NQ.GFIeQ9.WBS46D65AXiXAc2NpADgv88eeTa07P2UZesCc'
client = commands.Bot(command_prefix = ';')
client.remove_command('help')
# bot going online
@client.event
async def on_ready():
print('Bot is ready')

@client.event
async def on_message(msg):

for text in cuss:
if text in str(msg.content.lower()):
await msg.delete()
return
for text in slurs:
if text in str(msg.content.lower()):
await msg.delete()
await msg.author.kick()
await msg.channel.send(f'Kicked: {str(msg.author)}\nReason: Posted slurs')
return
if msg.author == client.user:
return
await client.process_commands(msg)


client.run(TOKEN)

#I have completey checked this code from top to bottom. For some reason, when i type a cuss word , like poopoo, its doesnt delete. what is the problem. Can someone pls help?

#Note: The key has been changed to something random to protect exposing it. So I know that is not the problem. I ran it with the real key and it still didnt work.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ChatBot 3
Modify Python Code - no idea at all 0

Top