telegram: Remove implicit value for entity_cache in function declarations,
patch 2c875a55dfbf11c2895bdfb365b75ac8198dc74c
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sun Jan 30 22:06:02 CET 2022
* telegram: Remove implicit value for entity_cache in function declarations,
if entity_cache already existed was not assigning the default value so was
confusing. Add comments to explain that entity_cache should be a list.
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-23 01:34:22.756076462 +0100
+++ new-irgramd/telegram.py 2024-11-23 01:34:22.756076462 +0100
@@ -198,8 +198,9 @@
self.irc.users[irc_nick].bot = bot
return bot
- async def get_channel_topic(self, channel, entity_cache=[None]):
+ async def get_channel_topic(self, channel, entity_cache):
tid = self.get_tid(channel)
+ # entity_cache should be a list to be a persistent and by reference value
if entity_cache[0]:
entity = entity_cache[0]
else:
@@ -208,11 +209,12 @@
entity_type = self.get_entity_type(entity)
return 'Telegram ' + entity_type + ' ' + str(tid) + ': ' + entity.title
- async def get_channel_creation(self, channel, entity_cache=[None]):
+ async def get_channel_creation(self, channel, entity_cache):
tid = self.get_tid(channel)
if tid in self.channels_date.keys():
timestamp = self.channels_date[tid]
else:
+ # entity_cache should be a list to be a persistent and by reference value
if entity_cache[0]:
entity = entity_cache[0]
else: