Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import os
- import json
- import random
- import discord, datetime, time
- import asyncio
- from keep_alive import keep_alive
- from discord.ext import commands
- from discord.utils import get
- Cissy = "-"
- token = os.getenv("token")
- client = commands.Bot(command_prefix = Cissy)
- client.remove_command("help")
- @client.event
- async def on_ready():
- print("{0.user} is now online!".format(client))
- print("Discord.py Version " +discord.__version__ + ";")
- await client.change_presence(status=discord.Status.online, game=discord.Game(name="-help to see commands", type=1))
- @client.event
- async def on_command_error(self, ctx, error):
- if isinstance(error, commands.CommandNotFound):
- await client.send("Command {} was not found")
- @client.command(pass_context=True)
- async def setrole(ctx, role: discord.Role, member: discord.Member=None):
- member = member or ctx.message.author
- await client.add_roles(member, role)
- await client.say("Role {0} was added to {1}".format(role, member))
- @client.command(pass_context=True)
- async def delrole(ctx, role: discord.Role, member: discord.Member=None):
- member = member or ctx.message.author
- await client.remove_roles(member, role)
- await client.say("Role {0} was removed from {1}".format(role, member))
- @client.command(pass_context=True)
- async def bug(ctx, title, *, arg):
- channel = client.get_channel("556823586690826273")
- if channel is None:
- print("Channel not found")
- else:
- embed=discord.Embed(title=title, description=arg, color=0xCE181E)
- await client.delete_message(ctx.message)
- await client.send_message(channel, embed=embed)
- embed=discord.Embed(title="**Bug Report**", description="Thanks for submitting the bug", color=0xCE181E)
- await client.say(embed=embed)
- #@client.command(pass_context=True)
- #async def status(ctx, game, type):
- #await client.change_presence(game=discord.Game(name=game, type=type)
- @client.command()
- async def coinflip():
- x = ["Heads", "Tails"]
- yn = random.choice(x)
- msg = await client.say("Flipping your coin...")
- await asyncio.sleep(0.75)
- await client.edit_message(msg, "Your coin landed on `{}`.".format(yn))
- @client.command(pass_context=True)
- async def say(ctx, *args):
- msg = " ".join(args)
- await client.delete_message(ctx.message)
- return await client.say(msg)
- @client.command(pass_context=True)
- async def purge(ctx, amount=100):
- if ctx.message.author.server_permissions.manage_messages:
- channel = ctx.message.channel
- messages = []
- async for message in client.logs_from(channel, limit=int(amount) + 1):
- messages.append(message)
- await client.delete_messages(messages)
- else:
- await client.say("Missing Permission *manage_messages*")
- @client.command(pass_context=True)
- async def mute(ctx, member: discord.Member):
- if ctx.message.author.server_permissions.mute_members:
- role = discord.utils.get(member.server.roles, name="Muted")
- await client.add_roles(member, role)
- embed=discord.Embed(title="Mute", description="**{0}** was muted by **{1}**".format(member, ctx.message.author), color=0xCE181E)
- await client.say(embed=embed)
- await client.delete_message(ctx.message)
- else:
- await client.say("Missing Permission *mute_members*")
- @client.command(pass_context=True)
- async def unmute(ctx, member: discord.Member):
- if ctx.message.author.server_permissions.mute_members:
- role = discord.utils.get(member.server.roles, name="Muted")
- await client.remove_roles(member, role)
- embed=discord.Embed(title="Unmute", description="**{0}** was unmuted by **{1}**".format(member, ctx.message.author), color=0xCE181E)
- await client.say(embed=embed)
- await client.delete_message(ctx.message)
- else:
- await client.say("Missing Permission *mute_members*")
- @client.command(pass_context=True)
- async def announce(ctx, title, *, arg):
- if ctx.message.author.server_permissions.administrator:
- embed=discord.Embed(title=title, description=arg, color=0xCE181E)
- await client.say(embed=embed)
- await client.delete_message(ctx.message)
- else:
- await client.say("Missing Permission *administrator*")
- @client.command(pass_context=True)
- async def kick (ctx, member: discord.User):
- if ctx.message.author.server_permissions.kick_members:
- await client.kick(member)
- embed=discord.Embed(title="Kick", description="**{0}** was kicked by **{1}**".format(member, ctx.message.author), color=0xCE181E)
- await client.say(embed=embed)
- await client.delete_message(ctx.message)
- else:
- print(f"{ctx.message.author} have no permission to use this command")
- await client.say("Missing Permission *kick_members*")
- @client.command(pass_context=True)
- async def ban(ctx, member: discord.User):
- if ctx.message.author.server_permissions.ban_members:
- await client.ban(member)
- embed=discord.Embed(title="Ban", description="**{0}** was banned by **{1}**".format(member, ctx.message.author), color=0xCE181E)
- await client.say(embed=embed)
- await client.delete_message(ctx.message)
- else:
- print("{} have no permission to use this command".format(ctx.message.author))
- await client.say("Missing Permission *ban_members*")
- @client.command(pass_context=True)
- async def ping():
- start = time.perf_counter()
- message = await client.say("Ping...")
- end = time.perf_counter()
- duration = (end - start) * 1000
- await client.edit_message(message, "Pong! :ping_pong: {:.2f}ms".format(duration))
- @client.command(pass_context=True)
- async def help(ctx):
- embed = discord.Embed(
- colour = discord.Colour.red()
- )
- embed.set_author(name="Cissy Commands")
- embed.add_field(name="**Fun**", value="Return list of all Fun commands\nFor more help **Type -helpfun**")
- embed.add_field(name="**Moderation**", value="Return list of all Moderation commands\nFor more help **Type -helpmod**")
- embed.add_field(name="**Roles**", value="Return list of all Role commands\nFor mote help **Type -helprole**")
- await client.say(embed=embed)
- @client.command(pass_context=True)
- async def helpfun(ctx):
- embed = discord.Embed(
- colour = discord.Colour.red()
- )
- embed.set_author(name="Fun Commands")
- embed.add_field(name="**Ping**", value="Return pong and bot ping\n**Type -ping**")
- embed.add_field(name="**Say**", value="Repeat the message you executed\n**Type -say {message}**")
- embed.add_field(name="**Coinflip**", value="Flip a coin\n**Type -coinflip**")
- await client.say(embed=embed)
- @client.command(pass_context=True)
- async def helpmod(ctx):
- embed = discord.Embed(
- colour = discord.Colour.red()
- )
- embed.set_author(name="Moderation Commands")
- embed.add_field(name="**Kick**", value="Kick members\n**Type -kick {member}**")
- embed.add_field(name="**Ban**", value="Ban members\n**Type -ban {member}**")
- embed.add_field(name="**Mute**", value="Mute members\n**Type -mute {member}**")
- embed.add_field(name="**Unmute**", value="Unmute members\n**Type -unmute {member}**")
- embed.add_field(name="**Purge**", value="Delete messages\n**Type -purge {messages}**")
- await client.say(embed=embed)
- if __name__ == "__main__":
- keep_alive()
- client.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement