Skip to content

Commit

Permalink
Merge pull request #136 from mii-10/master
Browse files Browse the repository at this point in the history
  • Loading branch information
takumi0213 authored Nov 2, 2024
2 parents 9530263 + d3131a7 commit eee26ea
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cogs/m10s_set_activity_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class m10s_act_role(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.cvtdict = {
"unknown":-1,
"playing":0,
"streaming":1,
"listening":2,
"watching":3,
"custom":4,
"competing":5
-1:"unknown",
0:"playing",
1:"streaming",
2:"listening",
3:"watching",
4:"custom",
5:"competing"
}

@commands.hybrid_command(name="activity_role_setting", description="プレイ中ステータスに応じた役職付与を受け付けるかどうか")
Expand Down Expand Up @@ -92,16 +92,16 @@ async def playing_roles(self, ctx, activity_type:int, role:Optional[discord.Role
except:
await ctx.send("> エラー\n アクティビティタイプが不明です。`s-help prole`を参考にしてください。")
else:
rtn = await self.bot.cursor.fetchone("select * from activity_roles where guild_id = %s AND activity_type = %s", (ctx.guild.id,act_id))
rtn = await self.bot.cursor.fetchone("select * from activity_roles where guild_id = %s AND activity_type = %s", (ctx.guild.id,activity_type))
# await self.bot.cursor.execute()
if rtn:
if role:
await self.bot.cursor.execute("UPDATE activity_roles SET role_id = %s WHERE guild_id = %s AND activity_type = %s",(role.id,ctx.guild.id,act_id))
await self.bot.cursor.execute("UPDATE activity_roles SET role_id = %s WHERE guild_id = %s AND activity_type = %s",(role.id,ctx.guild.id,activity_type))
else:
await self.bot.cursor.execute("DELETE FROM activity_roles WHERE guild_id = %s AND activity_type = %s",(ctx.guild.id,act_id))
await self.bot.cursor.execute("DELETE FROM activity_roles WHERE guild_id = %s AND activity_type = %s",(ctx.guild.id,activity_type))
else:
if role:
await self.bot.cursor.execute("INSERT INTO activity_roles(guild_id,activity_type,role_id) VALUES(%s,%s,%s)",(ctx.guild.id,act_id,role.id))
await self.bot.cursor.execute("INSERT INTO activity_roles(guild_id,activity_type,role_id) VALUES(%s,%s,%s)",(ctx.guild.id,activity_type,role.id))
try:
await ctx.reply("> アクティビティロール\n 正常に登録/更新/削除が完了しました。")
except:
Expand Down

0 comments on commit eee26ea

Please sign in to comment.