-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
75 lines (61 loc) · 2.17 KB
/
main.py
File metadata and controls
75 lines (61 loc) · 2.17 KB
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
73
74
75
import asyncio
import os
import random
import discord
from discord.ext import commands
from pathlib import Path
intents = discord.Intents.all()
import json
with open('./config/config.json', 'r') as configFile:
data = json.load(configFile)
token = data.get("token")
cwd = Path(__file__).parents[0]
cwd = str(cwd)
print(f"{cwd}")
description = ''' A minecraft discord bot for the guild Hyakuya Family. DISCLAIMER: You will absolute zero support with this bot if you try to host it.'''
class NewHelpName(commands.MinimalHelpCommand):
async def send_pages(self):
destination = self.get_destination()
for page in self.paginator.pages:
embed = discord.Embed(
description=page, color=discord.Color.random())
embed.set_thumbnail(url=bot.user.avatar_url)
embed.set_footer(text='')
await destination.send(embed=embed)
def get_prefix(bot, message):
with open('./config/prefixes.json', 'r') as prefixFile:
prefixes = json.load(prefixFile)
try:
prefix_server = prefixes.get(str(message.guild.id))
except AttributeError:
return "!"
if prefix_server is None:
prefix_server = "!"
data = prefix_server
return commands.when_mentioned_or(data)(bot, message)
bot = commands.Bot(
command_prefix=get_prefix,
description=description,
owner_id=219410026631135232,
case_insensitive=True,
intents=intents,
help_command=NewHelpName()
)
bot.config_token = data["token"]
bot.cwd = cwd
#@bot.event
#async def on_message(message):
# if bot.user.mentioned_in(message):
# await message.channel.send("You can type `!c help` to see all the commands available.")
@bot.event
async def on_ready():
print('Logged in as', bot.user.name)
print("Bot ID:", bot.user.id)
print('Bot latency:', bot.latency * 1000, 2)
print('Running discord.py version ' + discord.__version__)
if __name__ == "__main__":
for file in os.listdir(cwd + "/cogs"):
if file.endswith(".py") and not file.startswith("_"):
bot.load_extension(f"cogs.{file[:-3]}")
bot.load_extension("jishaku")
bot.run(bot.config_token)