def UpdateData(self):
trigger_of_data = False
first_operation = True
for _data_now in (
self.CheckForFollowers(self.getID(self.username)), self.CheckForFollowing(self.getID(self.username))):
_action = ('subscriptions', 'followers',)[first_operation]
_data_db = (self.subscriptions, self.followers)[first_operation]
d = dict()
**result = d[tuple((set(_data_now) ^ set(_data_db)))]**
print(set(_data_db))
print(set(_data_now))
if result != [] and len(_data_now) > len(_data_db):
for _result in result:
temp_message = (str(self.username), str(self.IdInUsername(_result)))[first_operation]
_temp_message = (str(self.IdInUsername(_result)), str(self.username))[first_operation]
self.tg_bot.send_message(593069749, temp_message + " подписался на " + _temp_message + \
f"\nСыллка на профиль: https://www.instagram.com/{self.IdInUsername(_result)}/"
)
trigger_of_data = True
result = list(set(_data_db) - set(_data_now))
if result != [] and len(_data_db) > len(_data_now):
for _result in result:
temp_message = (str(self.username), str(self.IdInUsername(_result)))[first_operation]
_temp_message = (str(self.IdInUsername(_result)), str(self.username))[first_operation]
self.tg_bot.send_message(593069749, temp_message + " отписался от " + _temp_message + \
f"\nСыллка на профиль: https://www.instagram.com/{self.IdInUsername(_result)}/"
)
trigger_of_data = True
if trigger_of_data:
self.db.update_request(self.username, _action, _data_now)
first_operation = False
trigger_of_data = False