admin_userとserver_idをリストにして複数指定できるように
This commit is contained in:
parent
364b32c0e7
commit
31fd32acc9
1 changed files with 10 additions and 10 deletions
|
@ -37,7 +37,7 @@ class DL():
|
|||
"password": "password"
|
||||
},
|
||||
"bot": {
|
||||
"server_id": "TYPE HERE SERVER ID",
|
||||
"server_id": ["TYPE HERE SERVER ID (YOU MUST USE INT !!!!)"],
|
||||
"token": "TYPE HERE BOTS TOKEN KEY",
|
||||
"activity": {
|
||||
"name": "Dislocker",
|
||||
|
@ -54,7 +54,7 @@ class DL():
|
|||
"fstop_time": "21:00:00"
|
||||
},
|
||||
"preset_games": ["TEST1", "TEST2", "TEST3", "TEST4", "TEST5"],
|
||||
"admin_user_id": "TYPE HERE CHANNEL ID (YOU MUST USE INT !!!!)",
|
||||
"admin_user_id": ["TYPE HERE CHANNEL ID (YOU MUST USE INT !!!!)"],
|
||||
"debug": False
|
||||
}
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ async def on_message(message):
|
|||
pass
|
||||
|
||||
elif isinstance(message.channel, discord.DMChannel):
|
||||
if message.author.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if message.author.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
msg_split = message.content.split()
|
||||
|
||||
if msg_split[0] == "/pcreg":
|
||||
|
@ -1205,7 +1205,7 @@ async def stop(interaction: discord.Interaction):
|
|||
@tree.command(name="userreg", description="ユーザーを登録します。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def userreg(interaction: discord.Interaction, discord_user_id: str, discord_user_name: str, name: str):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
user_register = dislocker.user_register(discord_user_id=discord_user_id, discord_user_name=discord_user_name, name=name)
|
||||
if user_register["result"] == 0:
|
||||
await interaction.response.send_message(":white_check_mark: ユーザーを登録しました。", ephemeral=True)
|
||||
|
@ -1219,7 +1219,7 @@ async def userreg(interaction: discord.Interaction, discord_user_id: str, discor
|
|||
@tree.command(name="pcreg", description="PCをDislockerに登録するためのワンタイムパスワードを発行します。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def pcreg(interaction: discord.Interaction, how_much: int = 1):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
max_count = how_much
|
||||
|
||||
pc_onetime_password_gen = dislocker.pc_onetime_gen(max_count=max_count)
|
||||
|
@ -1244,7 +1244,7 @@ async def pcreg(interaction: discord.Interaction, how_much: int = 1):
|
|||
@tree.command(name="devicereg", description="デバイスをDislockerに登録するためのワンタイムパスワードを発行します。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def devicereg(interaction: discord.Interaction, how_much: int):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
max_count = how_much
|
||||
|
||||
device_onetime_password_gen = dislocker.device_onetime_gen(max_count=max_count)
|
||||
|
@ -1269,7 +1269,7 @@ async def devicereg(interaction: discord.Interaction, how_much: int):
|
|||
@tree.command(name="fstop", description="PCの使用登録を強制的に終了します。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def fstop(interaction: discord.Interaction, pc_number: int, about: str):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
force_stop = dislocker.force_stop(pc_number=pc_number, bot_about=about)
|
||||
if force_stop["result"] == 0:
|
||||
await interaction.response.send_message(f":white_check_mark: PC {pc_number} の使用を強制終了しました。", ephemeral=True)
|
||||
|
@ -1285,7 +1285,7 @@ async def fstop(interaction: discord.Interaction, pc_number: int, about: str):
|
|||
@tree.command(name="report", description="PCの使用履歴をエクスポートします。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def report(interaction: discord.Interaction):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
report_export = dislocker.report_export()
|
||||
if report_export["result"] == 0:
|
||||
await interaction.response.send_message(f":white_check_mark: 使用履歴のレポートです。", file=discord.File(report_export["file_path"]), ephemeral=True)
|
||||
|
@ -1297,7 +1297,7 @@ async def report(interaction: discord.Interaction):
|
|||
@tree.command(name="init", description="操作チャンネルにボタン一式を送信します。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def button_init(interaction: discord.Interaction, text_channel: discord.TextChannel):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
user_register_button_view = discord.ui.View(timeout=None)
|
||||
user_register_button = discord.ui.Button(style=discord.ButtonStyle.green, label="ユーザー登録", custom_id="user_register")
|
||||
user_register_button_view.add_item(user_register_button)
|
||||
|
@ -1323,7 +1323,7 @@ async def button_init(interaction: discord.Interaction, text_channel: discord.Te
|
|||
@tree.command(name="masterpass", description="PCのマスターパスワードを表示します。")
|
||||
@discord.app_commands.default_permissions(administrator=True)
|
||||
async def masterpass(interaction: discord.Interaction, pc_number: int):
|
||||
if interaction.guild_id == dislocker.server_config["bot"]["server_id"] or interaction.user.id == dislocker.server_config["bot"]["admin_user_id"]:
|
||||
if interaction.guild_id in dislocker.server_config["bot"]["server_id"] or interaction.user.id in dislocker.server_config["bot"]["admin_user_id"]:
|
||||
pc_master_password_get = dislocker.show_pc_master_password(pc_number=pc_number)
|
||||
|
||||
if pc_master_password_get["result"] == 0:
|
||||
|
|
Loading…
Reference in a new issue