This repository has been archived by the owner on Dec 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
45 lines (31 loc) · 1.46 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import discord
from discord.ext import commands
import keep_alive
import sys, traceback
def get_prefix(bot, message):
# Notice how you can use spaces in prefixes. Try to keep them simple though.
prefixes = ['§']
# Check to see if we are outside of a guild. e.g DM's etc.
if not message.guild:
# Only allow § to be used in DMs
return '§'
# If we are in a guild, we allow for the user to mention us or use any of the prefixes in our list.
return commands.when_mentioned_or(*prefixes)(bot, message)
# Below cogs represents our folder our cogs are in. Following is the file name. So 'meme.py' in cogs, would be cogs.meme
# Think of it like a dot path import
initial_extensions = ['cogs.simple',
'cogs.members']
bot = commands.Bot(command_prefix=get_prefix, description='Offical Discord Bot for kaaaxcreators Community')
# Here we load our extensions(cogs) listed above in [initial_extensions].
if __name__ == '__main__':
for extension in initial_extensions:
bot.load_extension(extension)
@bot.event
async def on_ready():
"""http://discordpy.readthedocs.io/en/rewrite/api.html#discord.on_ready"""
print(f'\n\nLogged in as: {bot.user.name} - {bot.user.id}\nVersion: {discord.__version__}\n')
activity = discord.Game(name="mit der API")
await bot.change_presence(activity=activity)
print(f'Successfully logged in and booted...!')
keep_alive.keep_alive()
bot.run(TOKEN, bot=True, reconnect=True)