Skip to content

Commit

Permalink
Fixes for error message scrapper (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpEcHiDe committed Jul 16, 2024
1 parent d0aad9d commit b6605d2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
12 changes: 7 additions & 5 deletions compiler/errors/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
for h in e:
dct = {}

for p in Path("source/").glob(f"{h}*.tsv"):
with open(p) as f:
reader = csv.reader(f, delimiter="\t")
dct = {k: v for k, v in reader if k != "id"}

j = d.get("errors").get(h)
for k in j:
if k.endswith("_*"):
Expand All @@ -72,6 +67,13 @@
l = l.replace("%d", "{value}")
dct[m] = l

for p in Path("source/").glob(f"{h}*.tsv"):
with open(p) as f:
reader = csv.reader(f, delimiter="\t")
for k, v in reader:
if k != "id":
dct[k] = v

keys = sorted(dct)

for p in Path("source/").glob(f"{h}*.tsv"):
Expand Down
2 changes: 1 addition & 1 deletion compiler/errors/source/400_BAD_REQUEST.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -518,4 +518,4 @@ WEBPAGE_URL_INVALID The specified webpage `url` is invalid.
WEBPUSH_AUTH_INVALID The specified web push authentication secret is invalid.
WEBPUSH_KEY_INVALID The specified web push elliptic curve Diffie-Hellman public key is invalid.
WEBPUSH_TOKEN_INVALID The specified web push token is invalid.
YOU_BLOCKED_USER You blocked this user.
YOU_BLOCKED_USER You blocked this user.
4 changes: 2 additions & 2 deletions compiler/errors/source/403_FORBIDDEN.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GROUPCALL_ALREADY_STARTED The groupcall has already started, you can join direct
GROUPCALL_FORBIDDEN The group call has already ended.
INLINE_BOT_REQUIRED Only the inline bot can edit message.
MESSAGE_AUTHOR_REQUIRED Message author required.
MESSAGE_DELETE_FORBIDDEN You can't delete one of the messages you tried to delete, most likely because it is a service message.
MESSAGE_DELETE_FORBIDDEN You can't delete one of the messages you tried to delete.
NOT_ELIGIBLE You are not eligible to take part in Telegram's Premium for SMS initiative
PARTICIPANT_JOIN_MISSING Trying to enable a presentation, when the user hasn't joined the Video Chat with [phone.joinGroupCall](https://core.telegram.org/method/phone.joinGroupCall).
POLL_VOTE_REQUIRED Cast a vote in the poll before calling this method.
Expand All @@ -43,4 +43,4 @@ USER_IS_BLOCKED You were blocked by this user.
USER_NOT_MUTUAL_CONTACT The provided user is not a mutual contact.
USER_PRIVACY_RESTRICTED The user's privacy settings do not allow you to do this.
USER_RESTRICTED You're spamreported, you can't create channels or chats.
VOICE_MESSAGES_FORBIDDEN This user's privacy settings forbid you from sending voice messages.
VOICE_MESSAGES_FORBIDDEN This user's privacy settings forbid you from sending voice messages.
2 changes: 1 addition & 1 deletion compiler/errors/source/406_NOT_ACCEPTABLE.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ TOPIC_CLOSED This topic was closed, you can't send messages to it anymore.
TOPIC_DELETED The specified topic was deleted.
USERPIC_PRIVACY_REQUIRED You need to disable privacy settings for your profile picture in order to make your geolocation public.
USERPIC_UPLOAD_REQUIRED You must have a profile picture to publish your geolocation.
USER_RESTRICTED You're spamreported, you can't create channels or chats.
USER_RESTRICTED You're spamreported, you can't create channels or chats.
2 changes: 1 addition & 1 deletion compiler/errors/source/420_FLOOD.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ FLOOD_WAIT_X A wait of {value} seconds is required
PREMIUM_SUB_ACTIVE_UNTIL_X You already have a premium subscription active until unixtime {value} .
SLOWMODE_WAIT_X Slowmode is enabled in this chat: wait {value} seconds before sending another message to this chat.
STORY_SEND_FLOOD_X A wait of {value} seconds is required to continue posting stories
TAKEOUT_INIT_DELAY_X Sorry, for security reasons, you will be able to begin downloading your data in {value} seconds. We have notified all your devices about the export request to make sure it's authorized and to give you time to react if it's not.
TAKEOUT_INIT_DELAY_X Sorry, for security reasons, you will be able to begin downloading your data in {value} seconds. We have notified all your devices about the export request to make sure it's authorized and to give you time to react if it's not.
2 changes: 1 addition & 1 deletion compiler/errors/source/500_INTERNAL_SERVER_ERROR.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ UNKNOWN_METHOD The method you tried to call cannot be called on non-CDN DCs
UPLOAD_NO_VOLUME Telegram is having internal problems. Please try again later
VOLUME_LOC_NOT_FOUND Telegram is having internal problems. Please try again later
WORKER_BUSY_TOO_LONG_RETRY Server workers are too busy right now due to Telegram having internal problems. Please try again later
WP_ID_GENERATE_FAILED Telegram is having internal problems. Please try again later
WP_ID_GENERATE_FAILED Telegram is having internal problems. Please try again later

0 comments on commit b6605d2

Please sign in to comment.