From 05f17d6d68ed7fc262d82a172f295602da82a467 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Tue, 4 Jun 2024 19:53:24 +0900 Subject: [PATCH] =?UTF-8?q?DM=E3=81=8B=E3=82=92=E5=88=A4=E6=96=AD=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dislocker.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) 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()