This commit is contained in:
Skillet 2023-04-18 00:07:20 -04:00
parent 6c120f8782
commit 3b776fc972
2 changed files with 12 additions and 9 deletions

View File

@ -27,14 +27,17 @@ class Group(commands.Cog, name="group"):
membsup = []
for memb in role.members:
membsup.append(memb.id)
memupcur = self.client.squadjs.cursor(buffered=True)
in_params = ','.join(['%s'] * len(membsup))
sqlstate = "SELECT * FROM DBLog_SteamUsers WHERE discordID IN (%s)" % in_params
memupcur.execute(sqlstate, membsup)
if len(membsup) > 0:
memupcur = self.client.squadjs.cursor(buffered=True)
in_params = ','.join(['%s'] * len(membsup))
sqlstate = "SELECT * FROM DBLog_SteamUsers WHERE discordID IN (%s)" % in_params
log.info(sqlstate)
memupcur.execute(sqlstate, membsup)
udata = memupcur.fetchall()
for data in udata:
self.client.whitelistGrps[role.id].addMember(config.WhitelistMember(data[2], data[1], data[0]))
udata = memupcur.fetchall()
for data in udata:
self.client.whitelistGrps[role.id].addMember(config.WhitelistMember(data[2], data[1], data[0]))
await interaction.response.send_message("Whitelist group successfully added/updated")
self.client.squadjs.commit()

View File

@ -75,7 +75,7 @@ class Bot(commands.Bot):
rmroles.remove(aftrole.id)
log.info(f"roles found to remove from {disusername}: {rmroles}")
for rmroleid in rmroles:
if not rmroleid in self.whitelistGrps.keys():
if not(rmroleid in self.whitelistGrps.keys()):
continue
self.whitelistGrps[rmroleid].delMember(before.id)
@ -88,7 +88,7 @@ class Bot(commands.Bot):
addroles.remove(befrole.id)
log.info(f"roles found to add to {disusername}: {addroles}")
for addroleid in addroles:
if not addroleid in self.whitelistGrps.keys():
if not(addroleid in self.whitelistGrps.keys()):
continue
self.whitelistGrps[addroleid].addMember(config.WhitelistMember(after.id, disusername, userdata[0]))
self.squadjs.commit()