Compare commits

...

2 commits

Author SHA1 Message Date
61219d52ef 1st 2024-06-04 19:53:35 +09:00
05f17d6d68 DMかを判断できるように 2024-06-04 19:53:24 +09:00
2 changed files with 30 additions and 9 deletions

View file

@ -11,6 +11,9 @@ class Bot(discord.Client):
if message.author.bot: if message.author.bot:
return return
if isinstance(message.channel, discord.DMChannel):
await message.channel.send("DMを確認")
if message.content == "/hello": if message.content == "/hello":
await message.channel.send("こんにちは!!!!") await message.channel.send("こんにちは!!!!")
@ -39,25 +42,39 @@ class Cert():
elif result[0][1] == username and result[0][2] == password: elif result[0][1] == username and result[0][2] == password:
return 0 return 0
class Web(flask.Flask): #cert = Cert()
async def temp(self):
print("")
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() db_config = {
print(cert.get_username("suti7", "0126")) "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_dir_path + "bot.json"
bot_config_path = "./config/bot.json"
if not os.path.isfile(bot_config_path): if not os.path.isfile(bot_config_path):
if not os.path.isdir(config_dir_path):
os.mkdir(config_dir_path)
bot_config = { bot_config = {
"token": "" "token": "TYPE HERE BOTS TOKEN KEY"
} }
with open(bot_config_path, "w") as w: with open(bot_config_path, "w") as w:
json.dump(bot_config, w, indent=4) json.dump(bot_config, w, indent=4)
elif os.path.isfile(bot_config_path): 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) bot_config = json.load(r)
intents = discord.Intents.default() intents = discord.Intents.default()

4
requirements.txt Normal file
View file

@ -0,0 +1,4 @@
discord.py
flask
flask-login
psycopg2