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 = [] membsup = []
for memb in role.members: for memb in role.members:
membsup.append(memb.id) membsup.append(memb.id)
memupcur = self.client.squadjs.cursor(buffered=True) if len(membsup) > 0:
in_params = ','.join(['%s'] * len(membsup)) memupcur = self.client.squadjs.cursor(buffered=True)
sqlstate = "SELECT * FROM DBLog_SteamUsers WHERE discordID IN (%s)" % in_params in_params = ','.join(['%s'] * len(membsup))
memupcur.execute(sqlstate, 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") await interaction.response.send_message("Whitelist group successfully added/updated")
self.client.squadjs.commit() self.client.squadjs.commit()

View File

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