1# Setting `Playing ` status
2await bot.change_presence(activity=discord.Game(name="a game"))
3
4# Setting `Streaming ` status
5await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))
6
7# Setting `Listening ` status
8await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))
9
10# Setting `Watching ` status
11await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
1# Status to Online (The green one)
2await client.change_presence(status=discord.Status.online)
3
4# Status to Idle (The orange one)
5await client.change_presence(status=discord.Status.idle)
6
7# Status to Do not disturb (The red one)
8await client.change_presence(status=discord.Status.dnd)
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')