-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (22 loc) · 789 Bytes
/
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
from threading import Thread
from time import sleep
from config import Config
from sender import Sender
from tweet import TweetApi
class Main:
def __init__(self, Twitter_UserID, CqHost, GroupID, CqToken):
self.sender = Sender(CqHost, GroupID, CqToken)
self.sender.start()
self.t = TweetApi(Twitter_UserID)
while True:
for i in self.t.updateTweet():
self.sender.send(i)
sleep(Config.CheckSec)
def newMain(Twitter_UserID, CqHost, GroupID, CqToken):
m = Main(Twitter_UserID, CqHost, GroupID, CqToken)
def main():
for t in Config.Target:
th = Thread(target=newMain, args=(t['Twitter_UserID'], t['CqHost'], t['GroupID'], t['CqToken']))
th.start()
if __name__ == '__main__':
main()