added scan_messages to Kwaylon to incorporate the async lock on the database file
This commit is contained in:
@@ -109,8 +109,8 @@ class Kwaylon(Client):
|
||||
msg = await self.fetch_message(most)
|
||||
await message.reply(f'Most {emoji_ref} in past {days} days\n{msg.jump_url}')
|
||||
|
||||
else:
|
||||
await message.reply(f"NObody (in the past {days} days)...gah, leave me alone!")
|
||||
# else:
|
||||
# await message.reply(f"NObody (in the past {days} days)...gah, leave me alone!")
|
||||
|
||||
LOGGER.info(f'Done')
|
||||
|
||||
@@ -150,6 +150,10 @@ class Kwaylon(Client):
|
||||
channel = await guild.fetch_channel(row['channel_id'])
|
||||
return await channel.fetch_message(row['msg_id'])
|
||||
|
||||
async def scan_messages(self, **kwargs):
|
||||
async with self.lock:
|
||||
await self.data.scan_messages(client=self, **kwargs)
|
||||
|
||||
|
||||
def get_emoji_name(string: str) -> str:
|
||||
if (m := re.search('<:(?P<name>\w+):(?P<id>\d+)>', string)):
|
||||
|
||||
Reference in New Issue
Block a user