refactor(cogs): prepare the env for new help command

This commit is contained in:
Romain J 2020-01-04 21:16:37 +01:00
parent 07e683e7cb
commit 7b1fd7b463
43 changed files with 657 additions and 363 deletions

9
bot.py
View file

@ -28,7 +28,7 @@ l_extensions: List[str] = [
'cogs.Admin', 'cogs.Admin',
'cogs.Help', 'cogs.Help',
'cogs.Logs', 'cogs.Logs',
'cogs.Monitoring', # 'cogs.Monitoring',
'cogs.Polls', 'cogs.Polls',
'cogs.Useful', 'cogs.Useful',
'cogs.User', 'cogs.User',
@ -74,7 +74,8 @@ class TuxBot(commands.AutoShardedBot):
self.cluster = self.fallbacks.find('True', key='This', first=True) self.cluster = self.fallbacks.find('True', key='This', first=True)
self.version = Version(*version, pre_release='a5', build=build) self.version = Version(*version, pre_release='a5', build=build)
self.owner = int self.owner: discord.User = discord.User
self.owners: List[discord.User] = []
for extension in l_extensions: for extension in l_extensions:
try: try:
@ -153,6 +154,10 @@ class TuxBot(commands.AutoShardedBot):
self.owner = await self.fetch_user( self.owner = await self.fetch_user(
int(self.config.get('permissions', 'Owners').split(', ')[0]) int(self.config.get('permissions', 'Owners').split(', ')[0])
) )
for owner in self.config.get('permissions', 'Owners').split(', '):
self.owners.append(
await self.fetch_user(int(owner))
)
@staticmethod @staticmethod
async def on_resumed(): async def on_resumed():

View file

@ -66,7 +66,7 @@ class Admin(commands.Cog):
########################################################################### ###########################################################################
@groupExtra(name='say', invoke_without_command=True, category='admin', @groupExtra(name='say', invoke_without_command=True, category='admin',
description=Texts('commands').get('admin._say')) description=Texts('admin_help').get('_say'))
async def _say(self, ctx: commands.Context, *, content: str): async def _say(self, ctx: commands.Context, *, content: str):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
try: try:
@ -77,7 +77,7 @@ class Admin(commands.Cog):
await ctx.send(content) await ctx.send(content)
@_say.command(name='edit', @_say.command(name='edit',
description=Texts('commands').get('admin._say_edit')) description=Texts('admin_help').get('_say_edit'))
async def _say_edit(self, ctx: commands.Context, message_id: int, *, async def _say_edit(self, ctx: commands.Context, message_id: int, *,
content: str): content: str):
try: try:
@ -95,7 +95,7 @@ class Admin(commands.Cog):
delete_after=5) delete_after=5)
@_say.command(name='to', @_say.command(name='to',
description=Texts('commands').get('admin._say_to')) description=Texts('admin_help').get('_say_to'))
async def _say_to(self, ctx: commands.Context, async def _say_to(self, ctx: commands.Context,
channel: Union[discord.TextChannel, discord.User], *, channel: Union[discord.TextChannel, discord.User], *,
content): content):
@ -109,7 +109,7 @@ class Admin(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='ban', category='admin', @commandExtra(name='ban', category='admin',
description=Texts('commands').get('admin._ban')) description=Texts('admin_help').get('_ban'))
async def _ban(self, ctx: commands.Context, user: discord.Member, *, async def _ban(self, ctx: commands.Context, user: discord.Member, *,
reason=""): reason=""):
try: try:
@ -137,7 +137,7 @@ class Admin(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='kick', category='admin', @commandExtra(name='kick', category='admin',
description=Texts('commands').get('admin._kick')) description=Texts('admin_help').get('_kick'))
async def _kick(self, ctx: commands.Context, user: discord.Member, *, async def _kick(self, ctx: commands.Context, user: discord.Member, *,
reason=""): reason=""):
try: try:
@ -165,7 +165,7 @@ class Admin(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='clear', category='admin', @commandExtra(name='clear', category='admin',
description=Texts('commands').get('admin._clear')) description=Texts('admin_help').get('_clear'))
async def _clear(self, ctx: commands.Context, count: int): async def _clear(self, ctx: commands.Context, count: int):
try: try:
await ctx.message.delete() await ctx.message.delete()
@ -176,13 +176,13 @@ class Admin(commands.Cog):
########################################################################### ###########################################################################
@groupExtra(name='react', category='admin', @groupExtra(name='react', category='admin',
description=Texts('commands').get('admin._react')) description=Texts('admin_help').get('_react'))
async def _react(self, ctx: commands.Context): async def _react(self, ctx: commands.Context):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help('react') await ctx.send_help('react')
@_react.command(name='add', @_react.command(name='add',
description=Texts('commands').get('admin._react_add')) description=Texts('admin_help').get('admin._react_add'))
async def _react_add(self, ctx: commands.Context, message_id: int, *, async def _react_add(self, ctx: commands.Context, message_id: int, *,
emojis: str): emojis: str):
emojis: list = emojis.split(' ') emojis: list = emojis.split(' ')
@ -199,7 +199,7 @@ class Admin(commands.Cog):
delete_after=5) delete_after=5)
@_react.command(name='clear', @_react.command(name='clear',
description=Texts('commands').get('admin._react_remove')) description=Texts('admin_help').get('_react_remove'))
async def _react_remove(self, ctx: commands.Context, message_id: int): async def _react_remove(self, ctx: commands.Context, message_id: int):
try: try:
message: discord.Message = await ctx.channel.fetch_message( message: discord.Message = await ctx.channel.fetch_message(
@ -214,7 +214,7 @@ class Admin(commands.Cog):
@groupExtra(name='delete', invoke_without_command=True, @groupExtra(name='delete', invoke_without_command=True,
category='admin', category='admin',
description=Texts('commands').get('admin._delete')) description=Texts('admin_help').get('_delete'))
async def _delete(self, ctx: commands.Context, message_id: int): async def _delete(self, ctx: commands.Context, message_id: int):
try: try:
await ctx.message.delete() await ctx.message.delete()
@ -231,7 +231,7 @@ class Admin(commands.Cog):
delete_after=5) delete_after=5)
@_delete.command(name='from', aliases=['to', 'in'], @_delete.command(name='from', aliases=['to', 'in'],
description=Texts('commands').get('admin._delete_from')) description=Texts('admin_help').get('_delete_from'))
async def _delete_from(self, ctx: commands.Context, async def _delete_from(self, ctx: commands.Context,
channel: discord.TextChannel, message_id: int): channel: discord.TextChannel, message_id: int):
try: try:
@ -294,7 +294,7 @@ class Admin(commands.Cog):
self.bot.database.session.commit() self.bot.database.session.commit()
@groupExtra(name='warn', aliases=['warns'], category='admin', @groupExtra(name='warn', aliases=['warns'], category='admin',
description=Texts('commands').get('admin._warn')) description=Texts('admin_help').get('_warn'))
async def _warn(self, ctx: commands.Context): async def _warn(self, ctx: commands.Context):
await ctx.trigger_typing() await ctx.trigger_typing()
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
@ -307,7 +307,7 @@ class Admin(commands.Cog):
await ctx.send(embed=e) await ctx.send(embed=e)
@_warn.command(name='add', aliases=['new'], @_warn.command(name='add', aliases=['new'],
description=Texts('commands').get('admin._warn_new')) description=Texts('admin_help').get('_warn_new'))
async def _warn_new(self, ctx: commands.Context, member: discord.Member, async def _warn_new(self, ctx: commands.Context, member: discord.Member,
*, reason="N/A"): *, reason="N/A"):
member = await ctx.guild.fetch_member(member.id) member = await ctx.guild.fetch_member(member.id)
@ -386,8 +386,8 @@ class Admin(commands.Cog):
f"\n**{Texts('admin', ctx).get('Reason')}:** `{reason}`" f"\n**{Texts('admin', ctx).get('Reason')}:** `{reason}`"
) )
@_warn.command(name='remove', aliases=['revoke'], @_warn.command(name='remove', aliases=['revoke', 'del', 'delete'],
description=Texts('commands').get('admin._warn_remove')) description=Texts('admin_help').get('_warn_remove'))
async def _warn_remove(self, ctx: commands.Context, warn_id: int): async def _warn_remove(self, ctx: commands.Context, warn_id: int):
warn = self.bot.database.session \ warn = self.bot.database.session \
.query(WarnModel) \ .query(WarnModel) \
@ -399,8 +399,8 @@ class Admin(commands.Cog):
await ctx.send(f"{Texts('admin', ctx).get('Warn with id')} `{warn_id}`" await ctx.send(f"{Texts('admin', ctx).get('Warn with id')} `{warn_id}`"
f" {Texts('admin', ctx).get('successfully removed')}") f" {Texts('admin', ctx).get('successfully removed')}")
@_warn.command(name='show', aliases=['list'], @_warn.command(name='show', aliases=['list', 'all'],
description=Texts('commands').get('admin._warn_show')) description=Texts('admin_help').get('_warn_show'))
async def _warn_show(self, ctx: commands.Context, member: discord.Member): async def _warn_show(self, ctx: commands.Context, member: discord.Member):
warns_list, warns = await self.get_warn(ctx, member) warns_list, warns = await self.get_warn(ctx, member)
@ -411,8 +411,8 @@ class Admin(commands.Cog):
await ctx.send(embed=e) await ctx.send(embed=e)
@_warn.command(name='edit', aliases=['change'], @_warn.command(name='edit', aliases=['change', 'modify'],
description=Texts('commands').get('admin._warn_edit')) description=Texts('admin_help').get('_warn_edit'))
async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, reason): async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, reason):
warn = self.bot.database.session \ warn = self.bot.database.session \
.query(WarnModel) \ .query(WarnModel) \
@ -429,7 +429,7 @@ class Admin(commands.Cog):
@commandExtra(name='language', aliases=['lang', 'langue', 'langage'], @commandExtra(name='language', aliases=['lang', 'langue', 'langage'],
category='admin', category='admin',
description=Texts('commands').get('admin._language')) description=Texts('admin_help').get('_language'))
async def _language(self, ctx: commands.Context, locale: str): async def _language(self, ctx: commands.Context, locale: str):
available = self.bot.database.session \ available = self.bot.database.session \
.query(LangModel.value) \ .query(LangModel.value) \
@ -460,13 +460,13 @@ class Admin(commands.Cog):
########################################################################### ###########################################################################
@groupExtra(name='prefix', aliases=['prefixes'], category='admin', @groupExtra(name='prefix', aliases=['prefixes'], category='admin',
description=Texts('commands').get('admin._prefix')) description=Texts('admin_help').get('_prefix'))
async def _prefix(self, ctx: commands.Context): async def _prefix(self, ctx: commands.Context):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help('prefix') await ctx.send_help('prefix')
@_prefix.command(name='add', aliases=['set', 'new'], @_prefix.command(name='add', aliases=['set', 'new'],
description=Texts('commands').get('admin._prefix_add')) description=Texts('admin_help').get('_prefix_add'))
async def _prefix_add(self, ctx: commands.Context, prefix: str): async def _prefix_add(self, ctx: commands.Context, prefix: str):
if str(ctx.guild.id) in self.bot.prefixes: if str(ctx.guild.id) in self.bot.prefixes:
prefixes = self.bot.prefixes.get( prefixes = self.bot.prefixes.get(
@ -500,7 +500,7 @@ class Admin(commands.Cog):
) )
@_prefix.command(name='remove', aliases=['drop', 'del', 'delete'], @_prefix.command(name='remove', aliases=['drop', 'del', 'delete'],
description=Texts('commands').get('admin._prefix_remove')) description=Texts('admin_help').get('_prefix_remove'))
async def _prefix_remove(self, ctx: commands.Context, prefix: str): async def _prefix_remove(self, ctx: commands.Context, prefix: str):
if str(ctx.guild.id) in self.bot.prefixes: if str(ctx.guild.id) in self.bot.prefixes:
prefixes = self.bot.prefixes.get( prefixes = self.bot.prefixes.get(
@ -529,7 +529,7 @@ class Admin(commands.Cog):
) )
@_prefix.command(name='list', aliases=['show', 'all'], @_prefix.command(name='list', aliases=['show', 'all'],
description=Texts('commands').get('admin._prefix_list')) description=Texts('admin_help').get('_prefix_list'))
async def _prefix_list(self, ctx: commands.Context): async def _prefix_list(self, ctx: commands.Context):
extras = ['.'] extras = ['.']
if ctx.message.guild is not None: if ctx.message.guild is not None:

