Skip to content

Instantly share code, notes, and snippets.

@dpy-manager-bot
Created January 19, 2021 07:53
Show Gist options
  • Save dpy-manager-bot/b74e2ccb741260698c6d073ba1ecf2ae to your computer and use it in GitHub Desktop.
Save dpy-manager-bot/b74e2ccb741260698c6d073ba1ecf2ae to your computer and use it in GitHub Desktop.
A file by Takkun#1643 in the discord.py guild
def run():
import glob
import discord
from discord.ext import commands
import mysql.connector as mysql
from data import botdata
class MyBot(commands.Bot):
async def is_owner(self,user:discord.User):
if user.id in [ad[0] for ad in botdata.admin if ad[1] in ["owner","subowner"]]:
return True
return await super().is_owner(user)
async def prefix(bot,message):
if botdata.beta:
return ["s@"]
return ["s."]
bot = MyBot(command_prefix=prefix,intents=discord.Intents.all())
bot.allowed_mentions = discord.AllowedMentions(replied_user=False)
bot.remove_command("help")
bot.load_extension("jishaku")
for cogf in glob.glob("cog/*.py"):
bot.load_extension(f"cog.{cogf[4:-3]}")
if botdata.beta:
for cogf in glob.glob("beta/*.py"):
bot.load_extension(f"beta.{cogf[5:-3]}")
bot.admin = botdata.admin
bot.beta = botdata.beta
bot.color = botdata.color
bot.emoji = botdata.emoji
bot.help_cog = botdata.help_cog
bot.db = mysql.connect(
#省略
)
bot.db.ping(reconnect=True)
bot.run("")#省略
bot.db.close()
try:
run()
except Exception as error:
try:
if bot.db.is_connected():
bot.db.close()
except:
pass
import json
import requests
import traceback
send = requests.post(
#省略
)
if str(send.status_code)[0] != "2":
print(traceback.format_exc())
requests.post(
#省略
)
command = input()
if command == "end":
with open("reboot.txt","w") as f:
f.write("false")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment