-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
64 lines (46 loc) · 2.35 KB
/
bot.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
import keep_alive
VERSION = 'Alpha 7.3.3'
import asyncio
import discord
from discord.ext import commands
import os
import core.function as function
bot = commands.Bot(command_prefix='-', intents=discord.Intents.all())
async def main():
@bot.event
async def on_ready():
function.print_detail(memo='INFO', obj='Bot is Ready')
await bot.change_presence(status=discord.Status.online, activity=discord.Game(function.open_json('./data/config.json')['playinggame']))
@bot.command()
@commands.is_owner()
async def load(ctx: commands.Context, extension):
await bot.load_extension(f'cmds.{extension}')
await ctx.send(f'Loaded {extension} successfully')
function.print_detail(memo='INFO',user=ctx.author, guild=ctx.guild, channel=ctx.message.channel, obj=f'{extension}.py loaded successfully')
@bot.command(aliases=['ul'])
@commands.is_owner()
async def unload(ctx: commands.Context, extension):
await bot.unload_extension(f'cmds.{extension}')
await ctx.send(f'Unloaded {extension} successfully')
function.print_detail(memo='INFO',user=ctx.author, guild=ctx.guild, channel=ctx.message.channel, obj=f'{extension}.py unloaded successfully')
@bot.command(aliases=['rl'])
@commands.is_owner()
async def reload(ctx: commands.Context, extension):
await bot.reload_extension(f'cmds.{extension}')
await ctx.send(f'Reloaded {extension} successfully')
function.print_detail(memo='INFO', user=ctx.author, guild=ctx.guild, channel=ctx.message.channel, obj=f'{extension}.py reloaded successfully')
@bot.command(aliases=['info'])
async def infomations(ctx: commands.Context):
data = function.open_json('./data/config.json')
text =''
for i, features in enumerate(data['new_features']):
text += f' *{i + 1}. {features}*\n'
await ctx.send(f'**Version:** *{VERSION}*\n**New features:** \n{text}**GitHub:** *{data["github"]}*')
async with bot:
for file in os.listdir('./cmds'):
if file.endswith('.py') and file != 'data.py':
await bot.load_extension(f'cmds.{file[:-3]}')
function.print_detail(memo='INFO', obj=f'{file} loaded successfully')
keep_alive.keep_alive()
await bot.start(function.open_json('./data/config.json')['token']['discord'])
asyncio.run(main())