Skip to content

Instantly share code, notes, and snippets.

@outout14
Created August 15, 2016 18:05
Show Gist options
  • Save outout14/f07aedfa668c6e116a6347d37683d3fb to your computer and use it in GitHub Desktop.
Save outout14/f07aedfa668c6e116a6347d37683d3fb to your computer and use it in GitHub Desktop.
__author__ = "Maël — outout14"
__licence__ = "Apache License 2.0"
###########################
# CONFIGURATION #
# by Outout14 :) #
###########################
## TOKEN
token = "token"
##PREFIX
prefix = "."
##Jeu joué
game = "Xeodus - Alpha 0.0.1"
##Version information
version = " Alpha 0.0.1 "
__author__ = "Maël — outout14"
__licence__ = "Apache License 2.0"
##################
# IMPORTS #
#################
import discord ##Discord.py library
import asyncio
from config import * ##Configuration file
client = discord.Client()
@client.event
async def on_ready():
print("=-=-=-=-=-=-=")
print("Xeodus" + version)
print("Bot de bienvenue par outout14")
print(" ")
print("Pret ! ")
print("Vous pouvez l'utiliser.")
await client.change_status(game=discord.Game(name=game), idle=False) ## Game set in config.py
print("Jeu joué : " + game)
print(client.user.name)
print(client.user.id)
print("=-=-=-=-=-=-=")
@client.event
async def on_member_join(member):
server = member.server
prv = await client.start_private_message(member)
fmt = 'Bienvenue {0.mention} chez Felicisme!'
await client.send_message(prv, fmt.format(member))
await client.send_message(prv, "Pour commencer, nous te conseillons de lire #ecnox puis de choisir ton grade \n Tu as le choix entre Démon, Ange, Humain ! *(fait attention à ré-écrire correctement le grade choisis !)* \n Pour choisir ton grade, fait .choix nom_du_grade")
@client.event
async def on_message(message):
if message.content.startswith(prefix + "ping"):##AFK
msg = await client.send_message(message.channel, message.author.mention + " pong !")
await client.delete_message(message)
elif message.content.startswith(prefix + "choix") and discord.channel(name = "choix"):
args_ = message.content.split(" ")
role = args_[1]
if role != "Démon" and role != "Ange" and role != "Humain":
prv = await client.start_private_message(message.author)
msg = await client.send_message(prv, message.author.mention + " ❌ Hey ! Le rôle que tu as choisis n'existe pas.")
if role == "trump":
prv = await client.start_private_message(message.author)
msg = await client.send_message(prv, message.author.mention + " :TrumpSmile: How; tu veux voter Donald Trump !")
else:
muterole = discord.utils.find(lambda m: m.name == str(role), message.server.roles)
auteur = message.author.mention
target = message.author
await client.add_roles(target, muterole)
prv = await client.start_private_message(message.author)
msg = await client.send_message(prv, message.author.mention + " 👌🏼 Bienvenue chez les " + str(role) + " !")
client.run(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment