Skip to content

Commit

Permalink
Merge pull request #945 from kobo220/main
Browse files Browse the repository at this point in the history
Bug fix telegramMessages.py
  • Loading branch information
abrignoni authored Nov 21, 2024
2 parents 401a88c + 1478230 commit c8d46e4
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion scripts/artifacts/telegramMesssages.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,39 @@ class Type(enum.Enum):
geoProximityReached = 21
groupPhoneCall = 22
inviteToGroupPhoneCall = 23
setChatTheme = 24
joinedByRequest = 25
webViewData = 26
giftPremium = 27
topicCreated = 28
topicEdited = 29
suggestedProfilePhoto = 30
attachMenuBotAllowed = 31
requestedPeer = 32
setChatWallpaper = 33
setSameChatWallpaper = 34
botAppAccessGranted = 35
giftCode = 36
giveawayLaunched = 37
joinedChannel = 38
giveawayResults = 39
boostsApplied = 40
paymentRefunded = 41
giftStars = 42
prizeStars = 43
starGift = 44

def __init__(self, dec):
raw = {k: v for k, t, v in dec._iter_kv()}
self.type = self.Type(raw.get('_rawValue', 0))
raw_value = raw.get('_rawValue', 0)
try:
self.type = self.Type(raw_value)
except ValueError:
print(f"ValueError: Unknown type value '{raw_value}', defaulting to 'unknown'.")
self.type = self.Type.unknown
except Exception as e:
print(f"Unexpected error: {e}, defaulting to 'unknown'.")
self.type = self.Type.unknown
if '_rawValue' in raw:
del raw['_rawValue']
self.payload = raw
Expand Down

0 comments on commit c8d46e4

Please sign in to comment.