-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
72 lines (58 loc) · 1.86 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
def main():
import os
import discord
from discord.ext import commands, tasks
from read_env import read_env
from keep_alive import keep_alive
from utils.custom_help import MyHelpCommand
from itertools import cycle
from extensions import EXTENSIONS
import logging
import gc
read_env()
logging.basicConfig()
log = logging.getLogger('ronz-AMOGUS')
log.setLevel(logging.INFO)
activities = cycle((
'ur mum',
'ur sis',
'ur aunt',
'ur stepsis',
'ur dad\'s wife',
))
CMD_PREFIX = '69'
DOCS_SITE = 'ronz-amogus.vercel.app'
bot = commands.Bot(
command_prefix=CMD_PREFIX,
description='SUS\nAMOGUS',
case_insensitive=True,
help_command=MyHelpCommand(),
)
@bot.check
async def no_pm(ctx):
if await ctx.bot.is_owner(ctx.author):
return True
return not ctx.guild is None
@bot.event
async def on_ready():
print(f'\n\nLogged in as: {bot.user.name} - {bot.user.id}\nVersion: {discord.__version__}\n')
print(f'Cogs loaded: \n{bot.cogs.keys()}')
change_presence.start()
garbage_collector.start()
@tasks.loop(hours=6, minutes=9, seconds=69)
async def garbage_collector():
log.info('running garbage collection...')
collected = gc.collect()
log.info(f'collected {collected} objects')
@tasks.loop(minutes=30)
async def change_presence():
await bot.change_presence(activity=discord.Game(f'{next(activities)} | {CMD_PREFIX}help | {DOCS_SITE}'))
for extension in EXTENSIONS:
bot.load_extension(extension)
if os.getenv('CI'):
log.info('CI successfull! Terminating...')
return
keep_alive()
bot.run(os.getenv('TOKEN'), bot=True, reconnect=True)
if __name__ == '__main__':
main()