-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot2.py
62 lines (52 loc) · 1.81 KB
/
bot2.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
import os
import asyncio
import discord
import random
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
from bot_secret import get_secret
from discord.utils import get
import logging
logger = logging.getLogger('salc1bot')
client_ = discord.Client()
client = commands.Bot(command_prefix = '!')
import sys
#try:
# if sys.argv[1] != "sc":
# print("you need to start with the shell of batch script")
# exit(1)
#except IndexError:
# print("you need to start with the shell of batch script")
# exit(1)
extensions = [
"cogs.general",
"cogs.logging",
"cogs.user_info",
"cogs.faq",
"cogs.serverstatus",
"cogs.badwords",
"cogs.member_management"
]
@client.event
async def on_ready():
for exten in extensions:
client.load_extension(exten)
logger.info(f"loaded extension: {exten}")
await client.change_presence(status=discord.Status.online, activity=discord.Game('Leaking salc\'s base in progress'))
logger.info(f'{client.user} has connected to Discord!')
@client.command()
@commands.has_any_role("Moderator", "Administrator")
async def reload(ctx):
for exten in extensions:
client.reload_extension(exten)
logger.info(f"reloaded extension: {exten}")
await ctx.send("Reload Succesfull")
@client.event
async def on_error(event, *args, **kwargs):
logger.error(f"error in event: {event} with args {args},{kwargs}", exc_info=sys.exc_info())
## ----------------------------------- DONT EDIT PAST THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING! --------------------------------------------
if __name__ == "__main__": # only run bot if this file wasn't imported
try:
client.run( get_secret() )
except discord.errors.LoginFailure as error:
logger.info(f"Error logging in! Error: {error}" )