View file

@ -6,8 +6,7 @@ import discord
from discord.ext import commands from discord.ext import commands
from bot import TuxBot from bot import TuxBot
from utils import FieldPages from utils import Texts
from utils import commandsPlus
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -18,197 +17,51 @@ class HelpCommand(commands.HelpCommand):
self.ignore_cogs = ["Monitoring", "Help", "Logs"] self.ignore_cogs = ["Monitoring", "Help", "Logs"]
self.owner_cogs = [] self.owner_cogs = []
def get_command_signature(self, command):
return f"[{command.cog.qualified_name.upper()}] > {command.qualified_name}"
def common_command_formatting(self, emb, command):
emb.title = self.get_command_signature(command)
if command.cog_name != "Jishaku":
emb.set_thumbnail(url=command.cog.big_icon)
try:
emb.description = f"{command.cog.qualified_name.lower()}_help " \
f"{command.parent}_{command.name}_description"
except:
emb.description = f"{command.cog.qualified_name.lower()}_help " \
f"{command.name}_description"
usage = "help.command_help.usage"
try:
if command.parent:
try:
usg = f"{command.cog.qualified_name.lower()}_help " \
f"{command.parent}_{command.name}_usage"
except:
usg = f"{command.cog.qualified_name.lower()}_help " \
f"{command.name}_usage"
else:
usg = f"{command.cog.qualified_name.lower()}_help " \
f"{command.name}_usage"
emb.add_field(name=usage,
value=f"{self.context.prefix}{command.qualified_name} " + usg)
except KeyError:
emb.add_field(name=usage,
value=f"{self.context.prefix}{command.qualified_name}")
aliases = "`" + '`, `'.join(command.aliases) + "`"
if aliases == "``":
aliases = "help " \
"help.command_help.no_aliases"
emb.add_field(name="help "
"help.command_help.aliases",
value=aliases)
return emb
async def command_callback(self, ctx, *, command=None):
await self.prepare_help_command(ctx, command)
if command is None:
mapping = self.get_bot_mapping()
return await self.send_bot_help(mapping)
cog = ctx.bot.get_cog(command.title())
if cog is not None:
return await self.send_cog_help(cog)
maybe_coro = discord.utils.maybe_coroutine
keys = command.split(' ')
cmd = ctx.bot.all_commands.get(keys[0])
if cmd is None:
string = await maybe_coro(self.command_not_found,
self.remove_mentions(keys[0]))
return await self.send_error_message(string)
for key in keys[1:]:
try:
found = cmd.all_commands.get(key)
except AttributeError:
string = await maybe_coro(self.subcommand_not_found, cmd,
self.remove_mentions(key))
return await self.send_error_message(string)
else:
if found is None:
string = await maybe_coro(self.subcommand_not_found,
cmd,
self.remove_mentions(key))
return await self.send_error_message(string)
cmd = found
if isinstance(cmd, commands.Group):
return await self.send_group_help(cmd)
else:
return await self.send_command_help(cmd)
async def send_bot_help(self, mapping): async def send_bot_help(self, mapping):
owner = self.context.bot.owner owners = self.context.bot.owners
emb = discord.Embed(color=discord.colour.Color.blue()) owners_name = [
emb.description = "help " \ f"{owner.name}#{owner.discriminator}"
"help.main_page.description".format(owner) for owner in owners
emb.set_author(icon_url=self.context.author.avatar_url, ]
name=self.context.author)
e = discord.Embed(
color=discord.colour.Color.blue(),
description=Texts(
'help', self.context
).get(
'main_page.description'
).format(
', '.join(owners_name[:-1]) + ' & ' + owners_name[-1]
)
)
e.set_author(
icon_url=self.context.author.avatar_url_as(format='png'),
name=self.context.author
)
cogs = "" cogs = ""
for extension in self.context.bot.cogs.values(): for extension in self.context.bot.cogs.values():
if self.context.author != owner and extension.qualified_name.upper() in self.owner_cogs: if self.context.author not in owners \
and extension.qualified_name in self.owner_cogs:
continue continue
if self.context.author == owner and extension.qualified_name in self.ignore_cogs: if self.context.author in owners \
and extension.qualified_name in self.ignore_cogs:
continue continue
if extension.qualified_name == "Jishaku": if extension.qualified_name == "Jishaku":
continue continue
cogs += f"{extension.icon} **{extension.qualified_name}**\n" cogs += f"{extension.icon} **{extension.qualified_name}**\n"
emb.add_field(name="help " e.add_field(
"help.main_page.field_title.categories", name=Texts(
value=cogs) 'help', self.context
).get(
'main_page.categories'
),
value=cogs
)
await self.context.send(embed=emb) await self.context.send(embed=e)
async def send_command_help(self, command):
if command.cog_name in self.ignore_cogs:
return await self.send_error_message(
self.command_not_found(command.name))
if isinstance(command, commandsPlus):
if command.name == "jishaku":
pass
formatted = self.common_command_formatting(
discord.Embed(color=discord.colour.Color.blue()), command)
await self.context.send(embed=formatted)
async def send_group_help(self, group):
if group.cog_name in self.ignore_cogs:
return await self.send_error_message(
self.command_not_found(group.name))
formatted = self.common_command_formatting(
discord.Embed(color=discord.colour.Color.blue()), group)
sub_cmd_list = ""
for group_command in group.commands:
try:
sub_cmd_list += f"`╚╡` **{group_command.name}** - " \
f"{group.cog.qualified_name.lower()}_help " \
f"{group_command.parent}_{group_command.name}_brief\n"
except Exception:
sub_cmd_list += f"`╚╡` **{group_command.name}** - " \
f"{group.cog.qualified_name.lower()}_help" \
f"{group_command.name}_brief\n"
subcommands = "help.command_help.subcommands"
formatted.add_field(name=subcommands, value=sub_cmd_list,
inline=False)
await self.context.send(embed=formatted)
async def send_cog_help(self, cog):
if (
cog.qualified_name.upper() in self.owner_cogs
and not await self.context.bot.is_owner(self.context.author)
) or cog.qualified_name.upper() in self.ignore_cogs:
return
if cog.qualified_name == "Jishaku":
return
if cog.qualified_name in self.ignore_cogs:
return
pages = {}
for cmd in cog.get_commands():
if not await self.context.bot.is_owner(
self.context.author) and (
cmd.hidden or cmd.category == "Hidden"):
continue
if cmd.category not in pages:
pages[cmd.category] = "```asciidoc\n"
cmd_brief = f"{cog.qualified_name.lower()}_help " \
f"{cmd.name}_brief"
pages[
cmd.category] += f"{cmd.name}{' ' * int(17 - len(cmd.name))}:: {cmd_brief}\n"
if isinstance(cmd, commands.Group):
for group_command in cmd.commands:
try:
cmd_brief = f"{cog.qualified_name.lower()}_help " \
f"{group_command.parent}_{group_command.name}_brief"
except Exception:
cmd_brief = f"{cog.qualified_name.lower()}_help " \
f"{group_command.name}_brief"
pages[
cmd.category] += f"{group_command.name}{' ' * int(15 - len(group_command.name))}:: {cmd_brief}\n"
for e in pages:
pages[e] += "```"
formatted = []
for name, cont in pages.items():
formatted.append((name, cont))
footer_text = "help " \
"help.category_page.footer_info".format(self.context.prefix)
pages = FieldPages(self.context,
embed_color=discord.colour.Color.blue(),
entries=formatted,
title=cog.qualified_name.upper(),
thumbnail=cog.big_icon,
footertext=footer_text,
per_page=1)
await pages.paginate()
def command_not_found(self, string):
return 'No command called "{}" found.'.format(string)
class Help(commands.Cog): class Help(commands.Cog):

