-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (33 loc) · 1.09 KB
/
main.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
46
#!/usr/bin/python
import re
import os
from configparser import ConfigParser
import discord
from discord.ext import commands
from core.name_tags import NameTags
def main():
# Load config
file = 'config.ini'
config = ConfigParser()
config.read(file)
del file
intents = discord.Intents.all()
client = commands.Bot(command_prefix=">",
intents=intents, help_command=None)
nameTags = NameTags()
# Ready message
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
await client.change_presence(activity=discord.Game(name=">help"))
@client.event
# trigger: nickname, roles, pending
async def on_member_update(before: discord.ClientUser, after: discord.ClientUser):
await nameTags.magic(after)
# Load cogs
for folder in os.listdir("modules"):
if os.path.exists(os.path.join('modules', folder, 'cog.py')):
client.load_extension(f'modules.{folder}.cog')
client.run(config.get('bot_info', 'token'))
if __name__ == '__main__':
main()