-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (35 loc) · 1.33 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
"""
Copyright © OvoOno Studio 2022 - https://github.com/OvoOno-Studio/polygonscan-disnake
Description:
Discord Bot based on EtherScan, PolygonScan, CoinGecko, Binance APIs and Disnake lib.
Version: 1.0
"""
import disnake
from disnake.ext import commands
import os, traceback
DiscordToken = os.getenv('DISCORD_TOKEN')
class Bot(commands.Bot):
def __init__(self):
print("Welcome to the BlockScan!")
print("---------------------------------------------------------")
super().__init__(command_prefix=commands.when_mentioned_or("ps-"), intents=disnake.Intents.all())
print("Loading cogs files..")
for file in os.listdir('./cogs'):
if file.endswith('.py') and file != '__init__.py':
try:
self.load_extension(f"cogs.{file[:-3]}")
print(f"{file[:-3]}.cog loaded successfully!")
except:
print(f"Unable to load {file[:-3]}.")
print(traceback.format_exc())
async def on_ready(self):
print(f'{self.user.name} is ready!')
print('Looping tasks..')
for cog in self.cogs.values():
if hasattr(cog, "start_tasks"):
cog.start_tasks() # type: ignore
def main():
bot = Bot()
bot.run(DiscordToken)
if __name__ == "__main__":
main()