-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (32 loc) · 969 Bytes
/
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
import os
import discord
from dotenv import load_dotenv
from argparse import ArgumentParser
import asyncio
from constants import *
from components import MyBot, MyCommandTree
from utils import utils
async def main():
load_dotenv()
bot = MyBot(command_prefix="$", activity_name="Blockchain", tree_cls=MyCommandTree)
parser = ArgumentParser(
usage="python3 main.py [-t | --test]",
description="Discord bot for providing information about the cryptocurrencies",
allow_abbrev=False,
)
parser.add_argument(
"-t",
"--test",
action="store_true",
help="Providing console log instead of file log",
)
args = parser.parse_args()
if args.test:
discord.utils.setup_logging()
else:
utils.setup_file_logging()
TOKEN = os.getenv("TOKEN")
await bot.start(TOKEN)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())