This repository was archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinkBot.py
72 lines (53 loc) · 1.99 KB
/
inkBot.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
63
64
65
66
67
68
69
70
71
72
'''
INFO:
1. WHAT IS THIS BOT?
This is inkBot, a bot made by Adi#1874 to assist in server featues for which finding a bot is too hard or unnsesary
2. WHAT IS THIS FILE?
This is the main file that is like the hub to all code, here is where the bot prefix is determined, cogs are loaded and bot is run throught the token
IMPORTS:
1. discord cause idk
2. commands module for running bot functions and calling commands
3. load to load my token
4. os to read /cogs/ and automatically load in all cogs
5. path to show the path to my json
'''
import discord
from discord.ext import commands
from json import load
import os
from pathlib import Path
from discord_components.client import DiscordComponents
allowed_mentions = discord.AllowedMentions(everyone=False,roles=False)
intents = discord.Intents.default()
intents.members = True
#defining the bot,removing help command, disabling everyone and role mentions, adding status
client = commands.Bot(command_prefix = ['ink ', 'ink', 'Ink ','Ink'], intents = intents,status=discord.Status.do_not_disturb,activity=discord.Game(name="ink help"))
client.allowed_mentions = allowed_mentions
client.remove_command('help')
#Loading message
@client.event
async def on_ready():
print('Bot is online!')
DiscordComponents(client)
#removing need for underscores in using jsk
os.environ['JISHAKU_NO_UNDERSCORE'] = 'true'
os.environ['JISHAKU_NO_DM_TRACEBACK'] = 'True'
#making a list of all cogs in the cogs folder
myCogs = []
cogsFolderStuff = os.listdir('./cogs/')
for file in cogsFolderStuff:
if file.endswith('.py'):
fileName = file.split('.')
myCogs.append(str('cogs.' + fileName[0]))
#loading my cogs as defined in previous step
if __name__ == '__main__':
for ext in myCogs:
client.load_extension(ext)
#loading jishaku seperately cause its weird
client.load_extension('jishaku')
#reading my json file
with Path("utils/secrets.json").open() as f:
config = load(f)
token = config["token"]
#Running client on token given
client.run(token)