mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Modlog] Reduce potential for bad API calls (#2945)
- brings a fix over from #2934
This commit is contained in:
parent
3c1b6ae4cf
commit
2c8152606c
1
changelog.d/modlog/2945.fix.rst
Normal file
1
changelog.d/modlog/2945.fix.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Remove potential for additional bad API calls per ban/unban
|
||||||
@ -74,7 +74,8 @@ async def _init(bot: Red):
|
|||||||
await asyncio.sleep(10) # prevent small delays from causing a 5 minute delay on entry
|
await asyncio.sleep(10) # prevent small delays from causing a 5 minute delay on entry
|
||||||
|
|
||||||
attempts = 0
|
attempts = 0
|
||||||
while attempts < 12: # wait up to an hour to find a matching case
|
# wait up to an hour to find a matching case
|
||||||
|
while attempts < 12 and guild.me.guild_permissions.view_audit_log:
|
||||||
attempts += 1
|
attempts += 1
|
||||||
try:
|
try:
|
||||||
entry = await guild.audit_logs(
|
entry = await guild.audit_logs(
|
||||||
@ -109,7 +110,8 @@ async def _init(bot: Red):
|
|||||||
await asyncio.sleep(10) # prevent small delays from causing a 5 minute delay on entry
|
await asyncio.sleep(10) # prevent small delays from causing a 5 minute delay on entry
|
||||||
|
|
||||||
attempts = 0
|
attempts = 0
|
||||||
while attempts < 12: # wait up to an hour to find a matching case
|
# wait up to an hour to find a matching case
|
||||||
|
while attempts < 12 and guild.me.guild_permissions.view_audit_log:
|
||||||
attempts += 1
|
attempts += 1
|
||||||
try:
|
try:
|
||||||
entry = await guild.audit_logs(
|
entry = await guild.audit_logs(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user