-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.py
58 lines (47 loc) · 1.5 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
#!/usr/bin/env python3
import discord
import random
import asyncio
import time
import configuration
import os
import sys
from datetime import datetime
from discord.ext import commands
from discord.ext import tasks
class Greetings(commands.Cog):
def __init__(self, bot):
self.bot = bot
self._last_member = None
bot = commands.Bot("?")
# bot = commands.when_mentioned_or("?")
# HELP
bot.remove_command("help") # To create a personal help command
# Load cogs
path = os.path.realpath(__file__)
path = path.replace('\\', '/')
path = path.replace('main.py', 'Cogs')
initial_extensions = os.listdir(path)
try:
initial_extensions.remove("__pycache__")
except:
pass
print(initial_extensions)
initial_extensions3 = []
for initial_extensions2 in initial_extensions:
initial_extensions2 = "Cogs." + initial_extensions2
initial_extensions2 = initial_extensions2.replace(".py", "")
initial_extensions3.append(initial_extensions2)
if __name__ == '__main__':
for extension in initial_extensions3:
try:
bot.load_extension(extension)
except Exception as e:
print(f'Failed to load extension {extension}.', file=sys.stderr)
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name =f"{bot.command_prefix}help"))
print(discord.__version__)
# ------------------------ RUN ------------------------ #
bot.run(configuration.token)