-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.py
93 lines (86 loc) · 2.97 KB
/
index.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- coding: utf-8 -*-
import asyncio
import importlib
import os
import platform
import sys
import traceback
try:
import aiohttp
import colorama
import jaconv
import sanic
discord = importlib.import_module('discord')
fortnitepy = importlib.import_module('fortnitepy')
pykakasi = importlib.import_module('pykakasi')
except ModuleNotFoundError:
print(traceback.format_exc())
print(f'Python {platform.python_version()}\n')
print(
'サードパーティーライブラリの読み込みに失敗しました。INSTALL を実行してください。問題が修正されない場合は\n'
'Twitter @gomashio1596\n'
'Discord gomashio#4335\n'
'こちらか\n'
'https://discord.gg/NEnka5N\n'
'Discordのサーバーまでお願いします'
)
print(
'Failed to load third party library. Please run INSTALL. If the issue is not resolved, contact me\n'
'Twitter @gomashio1596\n'
'Discord gomashio#4335\n'
'or please join support Discord server\n'
'https://discord.gg/NEnka5N'
)
sys.exit(1)
try:
import modules
except ModuleNotFoundError:
print(traceback.format_exc())
print(f'Python {platform.python_version()}\n')
print(
'モジュールの読み込みに失敗しました。Check Update.bat を実行してください。問題が修正されない場合は\n'
'Twitter @gomashio1596\n'
'Discord gomashio#4335\n'
'こちらか\n'
'https://discord.gg/NEnka5N\n'
'Discordのサーバーまでお願いします'
)
print(
'Failed to module. Please run Check Update.bat. If the issue is not resolved, contact me\n'
'Twitter @gomashio1596\n'
'Discord gomashio#4335\n'
'or please join support Discord server\n'
'https://discord.gg/NEnka5N'
)
sys.exit(1)
if sys.platform == 'win32':
asyncio.set_event_loop(asyncio.ProactorEventLoop())
else:
try:
import uvloop
except ModuleNotFoundError:
pass
else:
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
if __name__ == '__main__':
if (os.getenv('PROJECT_DOMAIN') is not None
and os.getcwd().startswith('/app')
and sys.platform == 'linux'):
mode = 'glitch'
elif (os.getenv('REPLIT_DB_URL') is not None
and os.getcwd().startswith('/home/runner')
and sys.platform == 'linux'):
mode = 'repl'
else:
mode = 'pc'
print(modules.colors.green(
f'V{modules.__version__}\n'
f'Python {platform.python_version()}\n'
f'fortnitepy {fortnitepy.__version__}\n'
f'discord.py {discord.__version__}\n'
f'Sanic {sanic.__version__}'
))
loop = asyncio.get_event_loop()
bot = modules.Bot(mode, loop=loop, dev='-dev' in sys.argv)
bot.setup()
loop.run_until_complete(bot.start())