View file

@ -241,7 +241,7 @@ class Logs(commands.Cog):
await self.webhook.send(msg) await self.webhook.send(msg)
@commandExtra(name='commandstats', hidden=True, category='logs', @commandExtra(name='commandstats', hidden=True, category='logs',
description=Texts('commands').get('logs._commandstats')) description=Texts('logs_help').get('_commandstats'))
@commands.is_owner() @commands.is_owner()
async def _commandstats(self, ctx, limit=20): async def _commandstats(self, ctx, limit=20):
counter = self.bot.command_stats counter = self.bot.command_stats
@ -257,7 +257,7 @@ class Logs(commands.Cog):
await ctx.send(f'```\n{output}\n```') await ctx.send(f'```\n{output}\n```')
@commandExtra(name='socketstats', hidden=True, category='logs', @commandExtra(name='socketstats', hidden=True, category='logs',
description=Texts('commands').get('logs._socketstats')) description=Texts('logs_help').get('_socketstats'))
@commands.is_owner() @commands.is_owner()
async def _socketstats(self, ctx): async def _socketstats(self, ctx):
delta = datetime.datetime.utcnow() - self.bot.uptime delta = datetime.datetime.utcnow() - self.bot.uptime
@ -268,7 +268,7 @@ class Logs(commands.Cog):
f'{total} socket events observed ({cpm:.2f}/minute):\n{self.bot.socket_stats}') f'{total} socket events observed ({cpm:.2f}/minute):\n{self.bot.socket_stats}')
@commandExtra(name='uptime', category='logs', @commandExtra(name='uptime', category='logs',
description=Texts('commands').get('logs._uptime')) description=Texts('logs_help').get('_uptime'))
async def _uptime(self, ctx): async def _uptime(self, ctx):
"""Tells you how long the bot has been up for.""" """Tells you how long the bot has been up for."""
uptime = humanize.naturaltime( uptime = humanize.naturaltime(

View file

@ -206,13 +206,13 @@ class Polls(commands.Cog):
@groupExtra(name='sondage', aliases=['poll'], @groupExtra(name='sondage', aliases=['poll'],
category='poll', category='poll',
description=Texts('commands').get('poll._poll')) description=Texts('poll_help').get('_poll'))
async def _poll(self, ctx: commands.Context): async def _poll(self, ctx: commands.Context):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help('sondage') await ctx.send_help('sondage')
@_poll.group(name='create', aliases=['new', 'nouveau'], @_poll.group(name='create', aliases=['new', 'nouveau'],
description=Texts('commands').get('poll._poll_create')) description=Texts('poll_help').get('_poll_create'))
async def _poll_create(self, ctx: commands.Context, *, poll: str): async def _poll_create(self, ctx: commands.Context, *, poll: str):
is_anonymous = '--anonyme' in poll is_anonymous = '--anonyme' in poll
poll = poll.replace('--anonyme', '') poll = poll.replace('--anonyme', '')

View file

@ -38,8 +38,8 @@ class Useful(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='iplocalise', category='utility', @commandExtra(name='iplocalise', category='useful',
description=Texts('commands').get('utility._iplocalise')) description=Texts('useful_help').get('_iplocalise'))
async def _iplocalise(self, ctx: commands.Context, addr, ip_type=''): async def _iplocalise(self, ctx: commands.Context, addr, ip_type=''):
addr = re.sub(r'http(s?)://', '', addr) addr = re.sub(r'http(s?)://', '', addr)
addr = addr[:-1] if addr.endswith('/') else addr addr = addr[:-1] if addr.endswith('/') else addr
@ -52,7 +52,7 @@ class Useful(commands.Cog):
ip = socket.getaddrinfo(addr, None, AF_INET6)[1][4][0] ip = socket.getaddrinfo(addr, None, AF_INET6)[1][4][0]
except socket.gaierror: except socket.gaierror:
return await ctx.send( return await ctx.send(
Texts('utility', ctx).get('ipv6 not available')) Texts('useful', ctx).get('ipv6 not available'))
else: else:
ip = socket.gethostbyname(addr) ip = socket.gethostbyname(addr)
@ -62,19 +62,19 @@ class Useful(commands.Cog):
if response.get('status') == 'success': if response.get('status') == 'success':
e = discord.Embed( e = discord.Embed(
title=f"{Texts('utility', ctx).get('Information for')}" title=f"{Texts('useful', ctx).get('Information for')}"
f" ``{addr}`` *`({response.get('query')})`*", f" ``{addr}`` *`({response.get('query')})`*",
color=0x5858d7 color=0x5858d7
) )
e.add_field( e.add_field(
name=Texts('utility', ctx).get('Belongs to :'), name=Texts('useful', ctx).get('Belongs to :'),
value=response.get('org', 'N/A'), value=response.get('org', 'N/A'),
inline=False inline=False
) )
e.add_field( e.add_field(
name=Texts('utility', ctx).get('Is located at :'), name=Texts('useful', ctx).get('Is located at :'),
value=response.get('city', 'N/A'), value=response.get('city', 'N/A'),
inline=True inline=True
) )
@ -93,18 +93,18 @@ class Useful(commands.Cog):
await ctx.send(embed=e) await ctx.send(embed=e)
else: else:
await ctx.send( await ctx.send(
content=f"{Texts('utility', ctx).get('info not available')}" content=f"{Texts('useful', ctx).get('info not available')}"
f"``{response.get('query')}``") f"``{response.get('query')}``")
except Exception: except Exception:
await ctx.send( await ctx.send(
f"{Texts('utility', ctx).get('Cannot connect to host')} {addr}" f"{Texts('useful', ctx).get('Cannot connect to host')} {addr}"
) )
########################################################################### ###########################################################################
@commandExtra(name='getheaders', category='utility', @commandExtra(name='getheaders', category='useful',
description=Texts('commands').get('utility._getheaders')) description=Texts('useful_help').get('_getheaders'))
async def _getheaders(self, ctx: commands.Context, addr: str): async def _getheaders(self, ctx: commands.Context, addr: str):
if (addr.startswith('http') or addr.startswith('ftp')) is not True: if (addr.startswith('http') or addr.startswith('ftp')) is not True:
addr = f"http://{addr}" addr = f"http://{addr}"
@ -114,7 +114,7 @@ class Useful(commands.Cog):
try: try:
async with self.bot.session.get(addr) as s: async with self.bot.session.get(addr) as s:
e = discord.Embed( e = discord.Embed(
title=f"{Texts('utility', ctx).get('Headers of')} {addr}", title=f"{Texts('useful', ctx).get('Headers of')} {addr}",
color=0xd75858 color=0xd75858
) )
e.add_field(name="Status", value=s.status, inline=True) e.add_field(name="Status", value=s.status, inline=True)
@ -129,18 +129,18 @@ class Useful(commands.Cog):
except aiohttp.client_exceptions.ClientError: except aiohttp.client_exceptions.ClientError:
await ctx.send( await ctx.send(
f"{Texts('utility', ctx).get('Cannot connect to host')} {addr}" f"{Texts('useful', ctx).get('Cannot connect to host')} {addr}"
) )
########################################################################### ###########################################################################
@commandExtra(name='git', aliases=['sources', 'source', 'github'], @commandExtra(name='git', aliases=['sources', 'source', 'github'],
category='utility', category='useful',
description=Texts('commands').get('utility._git')) description=Texts('useful_help').get('_git'))
async def _git(self, ctx): async def _git(self, ctx):
e = discord.Embed( e = discord.Embed(
title=Texts('utility', ctx).get('git repo'), title=Texts('useful', ctx).get('git repo'),
description=Texts('utility', ctx).get('git text'), description=Texts('useful', ctx).get('git text'),
colour=0xE9D460 colour=0xE9D460
) )
e.set_author( e.set_author(
@ -151,8 +151,8 @@ class Useful(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='quote', category='utility', @commandExtra(name='quote', category='useful',
description=Texts('commands').get('utility._quote')) description=Texts('useful_help').get('_quote'))
async def _quote(self, ctx, message_id: discord.Message): async def _quote(self, ctx, message_id: discord.Message):
e = discord.Embed( e = discord.Embed(
colour=message_id.author.colour, colour=message_id.author.colour,
@ -174,8 +174,8 @@ class Useful(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='ping', category='basics', @commandExtra(name='ping', category='useful',
description=Texts('commands').get('basics._ping')) description=Texts('useful_help').get('_ping'))
async def _ping(self, ctx: commands.Context): async def _ping(self, ctx: commands.Context):
start = time.perf_counter() start = time.perf_counter()
await ctx.trigger_typing() await ctx.trigger_typing()
@ -183,7 +183,7 @@ class Useful(commands.Cog):
latency = round(self.bot.latency * 1000, 2) latency = round(self.bot.latency * 1000, 2)
typing = round((end - start) * 1000, 2) typing = round((end - start) * 1000, 2)
discordapp = measure_latency(host='google.com', wait=0)[0] discordapp = measure_latency(host='discordapp.com', wait=0)[0]
e = discord.Embed(title='Ping', color=discord.Color.teal()) e = discord.Embed(title='Ping', color=discord.Color.teal())
e.add_field(name='Websocket', value=f'{latency}ms') e.add_field(name='Websocket', value=f'{latency}ms')
@ -195,44 +195,53 @@ class Useful(commands.Cog):
@staticmethod @staticmethod
def fetch_info(): def fetch_info():
total = 0 total_lines = 0
total_python_lines = 0
file_amount = 0 file_amount = 0
python_file_amount = 0
ENV = "env" ENV = "env"
for path, _, files in os.walk("."): for path, _, files in os.walk("."):
for name in files: for name in files:
file_dir = str(pathlib.PurePath(path, name)) file_dir = str(pathlib.PurePath(path, name))
if not name.endswith(".py") or ENV in file_dir: if (
not name.endswith(".py")
and not name.endswith(".po")
and not name.endswith(".json")
) or ENV in file_dir:
continue continue
file_amount += 1 file_amount += 1
python_file_amount += 1 if name.endswith(".py") else 0
with open(file_dir, "r", encoding="utf-8") as file: with open(file_dir, "r", encoding="utf-8") as file:
for line in file: for line in file:
if not line.strip().startswith("#") \ if not line.strip().startswith("#") \
or not line.strip(): or not line.strip():
total += 1 total_lines += 1
total_python_lines += 1 if name.endswith(".py") \
else 0
return total, file_amount return (file_amount, total_lines), (python_file_amount, total_python_lines)
@commandExtra(name='info', aliases=['about'], category='basics', @commandExtra(name='info', aliases=['about'], category='useful',
description=Texts('commands').get('basics._info')) description=Texts('useful_help').get('_info'))
async def _info(self, ctx: commands.Context): async def _info(self, ctx: commands.Context):
proc = psutil.Process() proc = psutil.Process()
lines, files = self.fetch_info() total, python = self.fetch_info()
with proc.oneshot(): with proc.oneshot():
mem = proc.memory_full_info() mem = proc.memory_full_info()
e = discord.Embed( e = discord.Embed(
title=Texts('basics', ctx).get('Information about TuxBot'), title=Texts('useful', ctx).get('Information about TuxBot'),
color=0x89C4F9) color=0x89C4F9)
e.add_field( e.add_field(
name=f"__{Texts('basics', ctx).get('Latest changes')}__", name=f"__{Texts('useful', ctx).get('Latest changes')}__",
value=self._latest_commits(), value=self._latest_commits(),
inline=False) inline=False)
e.add_field( e.add_field(
name=f"__:busts_in_silhouette: " name=f"__:busts_in_silhouette: "
f"{Texts('basics', ctx).get('Development')}__", f"{Texts('useful', ctx).get('Development')}__",
value=f"**Romain#5117:** [git](https://git.gnous.eu/Romain)\n" value=f"**Romain#5117:** [git](https://git.gnous.eu/Romain)\n"
f"**Outout#4039:** [git](https://git.gnous.eu/mael)\n", f"**Outout#4039:** [git](https://git.gnous.eu/mael)\n",
inline=True inline=True
@ -246,45 +255,46 @@ class Useful(commands.Cog):
e.add_field( e.add_field(
name="__:gear: Usage__", name="__:gear: Usage__",
value=f"**{humanize.naturalsize(mem.rss)}** " value=f"**{humanize.naturalsize(mem.rss)}** "
f"{Texts('basics', ctx).get('physical memory')}\n" f"{Texts('useful', ctx).get('physical memory')}\n"
f"**{humanize.naturalsize(mem.vms)}** " f"**{humanize.naturalsize(mem.vms)}** "
f"{Texts('basics', ctx).get('virtual memory')}\n", f"{Texts('useful', ctx).get('virtual memory')}\n",
inline=True inline=True
) )
e.add_field( e.add_field(
name=f"__{Texts('basics', ctx).get('Servers count')}__", name=f"__{Texts('useful', ctx).get('Servers count')}__",
value=str(len(self.bot.guilds)), value=str(len(self.bot.guilds)),
inline=True inline=True
) )
e.add_field( e.add_field(
name=f"__{Texts('basics', ctx).get('Channels count')}__", name=f"__{Texts('useful', ctx).get('Channels count')}__",
value=str(len([_ for _ in self.bot.get_all_channels()])), value=str(len([_ for _ in self.bot.get_all_channels()])),
inline=True inline=True
) )
e.add_field( e.add_field(
name=f"__{Texts('basics', ctx).get('Members count')}__", name=f"__{Texts('useful', ctx).get('Members count')}__",
value=str(len([_ for _ in self.bot.get_all_members()])), value=str(len([_ for _ in self.bot.get_all_members()])),
inline=True inline=True
) )
e.add_field( e.add_field(
name=f"__:file_folder: {Texts('basics', ctx).get('Files')}__", name=f"__:file_folder: {Texts('useful', ctx).get('Files')}__",
value=str(files), value=f"{total[0]} *({python[0]} <:python:596577462335307777>)*",
inline=True inline=True
) )
e.add_field( e.add_field(
name=f"__¶ {Texts('basics', ctx).get('Lines')}__", name=f"__¶ {Texts('useful', ctx).get('Lines')}__",
value=str(lines), value=f"{total[1]} *({python[1]} <:python:596577462335307777>)*",
inline=True inline=True
) )
e.add_field( e.add_field(
name=f"__:link: {Texts('basics', ctx).get('Links')}__", name=f"__:link: {Texts('useful', ctx).get('Links')}__",
value="[tuxbot.gnous.eu](https://tuxbot.gnous.eu/) " value="[tuxbot.gnous.eu](https://tuxbot.gnous.eu/) "
"| [gnous.eu](https://gnous.eu/) " "| [gnous.eu](https://gnous.eu/) "
"| [git](https://git.gnous.eu/gnouseu/tuxbot-bot) " "| [git](https://git.gnous.eu/gnouseu/tuxbot-bot) "
f"| [{Texts('basics', ctx).get('Invite')}](https://discordapp.com/oauth2/authorize?client_id=301062143942590465&scope=bot&permissions=268749888)", "| [status](https://status.gnous.eu/check/154250) "
f"| [{Texts('useful', ctx).get('Invite')}](https://discordapp.com/oauth2/authorize?client_id=301062143942590465&scope=bot&permissions=268749888)",
inline=False inline=False
) )
@ -296,11 +306,11 @@ class Useful(commands.Cog):
########################################################################### ###########################################################################
@commandExtra(name='credits', aliases=['contributors', 'authors'], @commandExtra(name='credits', aliases=['contributors', 'authors'],
category='basics', category='useful',
description=Texts('commands').get('basics._credits')) description=Texts('useful_help').get('_credits'))
async def _credits(self, ctx: commands.Context): async def _credits(self, ctx: commands.Context):
e = discord.Embed( e = discord.Embed(
title=Texts('basics', ctx).get('Contributors'), title=Texts('useful', ctx).get('Contributors'),
color=0x36393f color=0x36393f
) )

View file

@ -20,13 +20,13 @@ class User(commands.Cog):
########################################################################### ###########################################################################
@groupExtra(name='alias', aliases=['aliases'], category='user', @groupExtra(name='alias', aliases=['aliases'], category='user',
description=Texts('commands').get('user._alias')) description=Texts('user_help').get('user._alias'))
async def _alias(self, ctx: commands.Context): async def _alias(self, ctx: commands.Context):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help('alias') await ctx.send_help('alias')
@_alias.command(name='add', aliases=['set', 'new'], @_alias.command(name='add', aliases=['set', 'new'],
description=Texts('commands').get('user._alias_add')) description=Texts('user_help').get('_alias_add'))
async def _alias_add(self, ctx: commands.Context, *, user_alias: str): async def _alias_add(self, ctx: commands.Context, *, user_alias: str):
is_global = False is_global = False
if '--global' in user_alias: if '--global' in user_alias:
@ -54,12 +54,12 @@ class User(commands.Cog):
self.bot.database.session.commit() self.bot.database.session.commit()
@_alias.command(name='remove', aliases=['drop', 'del', 'delete'], @_alias.command(name='remove', aliases=['drop', 'del', 'delete'],
description=Texts('commands').get('user._alias_remove')) description=Texts('user_help').get('_alias_remove'))
async def _alias_remove(self, ctx: commands.Context, prefix: str): async def _alias_remove(self, ctx: commands.Context, prefix: str):
... ...
@_alias.command(name='list', aliases=['show', 'all'], @_alias.command(name='list', aliases=['show', 'all'],
description=Texts('commands').get('user._alias_list')) description=Texts('user_help').get('_alias_list'))
async def _alias_list(self, ctx: commands.Context): async def _alias_list(self, ctx: commands.Context):
... ...

View file

@ -0,0 +1,92 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
msgid '_say'
msgstr ''
msgid '_say_edit'
msgstr ''
msgid '_say_to'
msgstr ''
###########################################################################
msgid '_ban'
msgstr ''
###########################################################################
msgid '_kick'
msgstr ''
###########################################################################
msgid '_clear'
msgstr ''
###########################################################################
msgid '_react'
msgstr ''
msgid '_react_remove'
msgstr ''
###########################################################################
msgid '_delete'
msgstr ''
msgid '_delete_from'
msgstr ''
###########################################################################
msgid '_warn'
msgstr ''
msgid '_warn_new'
msgstr ''
msgid '_warn_remove'
msgstr ''
msgid '_warn_show'
msgstr ''
msgid '_warn_edit'
msgstr ''
###########################################################################
msgid '_language'
msgstr ''
###########################################################################
msgid '_prefix'
msgstr ''
msgid '_prefix_add'
msgstr ''
msgid '_prefix_remove'
msgstr ''
msgid '_prefix_list'
msgstr ''

View file

@ -15,41 +15,8 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
msgid "Information about TuxBot" msgid 'main_page.description'
msgstr "" msgstr "Made by {}\nWhen using commands, <> means a required argument and [] means an optional argument.\n***(These symbols shouldn't be written)***"
msgid "Latest changes" msgid 'main_page.categories'
msgstr "" msgstr 'Categories'
msgid "Development"
msgstr ""
msgid "physical memory"
msgstr ""
msgid "virtual memory"
msgstr ""
msgid "Servers count"
msgstr ""
msgid "Channels count"
msgstr ""
msgid "Members count"
msgstr ""
msgid "Links"
msgstr ""
msgid "Files"
msgstr ""
msgid "Lines"
msgstr ""
msgid "Invite"
msgstr ""
msgid "Contributors"
msgstr ""

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -15,6 +15,45 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
msgid "Information about TuxBot"
msgstr ""
msgid "Latest changes"
msgstr ""
msgid "Development"
msgstr ""
msgid "physical memory"
msgstr ""
msgid "virtual memory"
msgstr ""
msgid "Servers count"
msgstr ""
msgid "Channels count"
msgstr ""
msgid "Members count"
msgstr ""
msgid "Links"
msgstr ""
msgid "Files"
msgstr ""
msgid "Lines"
msgstr ""
msgid "Invite"
msgstr ""
msgid "Contributors"
msgstr ""
msgid "ipv6 not available" msgid "ipv6 not available"
msgstr "Error, this address is not available in IPv6." msgstr "Error, this address is not available in IPv6."

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -0,0 +1,92 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
msgid '_say'
msgstr ''
msgid '_say_edit'
msgstr ''
msgid '_say_to'
msgstr ''
###########################################################################
msgid '_ban'
msgstr ''
###########################################################################
msgid '_kick'
msgstr ''
###########################################################################
msgid '_clear'
msgstr ''
###########################################################################
msgid '_react'
msgstr ''
msgid '_react_remove'
msgstr ''
###########################################################################
msgid '_delete'
msgstr ''
msgid '_delete_from'
msgstr ''
###########################################################################
msgid '_warn'
msgstr ''
msgid '_warn_new'
msgstr ''
msgid '_warn_remove'
msgstr ''
msgid '_warn_show'
msgstr ''
msgid '_warn_edit'
msgstr ''
###########################################################################
msgid '_language'
msgstr ''
###########################################################################
msgid '_prefix'
msgstr ''
msgid '_prefix_add'
msgstr ''
msgid '_prefix_remove'
msgstr ''
msgid '_prefix_list'
msgstr ''

View file

@ -1,55 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
msgid "Information about TuxBot"
msgstr "Informations sur TuxBot"
msgid "Latest changes"
msgstr "Derniers changements"
msgid "Development"
msgstr "Développement"
msgid "physical memory"
msgstr "mémoire physique"
msgid "virtual memory"
msgstr "mémoire virtuelle"
msgid "Servers count"
msgstr "Nombre de serveurs"
msgid "Channels count"
msgstr "Nombre de salons"
msgid "Members count"
msgstr "Nombre de membres"
msgid "Links"
msgstr "Liens"
msgid "Files"
msgstr "Fichiers"
msgid "Lines"
msgstr "Lignes"
msgid "Invite"
msgstr "Invitation"
msgid "Contributors"
msgstr "Contributeurs"

View file

@ -0,0 +1,22 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
msgid 'main_page.description'
msgstr "Créé par {}\nLorsque vous utilisez les commandes, <> correspond à un argument obligatoire et [] à un argument optionnel.\n***(Vous ne devez pas écrire ces symboles)***"
msgid 'main_page.categories'
msgstr 'Catégories'

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -15,6 +15,45 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
msgid "Information about TuxBot"
msgstr "Informations sur TuxBot"
msgid "Latest changes"
msgstr "Derniers changements"
msgid "Development"
msgstr "Développement"
msgid "physical memory"
msgstr "mémoire physique"
msgid "virtual memory"
msgstr "mémoire virtuelle"
msgid "Servers count"
msgstr "Nombre de serveurs"
msgid "Channels count"
msgstr "Nombre de salons"
msgid "Members count"
msgstr "Nombre de membres"
msgid "Links"
msgstr "Liens"
msgid "Files"
msgstr "Fichiers"
msgid "Lines"
msgstr "Lignes"
msgid "Invite"
msgstr "Invitation"
msgid "Contributors"
msgstr "Contributeurs"
msgid "ipv6 not available" msgid "ipv6 not available"
msgstr "Erreur, cette adresse n'est pas disponible en IPv6." msgstr "Erreur, cette adresse n'est pas disponible en IPv6."

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

View file

@ -0,0 +1,17 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2019-09-08 19:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

17
generate_locales.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
BASEDIR=$(pwd)
cd "$BASEDIR/extras/locales/en/LC_MESSAGES"
for i in *.po ; do
[[ -f "$i" ]] || continue
/usr/lib/python3.8/Tools/i18n/msgfmt.py -o "${i%.po}.mo" "${i%.po}"
done
cd "$BASEDIR/extras/locales/fr/LC_MESSAGES"
for i in *.po ; do
[[ -f "$i" ]] || continue
/usr/lib/python3.8/Tools/i18n/msgfmt.py -o "${i%.po}.mo" "${i%.po}"
done

View file

@ -0,0 +1,60 @@
[INFO ] [2020-01-04 18:47:27] discord.client: logging in using static token
[INFO ] [2020-01-04 18:47:28] discord.gateway: Shard ID 0 has sent the IDENTIFY payload.
[INFO ] [2020-01-04 18:47:28] discord.gateway: Shard ID 0 has connected to Gateway: ["gateway-prd-main-1mb3",{"micros":59339,"calls":["discord-sessions-prd-1-26",{"micros":56634,"calls":["start_session",{"micros":36442,"calls":["api-prd-main-wpx2",{"micros":33053,"calls":["get_user",{"micros":2542},"add_authorized_ip",{"micros":1944},"get_guilds",{"micros":2441},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":7,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 2e6c7d848985fce96ccf1d3a03a9878b).
[INFO ] [2020-01-04 18:47:38] discord.state: Processed a chunk for 462 members in guild ID 280805240977227776.
[INFO ] [2020-01-04 18:47:38] discord.state: Processed a chunk for 794 members in guild ID 331981755177238530.
[INFO ] [2020-01-04 18:47:38] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:39] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:39] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:40] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:40] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:41] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:41] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:42] discord.state: Processed a chunk for 1000 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:42] discord.state: Processed a chunk for 810 members in guild ID 296698073177128962.
[INFO ] [2020-01-04 18:47:45] cogs.Logs: 2020-01-04 17:48:03.502000: Romain#5117 in #general (Gnous): rm-dev01.info
[INFO ] [2020-01-04 18:49:07] cogs.Logs: 2020-01-04 17:49:25.331000: loup#8965 in #general (Gnous): rm-dev01.info
[INFO ] [2020-01-04 18:50:52] cogs.Logs: 2020-01-04 17:51:11.819000: Romain#5117 in #bot (Gnous): rm-dev01.jsk reloac cogs.Utility
[INFO ] [2020-01-04 18:50:58] cogs.Logs: 2020-01-04 17:51:16.650000: loup#8965 in #bot (Gnous): rm-dev01.info
[INFO ] [2020-01-04 18:50:58] cogs.Logs: 2020-01-04 17:51:17.057000: Romain#5117 in #bot (Gnous): rm-dev01.jsk reload cogs.Utility
[INFO ] [2020-01-04 18:51:09] cogs.Logs: 2020-01-04 17:51:28.317000: Romain#5117 in #bot (Gnous): rm-dev01.jsk reload cogs.Useful
[INFO ] [2020-01-04 18:51:18] cogs.Logs: 2020-01-04 17:51:36.366000: Romain#5117 in #bot (Gnous): rm-dev01.info
[INFO ] [2020-01-04 18:52:22] cogs.Logs: 2020-01-04 17:52:41.348000: loup#8965 in #bot (Gnous): rm-dev01.jsk
[INFO ] [2020-01-04 18:53:20] cogs.Logs: 2020-01-04 17:53:38.893000: Romain#5117 in #bots-spam (Mounak): rm-dev01.info
[INFO ] [2020-01-04 18:57:52] cogs.Logs: 2020-01-04 17:58:10.611000: Romain#5117 in #bot (Gnous): rm-dev01.jsk
[INFO ] [2020-01-04 18:59:40] cogs.Logs: 2020-01-04 17:59:59.117000: Romain#5117 in #tuxbot-test (Gnous): rm-dev01.jsk py
conf = _bot.config.get("permission", "Owners")
[INFO ] [2020-01-04 18:59:49] cogs.Logs: 2020-01-04 18:00:08.291000: Romain#5117 in #tuxbot-test (Gnous): rm-dev01.jsk py
conf = _bot.config.get("permissions", "Owners")
[INFO ] [2020-01-04 18:59:59] cogs.Logs: 2020-01-04 18:00:17.851000: Romain#5117 in #tuxbot-test (Gnous): rm-dev01.jsk py
conf = _bot.config.get("permissions", "Owners")
await _ctx.send(conf)
[INFO ] [2020-01-04 19:01:46] cogs.Logs: 2020-01-04 18:02:04.343000: Romain#5117 in #tuxbot-test (Gnous): rm-dev01.jsk py
conf = _bot.config.get("permissions", "Owners")
conf = conf.split(', ')
conf.append(str(329989396218773504))
conf = ', '.join(conf)
await _ctx.send(conf)
[INFO ] [2020-01-04 19:02:06] cogs.Logs: 2020-01-04 18:02:25.221000: Romain#5117 in #tuxbot-test (Gnous): rm-dev01.jsk py
conf = _bot.config.get("permissions", "Owners")
conf = conf.split(', ')
conf.append(str(a))
conf = ', '.join(conf)
_bot.config.set("permissions", "Owners", conf)
[INFO ] [2020-01-04 19:02:17] cogs.Logs: 2020-01-04 18:02:36.778000: Romain#5117 in #tuxbot-test (Gnous): rm-dev01.jsk py
conf = _bot.config.get("permissions", "Owners")
conf = conf.split(', ')
conf.append(str(123456789))
conf = ', '.join(conf)
_bot.config.set("permissions", "Owners", conf)
[INFO ] [2020-01-04 19:05:37] discord.client: Cleaning up tasks.
[INFO ] [2020-01-04 19:05:37] discord.client: Cleaning up after 6 tasks.
[INFO ] [2020-01-04 19:05:37] discord.client: All tasks finished cancelling.
[INFO ] [2020-01-04 19:05:37] discord.client: Closing the event loop.

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,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,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,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