Advertisement
EpicShardGamingYT

Role fix

Apr 27th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.18 KB | None | 0 0
  1. import discord
  2. from discord.ext.commands import Bot
  3. from discord.ext import commands
  4. import asyncio
  5. import time
  6. import os
  7. import random
  8.  
  9. Client = discord.Client()
  10. client = commands.Bot(command_prefix = ";")
  11. client.remove_command("help")
  12. @client.event
  13. async def on_ready():
  14.     print("Thankyou For Using Jackaboi Bot!")
  15.     await client.change_presence(game=discord.Game(name=";help | jackaboi-bot.ga"))
  16.  
  17. @client.event
  18. async def on_message(message):
  19.     if message.content.startswith(';hello'):
  20.         msg = 'Hello {0.author.mention} How Are You Today'.format(message)
  21.         await client.send_message(message.channel, msg)
  22.     if message.content.startswith(';bye'):
  23.         msg = 'Goodbye {0.author.mention} Hope To See You Soon :wave:'.format(message)
  24.         await client.send_message(message.channel, msg)
  25.     if message.content.startswith(';help'):
  26.         msg = 'Bot Prefix `;`\nhello\nbye\nsay\n8ball\nmute\nunmute\ninvite\nfeedback\nversion\nrps\nhelp\nMore Coming Soon!'.format(message)
  27.         await client.send_message(message.channel, msg)
  28.     if message.content.startswith(';invite'):
  29.         msg = 'Want To Invte Me To Your Discord Press This Link https://goo.gl/94ZSqo'.format(message)
  30.         await client.send_message(message.channel, msg)
  31.     if message.content.startswith(';feedback'):
  32.         msg = 'To Give Feedback Join The Creators Discord [Outdated Link]'.format(message)
  33.         await client.send_message(message.channel, msg)
  34.  
  35.     if message.content.upper().startswith(";RPS"):
  36.         args = message.content.upper().split(" ")
  37.         k = random.randint(1,3)
  38.         if len(args) == 1:
  39.             await client.send_message(message.channel, "No arguments provided")
  40.         else:
  41.             if args[1].upper() == "SCISSOR":
  42.                 if k == 1:
  43.                     await client.send_message(message.channel, "<@%s> awww you lost :cry:" % (message.author.id))
  44.                 elif k == 2:
  45.                     await client.send_message(message.channel, "<@%s> You win cool! :cool:" % (message.author.id))
  46.                 else:
  47.                     await client.send_message(message.channel, "<@%s> Tie! :P:" % (message.author.id))
  48.             elif args[1].upper() == "ROCK":
  49.                 if k == 1:
  50.                     await client.send_message(message.channel, "<@%s> Tie!" % (message.author.id))
  51.                 elif k == 2:
  52.                     await client.send_message(message.channel, "<@%s> aww you lost :cry:" % (message.author.id))
  53.                 else:
  54.                     await client.send_message(message.channel, "<@%s> you win cool! :cool:" % (message.author.id))
  55.             elif args[1].upper() == "PAPER":
  56.                 if k == 1:
  57.                     await client.send_message(message.channel, "<@%s> You win cool! :cool:" % (message.author.id))
  58.                 elif k == 2:
  59.                     await client.send_message(message.channel, "<@%s> Tie!" % (message.author.id))
  60.                 else:
  61.                     await client.send_message(message.channel, "<@%s> awww you lost :cry:" % (message.author.id))
  62.          
  63.     if message.content.startswith(';version'):
  64.         msg = 'V1.0.3 BETA\nBuild:75'.format(message)
  65.         await client.send_message(message.channel, msg)    
  66.        
  67.        
  68.     await client.process_commands(message)
  69.    
  70.     if message.content.startswith(';say'):
  71.         args = message.content.split(" ")
  72.         #args[0] = +say
  73.         #args[1] = Hey
  74.         #args[2] = There
  75.         #args[1:] = Hey There
  76.         await client.send_message(message.channel, "%s" % (" ".join(args[1:])))
  77.        
  78. @client.command(name='8ball',
  79.                 description="Answers a yes/no question.",
  80.                 brief="Answers from the beyond.",
  81.                 aliases=['eight_ball', 'eightball', '8-ball'],
  82.                 pass_context=True)
  83. async def eight_ball(context):
  84.     possible_responses = [
  85.         'That is a resounding no',
  86.         'It is not looking likely',
  87.         'Too hard to tell',
  88.         'It is quite possible',
  89.         'Definitely',
  90.     ]
  91.     await client.say(random.choice(possible_responses) + ", " + context.message.author.mention)
  92. async def list_servers():
  93.     await client.wait_until_ready()
  94.     while not client.is_closed:
  95.         print("Jackaboi Bot Is Now Online!")
  96.         for server in client.servers:
  97.             print(server.name)
  98.         await asyncio.sleep(600)
  99.  
  100. @client.command(pass_context = True)
  101. async def mute(ctx, member: discord.Member, time: int, *,reason: str):
  102.     em = discord.Embed(title="User muted!", description=None, color=0x20f911)
  103.     em.add_field(name="User:",value=f"{member}")
  104.     em.add_field(name="Time: ", value=f"{time} min")
  105.     em.add_field(name="Reason: ", value=f"{reason}")
  106.     em.set_thumbnail(url=member.avatar_url)
  107.     role = discord.utils.get(member.server.roles, name="Muted")
  108.     if role == None:
  109.         await client.create_role(ctx.message.server, name="Muted")
  110.         role = discord.utils.get(member.server.roles, name="Muted")
  111.     time_min = time * 60
  112.     if ctx.message.author.server_permissions.administrator or ctx.message.author.id == '344967220025098242':
  113.         await client.add_roles(member, role)
  114.         await client.say(" {} Has been muted for {} minutes! :white_check_mark:".format(member.mention, time))
  115.         await asyncio.sleep(time_min)
  116.         await client.remove_roles(member, role)
  117.         await client.say("{} has been unmuted! :smiley:".format(member))    
  118.     else:
  119.         await client.say("You don't have permission to execute this command! :stuck_out_tongue: ")
  120.  
  121. @client.command(pass_context=True)
  122. async def unmute(ctx, member: discord.Member):
  123.     role = discord.utils.get(member.server.roles, name="Muted")
  124.     if ctx.message.author.server_permissions.administrator or ctx.message.author.id == '344967220025098242':
  125.         await client.remove_roles(member, role)
  126.         await client.say("{} has been unmuted! :white_check_mark: ".format(member.mention))
  127.     else:
  128.         await client.say("You don't have permissions to execute these command! :stuck_out_tongue: ")
  129.    
  130.  
  131. #Always all if message.content all of then on async def on_message not on bottom
  132. client.loop.create_task(list_servers())
  133. client.run(os.getenv('TOKEN'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement