-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (38 loc) · 1.18 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
"""This Discord Bot is made to handle commands that are useful in playing The Unofficial Dark Souls TTRPG via Discord.
The RPG: https://i.4pcdn.org/tg/1528730920492.pdf
Required 3RD-Party PyPi Packages:
- d20
- discord
"""
import os
import discord
from discord.ext import commands
PREFIXES = ["bfire!", "bf!"]
try:
TOKEN = os.environ['DISCORD_BOT_TOKEN']
except KeyError:
#with open('TOKEN.txt', 'r') as file:
#TOKEN = file.read()
TOKEN = 'YOUR-TOKEN-HERE'
#* Instantiates An Instance Of The Bot() Class.
bot = commands.Bot(command_prefix=PREFIXES,
intents=discord.Intents.all())
#* Loads cogs
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')
print(f'Cog: {filename[:-3].title().replace("_", "")} loaded.')
elif filename.endswith('_cogs') or filename == "__pycache__":
continue
else:
print(f'Cog: Unable to load {filename[:-3]}')
#* Module Code
def main():
"""Main Method
"""
bot.run(str(TOKEN))
#? Driver Code
if __name__ == "__main__":
main()
else:
print(f"{__name__} was successfully imported") #! MUST have Python 3.x for use of f-strings!