This repository has been archived by the owner on May 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uso_startup.py
70 lines (51 loc) · 1.26 KB
/
uso_startup.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
# Uso startup file
import sys
import json
import time
sys.path.insert(0, './discord')
sys.path.insert(0, './irc')
sys.path.insert(0, './api')
#Configs
config_path = './config.json'
settings = json.loads(open(config_path, 'r').read())
link_dictionary = {} # Osu id : [Key, Discord Id]
from libs.logs import Log
from threading import Thread
#Logs
logs = Log()
import discord_bot
import irc_bot
import api_bot
#Logs thread
run_log_thread = True
#Logs thread function
def send_logs():
""" Sending logs every 10 Sec to avoid slowing down commands """
print('Running log thread ..')
while run_log_thread:
try:
time.sleep(10)
logs.send_logs()
except:
pass
print('Terminated log thread !')
return
def discord_th():
print('Running discord thread ..')
discord_bot.run_discord()
print('Terminated discord thread !')
return
def irc_th():
print('Running irc thread ..')
irc_bot.run_irc()
print('Terminated irc thread !')
return
logs_thread = Thread(target=send_logs)
irc_thread = Thread(target=irc_th)
logs_thread.start()
irc_thread.start()
discord_bot.run_discord()
irc_thread.join()
run_log_thread = False
logs_thread.join()
print('USO BOT HAS BEEN TERMINATED !')