change(name): set cluser_ as fallback_

This commit is contained in:
Romain J 2020-01-01 23:44:46 +01:00
parent 6cd66ba407
commit c71c976111
15 changed files with 33 additions and 24 deletions

2
.gitignore vendored
View file

@ -12,7 +12,7 @@ private.py
.idea/
#other
*.log
logs/tuxbot.log
# Byte-compiled / optimized / DLL files

5
bot.py
View file

@ -18,6 +18,7 @@ from cogs.utils.version import Version
description = """
Je suis TuxBot, le bot qui vit de l'OpenSource ! ;)
"""
build = git.Repo(search_parent_directories=True).head.object.hexsha
log = logging.getLogger(__name__)
@ -25,7 +26,7 @@ log = logging.getLogger(__name__)
l_extensions: List[str] = [
'cogs.admin',
'cogs.basics',
'cogs.cluster_manager',
'cogs.fallback_manager',
'cogs.logs',
'cogs.poll',
'cogs.user',
@ -144,7 +145,7 @@ class TuxBot(commands.AutoShardedBot):
)
)
print(f"Discord.py: {discord.__version__}")
print(f"Cluster: {self.cluster.get('Name')}")
print(f"Server: {self.cluster.get('Name')}")
print('-' * 60)
await self.change_presence(**presence)

View file

@ -28,7 +28,7 @@ class Monitoring(commands.Cog):
def cog_unload(self):
self.ping_clusters.stop()
@tasks.loop(minutes=2.0)
@tasks.loop(seconds=10.0)
async def ping_clusters(self):
for cluster in self.bot.clusters:
if cluster == 'DEFAULT':
@ -40,17 +40,19 @@ class Monitoring(commands.Cog):
port = cluster.get('Port')
try:
req = urllib.request.urlopen(f"http://{host}:{port}",
timeout=2)
req = urllib.request.urlopen(
f"http://{host}:{port}",
timeout=2
)
except Exception:
global_channel = await self.bot.fetch_channel(
661347412463321098
)
e = discord.Embed(
title=f"Cluster `{cluster.get('Name')}`",
title=f"Server `{cluster.get('Name')}`",
color=discord.colour.Color.red(),
description=f"Cluster **`{cluster.get('Name')}`** with address **`http://{host}:{port}`** is down ! ",
description=f"Server **`{cluster.get('Name')}`** with address **`http://{host}:{port}`** is down ! ",
timestamp=datetime.now()
)
e.set_thumbnail(
@ -74,9 +76,9 @@ class Monitoring(commands.Cog):
)
e = discord.Embed(
title=f"Cluster `{cluster.get('Name')}`",
title=f"Server `{cluster.get('Name')}`",
color=discord.colour.Color.green(),
description=f"Cluster **`{cluster.get('Name')}`** with address **`http://{host}:{port}`** is started ! ",
description=f"Server **`{cluster.get('Name')}`** with address **`http://{host}:{port}`** is started ! ",
timestamp=datetime.now()
)
e.set_thumbnail(

0
logs/tuxbot.log Normal file
View file

View file

@ -1,6 +1,6 @@
requests
humanize
discord.py[voice]
git+https://github.com/Rapptz/discord.py@master
jishaku
gitpython
sqlalchemy

View file

@ -37,7 +37,7 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV="/opt/tuxbot-bot/venv"
VIRTUAL_ENV="/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"

View file

@ -8,7 +8,7 @@ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PA
# Unset irrelevant variables.
deactivate nondestructive
setenv VIRTUAL_ENV "/opt/tuxbot-bot/venv"
setenv VIRTUAL_ENV "/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
set _OLD_VIRTUAL_PATH="$PATH"
setenv PATH "$VIRTUAL_ENV/bin:$PATH"

View file

@ -29,7 +29,7 @@ end
# unset irrelevant variables
deactivate nondestructive
set -gx VIRTUAL_ENV "/opt/tuxbot-bot/venv"
set -gx VIRTUAL_ENV "/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/bin" $PATH

View file

@ -1,8 +1,10 @@
#!/opt/tuxbot-bot/venv/bin/python
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from chardet.cli.chardetect import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View file

@ -1,4 +1,4 @@
#!/opt/tuxbot-bot/venv/bin/python
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys

View file

@ -1,8 +1,10 @@
#!/opt/tuxbot-bot/venv/bin/python
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from import_expression.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View file

@ -1,4 +1,4 @@
#!/opt/tuxbot-bot/venv/bin/python
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys

View file

@ -1,4 +1,4 @@
#!/opt/tuxbot-bot/venv/bin/python
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys

View file

@ -1,8 +1,10 @@
#!/opt/tuxbot-bot/venv/bin/python
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from tcp_latency.tcp_latency import _main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(_main())

View file

@ -1,3 +1,3 @@
home = /usr/bin
include-system-site-packages = false
version = 3.8.1
version = 3.8.0