Created
January 19, 2021 07:53
-
-
Save dpy-manager-bot/b74e2ccb741260698c6d073ba1ecf2ae to your computer and use it in GitHub Desktop.
A file by Takkun#1643 in the discord.py guild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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