1import discord
2
3class MyClient(discord.Client):
4
5 async def on_ready(self):
6 print('Logged on as', self.user)
7
8 async def on_message(self, message):
9 word_list = ['cheat', 'cheats', 'hack', 'hacks', 'internal', 'external', 'ddos', 'denial of service']
10
11 # don't respond to ourselves
12 if message.author == self.user:
13 return
14
15 messageContent = message.content
16 if len(messageContent) > 0:
17 for word in word_list:
18 if word in messageContent:
19 await message.delete()
20 await message.channel.send('Do not say that!')
21
22 messageattachments = message.attachments
23 if len(messageattachments) > 0:
24 for attachment in messageattachments:
25 if attachment.filename.endswith(".dll"):
26 await message.delete()
27 await message.channel.send("No DLL's allowed!")
28 elif attachment.filename.endswith('.exe'):
29 await message.delete()
30 await message.channel.send("No EXE's allowed!")
31 else:
32 break
33
34client = MyClient()
35client.run('token here')
1
2#Import essentials
3import discord
4from discord.ext import commands
5import asyncio
6#Some things that makes your life easier! (aliases to make code shorter)
7client = commands.Bot(command_prefix='!') #change it if you want
8token = 'YOUR TOKEN HERE' #Put your token here
9#Making a first text command! (Respond's when a user triggers it on Discord)
10@client.command()
11async def hello(ctx):
12 await ctx.send('Hello I am a Test Bot!')
13#Tell's us if the bot is running / Runs the bot on Discord
14@client.event
15async def on_ready():
16 print('Hello, I am now running')
17
18
19
20client.run(token)