fixed a typo with the async lock

This commit is contained in:
jsl12
2022-01-24 11:33:08 -06:00
parent 110e0bcd6a
commit 2181e71e44
2 changed files with 4 additions and 13 deletions

View File

@@ -41,7 +41,6 @@ class Kwaylon(Client):
# await alive() # await alive()
self.data = ReactionData(self.db_path) self.data = ReactionData(self.db_path)
# await self.data.scan_messages(client=self, limit=100)
self.data.read_all() self.data.read_all()
async def handle_message(self, message: Message): async def handle_message(self, message: Message):
@@ -116,7 +115,7 @@ class Kwaylon(Client):
channel = await guild.fetch_channel(payload.channel_id) channel = await guild.fetch_channel(payload.channel_id)
message = await channel.fetch_message(payload.message_id) message = await channel.fetch_message(payload.message_id)
with self.lock: async with self.lock:
with self.data.connect() as con: with self.data.connect() as con:
self.data.add_reactions_from_message(message, con) self.data.add_reactions_from_message(message, con)
con.close() con.close()

14
main.py
View File

@@ -11,21 +11,13 @@ if __name__ == '__main__':
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
client = Kwaylon( client = Kwaylon()
# limit=100,
# days=60
)
@client.event @client.event
async def on_ready(): async def on_ready():
await client.handle_ready() await client.handle_ready()
# await client.data.scan_messages( # await client.data.scan_messages(client=client, days=10)
# client=client,
# # limit=100,
# days=60,
# )
@client.event @client.event
async def on_message(message: discord.Message): async def on_message(message: discord.Message):
@@ -40,7 +32,7 @@ if __name__ == '__main__':
@client.event @client.event
async def on_raw_reaction_remove(payload: RawReactionActionEvent): async def on_raw_reaction_remove(payload: RawReactionActionEvent):
await client.handle_raw_reaction(payload) await client.handle_raw_reaction(payload)
# await client.data.remove_reaction(payload)
load_dotenv() load_dotenv()
client.run(os.getenv('DISCORD_TOKEN')) client.run(os.getenv('DISCORD_TOKEN'))