some minor changes in few things

This commit is contained in:
Romain J 2020-01-15 00:08:53 +01:00
parent d187177908
commit b7ed8ffae7
24 changed files with 156 additions and 211 deletions

2
bot.py
View file

@ -29,7 +29,7 @@ l_extensions: List[str] = [
'cogs.Help',
'cogs.Logs',
# 'cogs.Monitoring',
'cogs.Polls',
'cogs.Poll',
'cogs.Useful',
'cogs.User',
'jishaku',

View file

@ -65,10 +65,7 @@ class Admin(commands.Cog):
###########################################################################
@groupExtra(name='say', invoke_without_command=True, category='text',
description=Texts('admin_help').get('_say'),
help=Texts('admin_help').get('_say__short'),
usage=Texts('admin_help').get('_say__usage'))
@groupExtra(name='say', invoke_without_command=True, category='text')
async def _say(self, ctx: commands.Context, *, content: str):
if ctx.invoked_subcommand is None:
try:
@ -78,10 +75,7 @@ class Admin(commands.Cog):
await ctx.send(content)
@_say.command(name='edit',
description=Texts('admin_help').get('_say_edit'),
help=Texts('admin_help').get('_say_edit__short'),
usage=Texts('admin_help').get('_say_edit__usage'))
@_say.command(name='edit')
async def _say_edit(self, ctx: commands.Context, message_id: int, *,
content: str):
try:
@ -98,10 +92,7 @@ class Admin(commands.Cog):
Texts('utils', ctx).get("Unable to find the message"),
delete_after=5)
@_say.command(name='to',
description=Texts('admin_help').get('_say_to'),
help=Texts('admin_help').get('_say_to__short'),
usage=Texts('admin_help').get('_say_to__usage'))
@_say.command(name='to')
async def _say_to(self, ctx: commands.Context,
channel: Union[discord.TextChannel, discord.User], *,
content):
@ -114,10 +105,7 @@ class Admin(commands.Cog):
###########################################################################
@commandExtra(name='ban', category='administration',
description=Texts('admin_help').get('_ban'),
help=Texts('admin_help').get('_ban__short'),
usage=Texts('admin_help').get('_ban__usage'))
@commandExtra(name='ban', category='administration')
async def _ban(self, ctx: commands.Context, user: discord.Member, *,
reason=""):
try:
@ -144,10 +132,7 @@ class Admin(commands.Cog):
###########################################################################
@commandExtra(name='kick', category='administration',
description=Texts('admin_help').get('_kick'),
help=Texts('admin_help').get('_kick__short'),
usage=Texts('admin_help').get('_kick__usage'))
@commandExtra(name='kick', category='administration')
async def _kick(self, ctx: commands.Context, user: discord.Member, *,
reason=""):
try:
@ -174,10 +159,7 @@ class Admin(commands.Cog):
###########################################################################
@commandExtra(name='clear', category='text',
description=Texts('admin_help').get('_clear'),
help=Texts('admin_help').get('_clear__short'),
usage=Texts('admin_help').get('_clear__usage'))
@commandExtra(name='clear', category='text')
async def _clear(self, ctx: commands.Context, count: int):
try:
await ctx.message.delete()
@ -187,18 +169,12 @@ class Admin(commands.Cog):
###########################################################################
@groupExtra(name='react', category='text',
description=Texts('admin_help').get('_react'),
help=Texts('admin_help').get('_react__short'),
usage=Texts('admin_help').get('_react__usage'))
@groupExtra(name='react', category='text')
async def _react(self, ctx: commands.Context):
if ctx.invoked_subcommand is None:
await ctx.send_help('react')
@_react.command(name='add',
description=Texts('admin_help').get('_react_add'),
help=Texts('admin_help').get('_react_add__short'),
usage=Texts('admin_help').get('_react_add__usage'))
@_react.command(name='add')
async def _react_add(self, ctx: commands.Context, message_id: int, *,
emojis: str):
emojis: list = emojis.split(' ')
@ -214,10 +190,7 @@ class Admin(commands.Cog):
Texts('utils', ctx).get("Unable to find the message"),
delete_after=5)
@_react.command(name='clear',
description=Texts('admin_help').get('_react_remove'),
help=Texts('admin_help').get('_react_remove__short'),
usage=Texts('admin_help').get('_react_remove__usage'))
@_react.command(name='remove', aliases=['clear'])
async def _react_remove(self, ctx: commands.Context, message_id: int):
try:
message: discord.Message = await ctx.channel.fetch_message(
@ -230,11 +203,7 @@ class Admin(commands.Cog):
###########################################################################
@groupExtra(name='delete', invoke_without_command=True,
category='text',
description=Texts('admin_help').get('_delete'),
help=Texts('admin_help').get('_delete__short'),
usage=Texts('admin_help').get('_delete___usage'))
@groupExtra(name='delete', invoke_without_command=True, category='text')
async def _delete(self, ctx: commands.Context, message_id: int):
try:
await ctx.message.delete()
@ -250,10 +219,7 @@ class Admin(commands.Cog):
Texts('utils', ctx).get("Unable to find the message"),
delete_after=5)
@_delete.command(name='from', aliases=['to', 'in'],
description=Texts('admin_help').get('_delete_from'),
help=Texts('admin_help').get('_delete_from__short'),
usage=Texts('admin_help').get('_delete_from__usage'))
@_delete.command(name='from', aliases=['to', 'in'])
async def _delete_from(self, ctx: commands.Context,
channel: discord.TextChannel, message_id: int):
try:
@ -317,10 +283,7 @@ class Admin(commands.Cog):
self.bot.database.session.add(warn)
self.bot.database.session.commit()
@groupExtra(name='warn', aliases=['warns'], category='administration',
description=Texts('admin_help').get('_warn'),
help=Texts('admin_help').get('_warn__short'),
usage=Texts('admin_help').get('_warn__usage'))
@groupExtra(name='warn', aliases=['warns'], category='administration')
async def _warn(self, ctx: commands.Context):
await ctx.trigger_typing()
if ctx.invoked_subcommand is None:
@ -332,11 +295,8 @@ class Admin(commands.Cog):
await ctx.send(embed=e)
@_warn.command(name='add', aliases=['new'],
description=Texts('admin_help').get('_warn_new'),
help=Texts('admin_help').get('_warn_new__short'),
usage=Texts('admin_help').get('_warn_new__usage'))
async def _warn_new(self, ctx: commands.Context, member: discord.Member,
@_warn.command(name='add', aliases=['new'])
async def _warn_add(self, ctx: commands.Context, member: discord.Member,
*, reason="N/A"):
member = await ctx.guild.fetch_member(member.id)
if not member:
@ -414,10 +374,7 @@ class Admin(commands.Cog):
f"\n**{Texts('admin', ctx).get('Reason')}:** `{reason}`"
)
@_warn.command(name='remove', aliases=['revoke', 'del', 'delete'],
description=Texts('admin_help').get('_warn_remove'),
help=Texts('admin_help').get('_warn_remove__short'),
usage=Texts('admin_help').get('_warn_remove__usage'))
@_warn.command(name='remove', aliases=['revoke', 'del', 'delete'])
async def _warn_remove(self, ctx: commands.Context, warn_id: int):
warn = self.bot.database.session \
.query(WarnModel) \
@ -429,10 +386,7 @@ class Admin(commands.Cog):
await ctx.send(f"{Texts('admin', ctx).get('Warn with id')} `{warn_id}`"
f" {Texts('admin', ctx).get('successfully removed')}")
@_warn.command(name='show', aliases=['list', 'all'],
description=Texts('admin_help').get('_warn_show'),
help=Texts('admin_help').get('_warn_show__short'),
usage=Texts('admin_help').get('_warn_show__usage'))
@_warn.command(name='show', aliases=['list', 'all'])
async def _warn_show(self, ctx: commands.Context, member: discord.Member):
warns_list, warns = await self.get_warn(ctx, member)
@ -443,10 +397,7 @@ class Admin(commands.Cog):
await ctx.send(embed=e)
@_warn.command(name='edit', aliases=['change', 'modify'],
description=Texts('admin_help').get('_warn_edit'),
help=Texts('admin_help').get('_warn_edit__short'),
usage=Texts('admin_help').get('_warn_edit__usage'))
@_warn.command(name='edit', aliases=['change', 'modify'])
async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, reason):
warn = self.bot.database.session \
.query(WarnModel) \
@ -461,11 +412,7 @@ class Admin(commands.Cog):
###########################################################################
@commandExtra(name='language', aliases=['lang', 'langue', 'langage'],
category='server',
description=Texts('admin_help').get('_language'),
help=Texts('admin_help').get('_language__short'),
usage=Texts('admin_help').get('_language__usage'))
@commandExtra(name='language', aliases=['lang', 'langue', 'langage'], category='server')
async def _language(self, ctx: commands.Context, locale: str):
available = self.bot.database.session \
.query(LangModel.value) \
@ -496,18 +443,12 @@ class Admin(commands.Cog):
###########################################################################
@groupExtra(name='prefix', aliases=['prefixes'], category='server',
description=Texts('admin_help').get('_prefix'),
help=Texts('admin_help').get('_prefix_short'),
usage=Texts('admin_help').get('_prefix__usage'))
@groupExtra(name='prefix', aliases=['prefixes'], category='server')
async def _prefix(self, ctx: commands.Context):
if ctx.invoked_subcommand is None:
await ctx.send_help('prefix')
@_prefix.command(name='add', aliases=['set', 'new'],
description=Texts('admin_help').get('_prefix_add'),
help=Texts('admin_help').get('_prefix_add__short'),
usage=Texts('admin_help').get('_prefix_add__usage'))
@_prefix.command(name='add', aliases=['set', 'new'])
async def _prefix_add(self, ctx: commands.Context, prefix: str):
if str(ctx.guild.id) in self.bot.prefixes:
prefixes = self.bot.prefixes.get(
@ -540,10 +481,7 @@ class Admin(commands.Cog):
Texts('admin', ctx).get('Prefix added successfully')
)
@_prefix.command(name='remove', aliases=['drop', 'del', 'delete'],
description=Texts('admin_help').get('_prefix_remove'),
help=Texts('admin_help').get('_prefix_remove__short'),
usage=Texts('admin_help').get('_prefix_remove__usage'))
@_prefix.command(name='remove', aliases=['drop', 'del', 'delete'])
async def _prefix_remove(self, ctx: commands.Context, prefix: str):
if str(ctx.guild.id) in self.bot.prefixes:
prefixes = self.bot.prefixes.get(
@ -571,10 +509,7 @@ class Admin(commands.Cog):
Texts('admin', ctx).get('This prefix does not exist')
)
@_prefix.command(name='list', aliases=['show', 'all'],
description=Texts('admin_help').get('_prefix_list'),
help=Texts('admin_help').get('_prefix_list__short'),
usage=Texts('admin_help').get('_prefix_list__usage'))
@_prefix.command(name='list', aliases=['show', 'all'])
async def _prefix_list(self, ctx: commands.Context):
extras = ['.']
if ctx.message.guild is not None:

