This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
72 lines (65 loc) · 2.04 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import os
from src.bot import TranslateTweetsBot
from src.modules.twitter import Client, StreamClient
bot_settings = {
# test users and admins
"admins": ["FreenBeckyBot", "joohwangblink"],
# twitter users and their respective emoji/alias
# this could be accounts your biases regularily interact with
# (including your biases)
"twitter_handles": {
"srchafreen": "\ud83d\udc30",
"AngelssBecky": "\ud83e\udda6"
},
}
translation_settings = {
# language settings
"src": "th",
"dst": "en",
# replacements applied before translating
"glossary": {
"มามี้": "Mami",
"ปีโย๊": "Piyo",
"ฟรีนกี้": "Freenky",
"พี่ฟรีน": "P'Freen",
"ฟรีน": "Freen",
"คุณสาม": "คุณแซม", # Khun Sam
"น้องพุง": "Nong Belly",
"น้อง": "Nong",
"คุณ": "Khun",
},
# replacements applied after translating
"corrections": {
"Beck ": "Bec ",
"I am": "",
"I'm ": "",
"I ": "",
" me ": " me/you ",
" me.": " me/you.",
"boyfriend": "girlfriend",
" him ": " her ",
" him.": " her.",
" his ": " her ",
},
}
consumer_key = os.getenv("CONSUMER_KEY")
consumer_secret = os.getenv("CONSUMER_SECRET")
access_token = os.getenv("ACCESS_TOKEN")
access_token_secret = os.getenv("ACCESS_TOKEN_SECRET")
bearer_token = os.getenv("BEARER_TOKEN")
def main():
api = Client(consumer_key,consumer_secret,access_token, access_token_secret)
streamapi = StreamClient(bearer_token)
bot = TranslateTweetsBot(
src=translation_settings["src"],
dst=translation_settings["dst"],
glossary=translation_settings["glossary"],
corrections=translation_settings["corrections"],
admins=bot_settings["admins"],
handles=bot_settings["twitter_handles"],
api=api,
streamapi=streamapi
)
bot.start()
if __name__ == "__main__":
main()