diff --git a/dislocker.py b/dislocker.py index 01595be..a394189 100644 --- a/dislocker.py +++ b/dislocker.py @@ -11,6 +11,9 @@ class Bot(discord.Client): if message.author.bot: return + if isinstance(message.channel, discord.DMChannel): + await message.channel.send("DMを確認") + if message.content == "/hello": await message.channel.send("こんにちは!!!!") @@ -39,25 +42,39 @@ class Cert(): elif result[0][1] == username and result[0][2] == password: return 0 -class Web(flask.Flask): - async def temp(self): - print("") +#cert = Cert() +config_dir_path = "./confg/" +db_config_path = config_dir_path + "db.json" +if not os.path.isfile(db_config_path): + if not os.path.isdir(config_dir_path): + os.mkdir(config_dir_path) -cert = Cert() -print(cert.get_username("suti7", "0126")) + db_config = { + "host": "localhost", + "db": "dislocker", + "username": "user", + "password": "example_pass" + } + with open(db_config_path, "w") as w: + json.dump(db_config, w, indent=4) +elif os.path.isfile(db_config_path): + with open(db_config_path, "r") as r: + db_config = json.load(r) - -bot_config_path = "./config/bot.json" +bot_config_path = config_dir_path + "bot.json" if not os.path.isfile(bot_config_path): + if not os.path.isdir(config_dir_path): + os.mkdir(config_dir_path) + bot_config = { - "token": "" + "token": "TYPE HERE BOTS TOKEN KEY" } with open(bot_config_path, "w") as w: json.dump(bot_config, w, indent=4) elif os.path.isfile(bot_config_path): - with open("./config/bot.json", "r") as r: + with open(bot_config_path, "r") as r: bot_config = json.load(r) intents = discord.Intents.default()