View file

@ -19,12 +19,21 @@ class HelpCommand(commands.HelpCommand):
self.owner_cogs = []
self.admin_cogs = ["Admin"]
def common_command_formatting(self, e, command):
prefix = self.context.prefix if str(
self.context.bot.user.id) not in self.context.prefix else f"@{self.context.bot.user.name}"
def command_formatting(self, e, command):
prefix = self.context.prefix \
if str(self.context.bot.user.id) not in self.context.prefix \
else f"@{self.context.bot.user.name}"
file = Texts(command.cog.qualified_name.lower() + '_help', self.context)
e.title = self.get_command_signature(command)
e.description = command.description
if command.parent is not None:
description = file.get(f"_{command.parent}_{command.name}")
usage = file.get(f"_{command.parent}_{command.name}__usage")
else:
description = file.get(f"_{command.name}")
usage = file.get(f"_{command.name}__usage")
e.title = self.get_command_signature(command) + usage
e.description = description
e.add_field(
name=Texts(
@ -32,7 +41,7 @@ class HelpCommand(commands.HelpCommand):
).get(
'command_help.params'
),
value=command.usage
value=usage
)
e.add_field(
name=Texts(
@ -40,7 +49,7 @@ class HelpCommand(commands.HelpCommand):
).get(
'command_help.usage'
),
value=f"{prefix}{command.qualified_name} " + command.usage
value=f"{prefix}{command.qualified_name} " + usage
)
aliases = "`" + '`, `'.join(command.aliases) + "`"
@ -63,12 +72,9 @@ class HelpCommand(commands.HelpCommand):
async def send_bot_help(self, mapping):
owners = self.context.bot.owners
owners_name = [
f"{owner.name}#{owner.discriminator}"
for owner in owners
]
prefix = self.context.prefix if str(
self.context.bot.user.id) not in self.context.prefix else f"@{self.context.bot.user.name} "
prefix = self.context.prefix \
if str(self.context.bot.user.id) not in self.context.prefix \
else f"@{self.context.bot.user.name} "
e = discord.Embed(
color=discord.Color.blue(),
@ -76,8 +82,6 @@ class HelpCommand(commands.HelpCommand):
'help', self.context
).get(
'main_page.description'
).format(
', '.join(owners_name[:-1]) + ' & ' + owners_name[-1]
)
)
e.set_author(
@ -116,8 +120,10 @@ class HelpCommand(commands.HelpCommand):
async def send_cog_help(self, cog):
pages = {}
prefix = self.context.prefix if str(
self.context.bot.user.id) not in self.context.prefix else f"@{self.context.bot.user.name}"
prefix = self.context.prefix \
if str(self.context.bot.user.id) not in self.context.prefix \
else f"@{self.context.bot.user.name}"
file = Texts(cog.qualified_name.lower() + '_help', self.context)
if cog.__class__.__name__ in self.owner_cogs \
and self.context.author not in self.context.bot.owners:
@ -133,15 +139,15 @@ class HelpCommand(commands.HelpCommand):
pages[cmd.category] \
+= f"{cmd.name}" \
+ ' ' * int(17 - len(cmd.name)) \
+ f":: {cmd.help}\n"
+ ' ' * int(13 - len(cmd.name)) \
+ f":: {file.get(f'_{cmd.name}__short')}\n"
if isinstance(cmd, GroupPlus):
for group_command in cmd.commands:
pages[cmd.category] \
+= f"└> {group_command.name}" \
+ ' ' * int(15 - len(group_command.name)) \
+ f":: {group_command.help}\n"
+ ' ' * int(10 - len(group_command.name)) \
+ f":: {file.get(f'_{group_command.parent}_{group_command.name}__short')}\n"
for e in pages:
pages[e] += "```"
formatted = []
@ -168,21 +174,23 @@ class HelpCommand(commands.HelpCommand):
return await self.send_error_message(
self.command_not_found(group.name)
)
file = Texts(group.qualified_name.lower() + '_help', self.context)
formatted = self.common_command_formatting(
formatted = self.command_formatting(
discord.Embed(color=discord.Color.blue()),
group
)
sub_cmd_list = ""
sub_command_list = "" # this is braille, please don't touch unless you know what you're doing
for group_command in group.commands:
sub_cmd_list += f"└> **{group_command.name}** - {group_command.description}\n"
sub_command_list += f"└> **{group_command.name}** - {file.get(f'_{group_command.parent}_{group_command.name}')}\n"
subcommands = Texts(
'help', self.context
).get(
'command_help.subcommands'
)
formatted.add_field(name=subcommands, value=sub_cmd_list, inline=False)
formatted.add_field(name=subcommands, value=sub_command_list, inline=False)
await self.context.send(embed=formatted)
async def send_command_help(self, command):
@ -193,7 +201,7 @@ class HelpCommand(commands.HelpCommand):
return await self.send_error_message(
self.command_not_found(command.name))
formatted = self.common_command_formatting(
formatted = self.command_formatting(
discord.Embed(color=discord.Color.blue()),
command
)

View file

@ -243,9 +243,7 @@ class Logs(commands.Cog):
msg = f'{emoji} `[{dt:%Y-%m-%d %H:%M:%S}] {record.message}`'
await self.webhook.send(msg)
@commandExtra(name='commandstats', hidden=True, category='misc',
description=Texts('logs_help').get('_commandstats'),
help=Texts('logs_help').get('_commandstats__short'))
@commandExtra(name='commandstats', hidden=True, category='misc')
@commands.is_owner()
async def _commandstats(self, ctx, limit=20):
counter = self.bot.command_stats
@ -260,9 +258,7 @@ class Logs(commands.Cog):
await ctx.send(f'```\n{output}\n```')
@commandExtra(name='socketstats', hidden=True, category='misc',
description=Texts('logs_help').get('_socketstats'),
help=Texts('logs_help').get('_socketstats__short'))
@commandExtra(name='socketstats', hidden=True, category='misc')
@commands.is_owner()
async def _socketstats(self, ctx):
delta = datetime.datetime.utcnow() - self.bot.uptime
@ -272,9 +268,7 @@ class Logs(commands.Cog):
await ctx.send(
f'{total} socket events observed ({cpm:.2f}/minute):\n{self.bot.socket_stats}')
@commandExtra(name='uptime', category='misc',
description=Texts('logs_help').get('_uptime'),
help=Texts('logs_help').get('_uptime__short'))
@commandExtra(name='uptime', category='misc')
async def _uptime(self, ctx):
uptime = humanize.naturaltime(
datetime.datetime.utcnow() - self.bot.uptime)

View file

@ -15,7 +15,7 @@ from utils import groupExtra
log = logging.getLogger(__name__)
class Polls(commands.Cog):
class Poll(commands.Cog):
def __init__(self, bot: TuxBot):
self.bot = bot
@ -205,17 +205,12 @@ class Polls(commands.Cog):
poll.content = json.dumps(content)
self.bot.database.session.commit()
@groupExtra(name='poll', aliases=['sondage'],
category='poll',
description=Texts('poll_help').get('_poll'),
help=Texts('poll_help').get('_poll__short'))
@groupExtra(name='poll', aliases=['sondage'], category='poll')
async def _poll(self, ctx: commands.Context):
if ctx.invoked_subcommand is None:
await ctx.send_help('sondage')
await ctx.send_help('poll')
@_poll.group(name='create', aliases=['new', 'nouveau'],
description=Texts('poll_help').get('_poll_create'),
help=Texts('poll_help').get('_poll_create__short'))
@_poll.group(name='create', aliases=['new', 'nouveau'])
async def _poll_create(self, ctx: commands.Context, *, poll: str):
is_anonymous = '--anonyme' in poll
poll = poll.replace('--anonyme', '')
@ -224,4 +219,4 @@ class Polls(commands.Cog):
def setup(bot: TuxBot):
bot.add_cog(Polls(bot))
bot.add_cog(Poll(bot))

View file

@ -81,9 +81,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='iplocalise', category='network',
description=Texts('useful_help').get('_iplocalise'),
help=Texts('useful_help').get('_iplocalise__short'))
@commandExtra(name='iplocalise', category='network')
async def _iplocalise(self, ctx: commands.Context, addr, ip_type=''):
addr = re.sub(r'http(s?)://', '', addr)
addr = addr[:-1] if addr.endswith('/') else addr
@ -147,9 +145,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='getheaders', category='network',
description=Texts('useful_help').get('_getheaders'),
help=Texts('useful_help').get('_getheaders__short'))
@commandExtra(name='getheaders', category='network')
async def _getheaders(self, ctx: commands.Context, addr: str):
if (addr.startswith('http') or addr.startswith('ftp')) is not True:
addr = f"http://{addr}"
@ -179,10 +175,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='git', aliases=['sources', 'source', 'github'],
category='misc',
description=Texts('useful_help').get('_git'),
help=Texts('useful_help').get('_git__short'))
@commandExtra(name='git', aliases=['sources', 'source', 'github'], category='misc')
async def _git(self, ctx):
e = discord.Embed(
title=Texts('useful', ctx).get('git repo'),
@ -197,9 +190,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='quote', category='misc',
description=Texts('useful_help').get('_quote'),
help=Texts('useful_help').get('_quote__short'))
@commandExtra(name='quote', category='misc')
async def _quote(self, ctx, message_id: discord.Message):
e = discord.Embed(
colour=message_id.author.colour,
@ -221,9 +212,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='ping', category='network',
description=Texts('useful_help').get('_ping'),
help=Texts('useful_help').get('_ping__short'))
@commandExtra(name='ping', category='network')
async def _ping(self, ctx: commands.Context):
start = time.perf_counter()
await ctx.trigger_typing()
@ -241,9 +230,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='info', aliases=['about'], category='misc',
description=Texts('useful_help').get('_info'),
help=Texts('useful_help').get('_info__short'))
@commandExtra(name='info', aliases=['about'], category='misc')
async def _info(self, ctx: commands.Context):
proc = psutil.Process()
total, python = self.fetch_info()
@ -326,10 +313,7 @@ class Useful(commands.Cog):
###########################################################################
@commandExtra(name='credits', aliases=['contributors', 'authors'],
category='misc',
description=Texts('useful_help').get('_credits'),
help=Texts('useful_help').get('_credits__short'))
@commandExtra(name='credits', aliases=['contributors', 'authors'], category='misc')
async def _credits(self, ctx: commands.Context):
e = discord.Embed(
title=Texts('useful', ctx).get('Contributors'),
@ -353,18 +337,12 @@ class Useful(commands.Cog):
await ctx.send(embed=e)
###########################################################################
@groupExtra(name='cb', aliases=['cc'],
category='misc',
description=Texts('useful_help').get('_cb'),
help=Texts('useful_help').get('_cb__short'))
@groupExtra(name='cb', aliases=['cc'], category='misc')
async def _cb(self, ctx: commands.Context):
if ctx.invoked_subcommand is None:
await ctx.send_help('cb')
@_cb.command(name='validate', aliases=['valid', 'correct'],
category='misc',
description=Texts('useful_help').get('_cb_validate'),
help=Texts('useful_help').get('_cb_validate__short'))
@_cb.command(name='validate', aliases=['valid', 'correct'], category='misc')
async def _cb_validate(self, ctx: commands.Context, *, number: int):
valid = self.luhn_checker(number)
@ -378,10 +356,7 @@ class Useful(commands.Cog):
)
)
@_cb.command(name='generate', aliases=['new', 'get'],
category='misc',
description=Texts('useful_help').get('_cb_generate'),
help=Texts('useful_help').get('_cb_generate__short'))
@_cb.command(name='generate', aliases=['new', 'get'], category='misc')
async def _cb_generate(self, ctx: commands.Context):
number = random.randint(4000_0000_0000_0000, 5999_9999_9999_9999)
while not self.luhn_checker(number):

