Sign inSign up

whitek/tg_translate

By whitek

•Updated over 2 years ago

- telegram 全自动翻译

Image
API management
0

196

whitek/tg_translate repository overview

version: '3'
services:
  app:
    image: whitek/tg_translate:latest
    restart: always
    environment:
      - PROXY_HOST=192.168.18.22 # 你的代理ip
      - PROXY_PORT=6135   #你的代理端口
      - API_ID=xxx
      - API_HASH=xxx
      - SESSION=xxx
  • how to get session
from telethon.sync import TelegramClient
from telethon.sessions import StringSession
from termcolor import colored, cprint
import socks
import os
import logging
import json

host = "127.0.0.1"
port = 6153
proxy = (socks.SOCKS5, host, port)
api_id = 'api_id'
api_hash = 'api_hash'

def main():
    while True:
        with TelegramClient(StringSession(), api_id, api_hash) as client:
            session_str = client.session.save()
            user_name = "me" if not client.is_bot() else input(colored("Enter the username: ", "green"))
            client.send_message(user_name, session_str)
            cprint("please check your Telegram Saved Messages/User's PM for the StringSession ", "yellow")
        break


if __name__ == "__main__":
    main()
  • how to use

    • .tt-off Direct input in a group disables the translation function of this account/channel number in that chat/group.
    • .tt-on,zh,zh|en|ruSets and enables the translation function for this account/channel number in this chat/group. The parameters are in order: source language, target language list.
  • List of source and target languages for deepl

--------
source language:
---------
AR - Arabic
BG - Bulgarian
CS - Czech
DA - Danish
DE - German
EL - Greek
EN - English
ES - Spanish
ET - Estonian
FI - Finnish
FR - French
HU - Hungarian
ID - Indonesian
IT - Italian
JA - Japanese
KO - Korean
LT - Lithuanian
LV - Latvian
NB - Norwegian (Bokmål)
NL - Dutch
PL - Polish
PT - Portuguese (all Portuguese varieties mixed)
RO - Romanian
RU - Russian
SK - Slovak
SL - Slovenian
SV - Swedish
TR - Turkish
UK - Ukrainian
ZH - Chinese
---------------
target language:
-----------
AR - Arabic
BG - Bulgarian
CS - Czech
DA - Danish
DE - German
EL - Greek
EN - English (unspecified variant for backward compatibility; please select EN-GB or EN-US instead)
EN-GB - English (British)
EN-US - English (American)
ES - Spanish
ET - Estonian
FI - Finnish
FR - French
HU - Hungarian
ID - Indonesian
IT - Italian
JA - Japanese
KO - Korean
LT - Lithuanian
LV - Latvian
NB - Norwegian (Bokmål)
NL - Dutch
PL - Polish
PT - Portuguese (unspecified variant for backward compatibility; please select PT-BR or PT-PT instead)
PT-BR - Portuguese (Brazilian)
PT-PT - Portuguese (all Portuguese varieties excluding Brazilian Portuguese)
RO - Romanian
RU - Russian
SK - Slovak
SL - Slovenian
SV - Swedish
TR - Turkish
UK - Ukrainian
ZH - Chinese (simplified)

Tag summary

Content type

Image

Digest

sha256:bc9a058f9…

Size

39.7 MB

Last updated

over 2 years ago

docker pull whitek/tg_translate