Advertisement
EpicShardGamingYT

MMGamer fix

Apr 21st, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.46 KB | None | 0 0
  1. import discord
  2. from discord.ext.commands import Bot
  3. from discord.ext import commands
  4. from discord import game
  5. import random
  6. import asyncio
  7. import time
  8. import os
  9.  
  10. Client = discord.Client() #Initialise Client
  11. client = commands.Bot(command_prefix = "!") #Initialise client bot
  12.  
  13. chat_filter = ["FUCK", "CRAP", "SHIT", "CYKA BLYAT", "HOLY SHIT", "ASSHOLE", "HTTPS://DISCORD.GG/"] #you can alter the chat filter as you please!
  14. bypass_list = ["361436146317918220", "432258796556124160"]
  15.  
  16.  
  17. @client.event
  18. async def on_ready():
  19.     print("Bot is online and connected to Discord")
  20.     await client.change_presence(game=discord.Game(name="mmgamer.eu"))
  21.  
  22. @client.command(pass_context=True)
  23. async def ping(ctx):
  24.     now = datetime.datetime.utcnow()
  25.     delta = now - ctx.message.timestamp
  26.     await client.say('{}ms'.format(delta(microseconds=1)))  
  27. @client.event
  28. async def on_message(message):
  29.     client.process_commands(message)
  30.     if message.content == "cookie":
  31.         await client.send_message(message.channel, ":cookie:")
  32.     if message.content.upper() == "CHOCOLATE CHIP COOKIE":
  33.         await client.send_message(message.channel, ":cookie:")
  34.     if message.content.upper().startswith('!SAY'):
  35.         if message.author.id == "279714095480176642":
  36.             args = message.content.split(" ")
  37.             await client.send_message(message.channel, "%s" % (" ".join(args[1:])))
  38.         else:
  39.             await client.send_message(message.channel, " :x: You do not have permission")
  40.     if message.content.upper().startswith("!AMIOWNER"):
  41.         if "422335818330275840" in [role.id for role in message.author.roles]:
  42.              await client.send_message(message.channel,"Yea your my owner!")
  43.         else:
  44.             await client.send_message(message.channel,":x: You Wish")
  45.     if message.content.upper().startswith("!LEGHELP"):
  46.             await client.send_message(message.channel,"My Commands are: !say; !help; !ping")
  47.     contents = message.content.split(" ") #contents is a list type
  48.     for word in contents:
  49.         if word.upper() in chat_filter:
  50.             if not message.author.id in bypass_list:
  51.                 try:
  52.                     await client.delete_message(message)
  53.                     await client.send_message(message.channel, "**Hey!** You're not allowed to sware or advertise here!")
  54.                 except discord.errors.NotFound:
  55.                     return
  56.     if message.content.upper().startswith('!HELP'):
  57.         emb = (discord.Embed(description="My commands are:\n `!help`- Gets you this list\n `!say`- The bot says what you tell it to say\n `!amiowner` - Checks Bot Ownership status\n `!cat` - Cat Gif\n `!clear` - Clears ALL messages in a channel\n `!invite` - Gets the bots invite link\n `!github` - Gets the bots GitHUB repo\n `!ping` - Time to render the command in ms\n `!8ball` - The magic ball awnsers you\n `!dog` - Dog Gif\n Need more help? Join our support server: https://discord.gg/dENQG9u", colour=0x66009D))
  58.         emb.set_author(name="Help", icon_url='http://mmgamer.eu/assets/images/mmgamer-3507x2480.png')
  59.         emb.set_image(url="http://mmgamer.syte.host/MMgamerBOT.png")
  60.         await client.send_message(message.channel, embed=emb)
  61.     if message.content.upper().startswith('!INVITE'):
  62.         emb = (discord.Embed(description="Wanna invite me cool! Here is the link: https://goo.gl/FLPW5b have fun!", colour=0x66009D))
  63.         emb.set_author(name="Invite", icon_url='https://www.iconsdb.com/icons/preview/purple/link-xxl.png')
  64.         await client.send_message(message.channel, embed=emb)
  65.     if message.content.upper().startswith('!GITHUB'):
  66.         emb = (discord.Embed(description="That GitHUB repo: https://github.com/MM-coder/mmgamerbot", colour=0x66009D))
  67.         emb.set_author(name="Github", icon_url='https://major.io/wp-content/uploads/2014/08/github.png')
  68.         await client.send_message(message.channel, embed=emb)
  69.     if message.content.upper().startswith('!CAT'):
  70.         emb = discord.Embed(colour=0x66009D)
  71.         emb.set_image(url="https://media.giphy.com/media/JIX9t2j0ZTN9S/giphy.gif")
  72.         await client.send_message(message.channel, embed=emb)
  73.     if message.content.upper().startswith('!CLEAR'):
  74.         tmp = await client.send_message(message.channel, 'Clearing Stuff Up...')
  75.         async for msg in client.logs_from(message.channel):
  76.             await client.delete_message(msg)
  77.     if message.content.upper().startswith('!DOG'):
  78.         emb = discord.Embed(colour=0x66009D)
  79.         emb.set_image(url="https://media.giphy.com/media/RQSuZfuylVNAY/giphy.gif")
  80.         await client.send_message(message.channel, embed=emb)
  81.     if message.content.upper().startswith("!PING"):
  82.         t1 = time.perf_counter()
  83.         t2 = time.perf_counter()
  84.         await client.send_message(message.channel, ":ping_pong: | Pong! Yes, I am alive... - Time taken: {}ms".format(round((t2-t1)*1000)))
  85.     if message.content.upper().startswith("!8BALL"):
  86.         msg = await client.send_message(message.channel, ":8ball:")
  87.         await asyncio.sleep(1)
  88.         await client.edit_message(msg, new_content=":8ball: :8ball:")
  89.         await asyncio.sleep(1)
  90.         await client.edit_message(msg, new_content=":8ball: :8ball: :8ball:")
  91.         await asyncio.sleep(1)
  92.         await client.delete_message(msg)
  93.         await client.send_message(message.channel, random.choice(["It is certain :8ball: ", "It is decidedly so :8ball: ", "Without a doubt :8ball:", "Yes definitely :8ball: ", "You may rely on it :8ball: ", "As I see it, yes :8ball: ", "Most likely :8ball: ", "Outlook good :8ball: ", "Yes :8ball: ", "Signs point to yes :8ball: ", "Reply hazy try again :8ball: ", "Ask again later :8ball: ", "Better not tell you now :8ball: ", "Cannot predict now :8ball: ", "Concentrate and ask again :8ball: ", "Don't count on it :8ball: ", "My reply is no :8ball: ", "My sources say no :8ball: ", "Outlook not so good :8ball: ", "Very doubtful :8ball:"]))
  94.  
  95. @client.event
  96. async def on_member_join(member):
  97.   canal = client.get_channel("422083182167588866")
  98.   regras = client.get_channel("422083232855621632")
  99.   msg = "Welcome {}\ read the {}".format(member.mention, regras.mention)
  100.   await client.send_message(canal, msg) #Repalce Canal with member to DM the message
  101.  
  102. @client.event
  103. async def on_member_remove(member):
  104.    canal = client.get_channel("423328604911304708")
  105.    msg = "Bye! {}".format(member.mention)
  106.    await client.send_message(canal, msg) #Repalce Canal with member to DM the message
  107.    
  108.  
  109. client.run(os.getenv('TOKEN')) #For heroku only
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement