Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from discord import utils
- import asyncio
- class BugCommand:
- """A bug reporting command."""
- def __init__(self, bot):
- self.bot = bot
- @commands.command(name="bugreport", pass_context=True, no_pm=True)
- async def BugCommand(self, ctx):
- """idklol"""
- author = ctx.message.author
- serverr = ctx.message.server
- channel = self.bot.get_channel("414890753601437696")
- staffchannel = self.bot.get_channel("267275633233625088")
- aprole = discord.utils.get(serverr.roles, name="Bugs/Help")
- await self.bot.delete_message(ctx.message)
- if aprole in author.roles:
- aapplied = await self.bot.send_message(author, embed=discord.Embed(title="Help", description="You already have a support ticket wait for that to expire first or DM a ONLINE staff member.", color=0xff5357))
- await asyncio.sleep(30)
- await self.bot.delete_message(aapplied)
- else:
- while True:
- avatar = author.avatar_url if author.avatar \
- else author.default_avatar_url
- roles = serverr.roles
- role = discord.utils.get(roles, id="417094521919373323")
- await self.bot.add_roles(author, role)
- em = discord.Embed(title="Bug-ID: {}".format(author.id), color=0xff5357)
- em.set_author(name='Bug report by {}'.format(author.name), icon_url=avatar)
- howmsg = await self.bot.say(embed=discord.Embed(title="How", description="Explain in as much detail as possible what you did to make the bug/exploit happen and what you were doing before.", color=0xff5357))
- while True:
- how = await self.bot.wait_for_message(channel=howmsg.channel, author=author, timeout=600)
- if how == None:
- time = await self.bot.say(embed=discord.Embed(title="Time", description="You ran out of time try again!", color=0xff5357))
- await self.bot.delete_message(howmsg)
- await asyncio.sleep(30)
- await self.bot.delete_message(time)
- break
- else:
- em.add_field(name="How: ", value=how.content, inline=True)
- await self.bot.delete_message(howmsg)
- await self.bot.delete_message(how)
- break
- if how == None:
- break
- reproducemsg = await self.bot.say(embed=discord.Embed(title="Reproduce", description="Can you reproduce said bug/exploit? If so how.", color=0xff5357))
- while True:
- reproduce = await self.bot.wait_for_message(channel=reproducemsg.channel, author=author, timeout=600)
- if reproduce == None:
- time = await self.bot.say(embed=discord.Embed(title="Time", description="You ran out of time try again!", color=0xff5357))
- await self.bot.delete_message(reproducemsg)
- await asyncio.sleep(30)
- await self.bot.delete_message(time)
- break
- else:
- em.add_field(name="Reproducable: ", value=reproduce.content, inline=True)
- await self.bot.delete_message(reproducemsg)
- await self.bot.delete_message(reproduce)
- break
- if reproduce == None:
- break
- modsmsg = await self.bot.say(embed=discord.Embed(title="Mods", description="Which mods are involved in this bug/exploit.", color=0xff5357))
- while True:
- mods = await self.bot.wait_for_message(channel=modsmsg.channel, author=author, timeout=600)
- if mods == None:
- time = await self.bot.say(embed=discord.Embed(title="Time", description="You ran out of time try again!", color=0xff5357))
- await self.bot.delete_message(modsmsg)
- await asyncio.sleep(30)
- await self.bot.delete_message(time)
- break
- else:
- em.add_field(name="Mods involved: ", value=mods.content, inline=True)
- await self.bot.delete_message(modsmsg)
- await self.bot.delete_message(mods)
- break
- if mods == None:
- break
- servermsg = await self.bot.say(embed=discord.Embed(title="Server", description="Which server did you do this bug/exploit on: Project Ozone 2 or Divine Journey.", color=0xff5357))
- while True:
- server = await self.bot.wait_for_message(channel=servermsg.channel, author=author, timeout=600)
- if server == None:
- time = await self.bot.say(embed=discord.Embed(title="Time", description="You ran out of time try again!", color=0xff5357))
- await self.bot.delete_message(servermsg)
- await asyncio.sleep(30)
- await self.bot.delete_message(time)
- break
- else:
- em.add_field(name="Server: ", value=server.content, inline=True)
- await self.bot.delete_message(servermsg)
- await self.bot.delete_message(server)
- break
- if server == None:
- break
- em.set_footer(text="© DerpDays - 2018")
- everyone_perms = discord.PermissionOverwrite(read_messages=False)
- my_perms = discord.PermissionOverwrite(read_messages=True)
- everyone = discord.ChannelPermissions(target=serverr.default_role, overwrite=everyone_perms)
- mine = discord.ChannelPermissions(target=author, overwrite=my_perms)
- staff = discord.ChannelPermissions(target=discord.utils.get(serverr.roles, name="Staff"), overwrite=my_perms)
- bugchannel = await self.bot.create_channel(serverr, 'Bug-{}'.format(author.name), everyone, mine, staff)
- staffmsg = await self.bot.send_message(staffchannel, "@here", embed=discord.Embed(title="Bugs", description="{} is reporting a bug in {}!".format(author.mention, bugchannel.mention), color=0xff5357))
- await self.bot.send_message(bugchannel, embed=discord.Embed(title="Bugs", description="Please wait for a member of staff to help you this channel will be deleted after a hour if no-one answers you run the command again!", color=0xff5357))
- botmsg = await self.bot.send_message(bugchannel, embed=em)
- sentmsg = await self.bot.say(embed=discord.Embed(title="Bugs", description="Bug report sent successfully!"))
- await asyncio.sleep(30)
- await self.bot.delete_message(sentmsg)
- #await asyncio.sleep(30)
- await asyncio.sleep(3570)
- await self.bot.remove_roles(author, role)
- await self.bot.delete_message(staffmsg)
- await self.bot.delete_channel(bugchannel)
- def setup(bot):
- bot.add_cog(BugCommand(bot))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement