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/ .idea/
#other #other
*.log logs/tuxbot.log
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

5
bot.py
View file

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

View file

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

0
logs/tuxbot.log Normal file
View file

View file

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

View file

@ -37,7 +37,7 @@ deactivate () {
# unset irrelevant variables # unset irrelevant variables
deactivate nondestructive deactivate nondestructive
VIRTUAL_ENV="/opt/tuxbot-bot/venv" VIRTUAL_ENV="/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
export VIRTUAL_ENV export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH" _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. # Unset irrelevant variables.
deactivate nondestructive 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" set _OLD_VIRTUAL_PATH="$PATH"
setenv PATH "$VIRTUAL_ENV/bin:$PATH" setenv PATH "$VIRTUAL_ENV/bin:$PATH"

View file

@ -29,7 +29,7 @@ end
# unset irrelevant variables # unset irrelevant variables
deactivate nondestructive 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 _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/bin" $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 -*- # -*- coding: utf-8 -*-
import re import re
import sys import sys
from chardet.cli.chardetect import main from chardet.cli.chardetect import main
if __name__ == '__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()) 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 -*- # -*- coding: utf-8 -*-
import re import re
import sys 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 -*- # -*- coding: utf-8 -*-
import re import re
import sys import sys
from import_expression.__main__ import main from import_expression.__main__ import main
if __name__ == '__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()) 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 -*- # -*- coding: utf-8 -*-
import re import re
import sys 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 -*- # -*- coding: utf-8 -*-
import re import re
import sys 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 -*- # -*- coding: utf-8 -*-
import re import re
import sys import sys
from tcp_latency.tcp_latency import _main from tcp_latency.tcp_latency import _main
if __name__ == '__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()) sys.exit(_main())

View file

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