View file

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

28
database.py Normal file
View file

@ -0,0 +1,28 @@
from utils import Config
from utils.models import Base
from utils import Database
from utils.models.lang import LangModel
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--migrate", action="store_true")
parser.add_argument("-s", "--seed", action="store_true")
args = parser.parse_args()
database = Database(Config("./configs/config.cfg"))
if args.migrate:
print("Migrate...")
Base.metadata.create_all(database.engine)
print("Done!")
if args.seed:
print('Seeding...')
default = LangModel(key="default", value="fr")
available = LangModel(key="available", value="fr,en")
database.session.add(default)
database.session.add(available)
database.session.commit()
print("Done!")

View file

@ -1,6 +0,0 @@
from utils import Config
from utils import Database
database = Database(Config("./configs/config.cfg"))
Base.metadata.create_all(database.engine)

View file

@ -5,8 +5,6 @@ class commandsPlus(commands.Command):
def __init__(self, func, **kwargs):
super().__init__(func, **kwargs)
self.category = kwargs.get("category", 'other')
self.help = kwargs.get("help", 'No Help Provided')
self.usage = kwargs.get("usage", 'No Usage Provided')
def commandExtra(*args, **kwargs):
@ -17,9 +15,6 @@ class GroupPlus(commands.Group):
def __init__(self, func, **kwargs):
super().__init__(func, **kwargs)
self.category = kwargs.get("category", 'other')
self.help = kwargs.get("help", 'No Help Provided')
self.usage = kwargs.get("usage", 'No Usage Provided')
def groupExtra(*args, **kwargs):
return commands.group(*args, **kwargs, cls=GroupPlus)

View file

@ -16,7 +16,7 @@ msgstr ""
msgid 'main_page.description'
msgstr "Made by {}\nWhen using commands, <> means a required argument and [] means an optional argument.\n***(These symbols shouldn't be written)***"
msgstr "When using commands, **<>** means a **required argument** and **[]** means an **optional** argument.\n***(Don't type these symbols!)***"
msgid 'main_page.commands'
msgstr 'Commands'

View file

@ -19,7 +19,7 @@ msgstr ""
###########################################################################
msgid '_say'
msgstr 'Permet de faire en sorte que le TuxBot envoi votre message'
msgstr 'Permet de faire en sorte que le TuxBot envoie votre message'
msgid '_say__short'
msgstr 'Faire parler TuxBot'
@ -161,13 +161,13 @@ msgstr '[sous-commande]'
###########################################################################
msgid '_warn_new'
msgid '_warn_add'
msgstr "Permet d'ajouter un avertissement à un membre en donnant une raison"
msgid '_warn_new__short'
msgid '_warn_add__short'
msgstr 'Ajouter un avertissement a un membre'
msgid '_warn_new__usage'
msgid '_warn_add__usage'
msgstr '<ID/Pseudo/Mention du membre> <raison>'
###########################################################################
@ -257,7 +257,7 @@ msgid '_prefix_list'
msgstr "Permet d'afficher tous les prefixes définis pour ce serveur"
msgid '_prefix_list__short'
msgstr 'Lister les prefixes pour ce servuer'
msgstr 'Lister les prefixes pour ce serveur'
msgid '_prefix_list__usage'
msgstr ''

View file

@ -16,7 +16,7 @@ msgstr ""
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)***"
msgstr "Lorsque vous utilisez les commandes, **<>** correspond à un argument **obligatoire** et **[]** à un argument **optionnel**.\n***(N'écrivez pas ces symboles!)***"
msgid 'main_page.commands'
msgstr 'Commandes'

View file

@ -16,4 +16,4 @@ msgstr ""
msgid "_uptime__short"
msgstr "Retourne depuis quand le bot est en ligne."
msgstr "Retourne depuis quand TuxBot est en ligne."

View file

@ -15,3 +15,26 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
###########################################################################
########################## POLLS #####################################
###########################################################################
msgid '_poll'
msgstr "Affiche l'aide relative a la commande `sondage`"
msgid '_poll__short'
msgstr "Afficher l'aide pour `sondage`"
msgid '_poll__usage'
msgstr '[sous-commande]'
###########################################################################
msgid '_poll_create'
msgstr "Créez un sondage basé sur les réactions ! *(**BETA!** ajoutez `--anonyme` pour rendre les réponses anonymes)*"
msgid '_poll_create__short'
msgstr 'Créer un sondage'
msgid '_poll_create__usage'
msgstr '<question> | <réponse A> | <réponse B> | [réponse C] | [réponse D] | [...]'

View file

@ -37,7 +37,7 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV="/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
VIRTUAL_ENV="/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/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 "/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
setenv VIRTUAL_ENV "/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/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 "/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv"
set -gx VIRTUAL_ENV "/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/tuxbot-bot/venv"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/bin" $PATH

View file

@ -1,8 +1,10 @@
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
#!/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/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 @@
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
#!/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys

View file

@ -1,8 +1,10 @@
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
#!/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/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 @@
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
#!/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/tuxbot-bot/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys

View file

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

View file

@ -1,8 +1,10 @@
#!/home/romain/gnousEU/rm-dev01/tuxbot-bot/venv/bin/python
#!/home/romain/jetbrains/IDEs/PycharmProjects/gnousEU/discord/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())