Added some settings. Edit some others files.

This commit is contained in:
Dannyiy 2018-01-31 13:42:58 +01:00
parent 5b15147c01
commit a379fd9b96
4 changed files with 23 additions and 11 deletions

24
bot.py
View File

@ -50,7 +50,8 @@ try:
except:
print("Le fichier de paramètre est introuvable, veuillez le créer et le configurer.")
prefix = ['.']
credentials = load_credentials()
prefix = credentials.get("prefix", ["."])
bot = commands.Bot(command_prefix=prefix, description=description, pm_help=None, help_attrs=help_attrs)
@bot.event
@ -67,11 +68,14 @@ async def on_command_error(error, ctx):
@bot.event
async def on_ready():
print('---------------------')
print('Logged in as :')
print('Username: ' + bot.user.name)
print('ID: ' + str(bot.user.id))
print('CONNECTÉ :')
print(""" Nom d\'utilisateur : {0.name}#{0.discriminator}
ID : {0.id}""".format(bot.user))
print('Merci d\'utiliser TuxBot')
print('---------------------')
await bot.change_presence(game=discord.Game(name="Manger des pommes ! .help !"), status=discord.Status("dnd"), afk=False)
await bot.change_presence(game=discord.Game(name=credentials.get("game", "Manger des pommes | .help")), status=discord.Status("dnd"), afk=False)
if bot.client_id == None:
bot.client_id = bot.user.id
if not hasattr(bot, 'uptime'):
bot.uptime = datetime.datetime.utcnow()
@ -87,7 +91,7 @@ async def on_message(message):
try:
await bot.process_commands(message)
except Exception as e:
print('Hé merde, : \n {}: {} \n \n'.format(type(e).__name__, e))
print('Erreur rencontré : \n {}: {} \n \n'.format(type(e).__name__, e))
@bot.command(pass_context=True, hidden=True)
@checks.is_owner()
@ -120,10 +124,12 @@ async def on_command_error(self, ctx, error):
if __name__ == '__main__':
try:
credentials = load_credentials()
token = credentials['token']
bot.client_id = credentials['client_id']
token = credentials.get('token')
if token is None:
print("/!\ Le token est manquant dans le fichier params.json...")
bot.client_id = credentials.get('client_id', None)
except:
print("Impossible de démarer tuxbot.")
print("Impossible de démarer TuxBot dû à une erreur inconnue.")
for extension in l_extensions:

View File

@ -0,0 +1,2 @@
-- This file is only for keeping the folder alive in GitHub. --
-- Ce fichier ne sert qu'à garder ce dossier en vie dans GitHub. --

View File

@ -1,5 +1,9 @@
{
"token": "bot token",
"bots_key": "not required",
"client_id": "client id",
"client_id": "client id (Pas obligatoire)",
"game": "Eating apples - .help",
"prefix": [
"."
]
}

View File

@ -4,7 +4,7 @@
[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](http://forthebadge.com)
TuxBot, un bot discord écrit en Python.
Ici ce trouve le code source du bot provenant du serveur Discord [Aide GNU/Linux-Fr"](https://discord.gg/79943dJ "Rejoindre le serveur"), il à été créé spécialement pour ce discord, si vous souhaitez l'utiliser il vous faudra modifier ``settings.json`` et ``cogs/utils/checks.py`` ;)
Ici ce trouve le code source du bot provenant du serveur Discord [Aide GNU/Linux-Fr"](https://discord.gg/79943dJ "Rejoindre le serveur"), il à été créé spécialement pour ce discord, si vous souhaitez l'utiliser il vous faudra modifier ``params.json`` et ``cogs/utils/checks.py`` ;)
### Pré-requis