示例#1
0
文件: fun.py 项目: notLeM/OpenBot
    async def insult(self, ctx, user: discord.Member = None):
        """CATEG_FUN Insult someone."""
        if user == None:
            user = ctx.message.author
        insults = fileIO("data/read/insults.json", "load")

        if user.id == self.client.user.id:
            user = ctx.message.author
            msg = "How original. No one else had thought of trying to get the bot to insult itself. I applaud your creativity. Yawn. Perhaps this is why you don't have friends. You don't add anything new to any conversation. You are more of a bot than me, predictable answers, and absolutely dull to have an actual conversation with."
            embed = discord.Embed(title="😡 Insult",
                                  description=msg,
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            return await ctx.send(embed=embed)
        else:
            embed = discord.Embed(title="😡 Insult",
                                  description=user.mention + " " +
                                  random.choice(insults),
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            return await ctx.send(embed=embed)
示例#2
0
    async def strikes(self, ctx, user: discord.Member = None):
        """CATEG_MOD List someone's strikes."""
        if user == None:
            user = ctx.message.author
        guild = ctx.message.guild
        guildstr = str(guild.id)
        userstr = str(user.id)

        if not self.db or not self.db[
                guildstr] or guildstr not in self.db or userstr not in self.db[
                    guildstr]:
            embed = discord.Embed(title="{} has no strikes in {}.".format(
                user.name, guild.name),
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())

        elif userstr in self.db[guildstr]:
            embed = discord.Embed(
                title=":warning: Strikes",
                description="{} has {} strike(s) in {}".format(
                    user.mention, len(self.db[guildstr][userstr]), guild.name),
                color=client_role_color(self, ctx))
            for x in self.db[guildstr][userstr]:
                embed.add_field(
                    name=str(x),
                    value="```Reason: {}\nAuthor: {}\nDate: {}```".format(
                        self.db[guildstr][userstr][str(x)]["Reason"],
                        self.db[guildstr][userstr][str(x)]["Author"],
                        self.db[guildstr][userstr][str(x)]["Date"]),
                    inline=False)

        embed.set_thumbnail(url=user.avatar_url)
        await ctx.send(embed=embed)
示例#3
0
 async def _eval(self, ctx, *, command):
     """CATEG_OWN Evaluates some code."""
     if await self.client.is_owner(ctx.message.author) == True:
         try:
             command = command.strip("`")
             res = eval(command)
             if inspect.isawaitable(res):
                 res = await res
                 embed = discord.Embed(title="🤖 Eval",
                                       color=client_role_color(self, ctx),
                                       timestamp=datetime.utcnow())
                 embed.add_field(name="Output:",
                                 value="```py\n{}\n```".format(res),
                                 inline=False)
                 embed.set_footer(icon_url=self.client.user.avatar_url,
                                  text=self.client.user.name)
                 await ctx.send(embed=embed)
             else:
                 embed = discord.Embed(title="🤖 Eval",
                                       color=client_role_color(self, ctx),
                                       timestamp=datetime.utcnow())
                 embed.add_field(name="Output:",
                                 value="```py\n{}\n```".format(res),
                                 inline=False)
                 embed.set_footer(icon_url=self.client.user.avatar_url,
                                  text=self.client.user.name)
                 await ctx.send(embed=embed)
         except:
             embed = discord.Embed(title="🤖 Eval",
                                   color=client_role_color(self, ctx),
                                   timestamp=datetime.utcnow())
             embed.add_field(name="Output:",
                             value="```py\n{}\n```".format(
                                 traceback.format_exc()),
                             inline=False)
             embed.set_footer(icon_url=self.client.user.avatar_url,
                              text=self.client.user.name)
             if ctx.guild != None:
                 msg = discord.Embed(
                     title="🤖 Eval",
                     description="I got an error, please check your DMs.",
                     color=client_role_color(self, ctx),
                     timestamp=datetime.utcnow())
                 msg.set_footer(icon_url=self.client.user.avatar_url,
                                text=self.client.user.name)
                 await ctx.send(embed=msg)
                 await tools.dmauthor(self, ctx, embed)
             else:
                 await ctx.send(embed=embed)
     else:
         embed = discord.Embed(title="🔴 Error",
                               description="Only my owner can do that.",
                               color=0xdd2e44,
                               timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
示例#4
0
    async def prefix(self, ctx, *, prefix):
        """CATEG_ADM Changes the prefix for this server."""
        if await self.client.is_owner(
                ctx.message.author
        ) == True or ctx.message.author.guild_permissions.manage_guild == True:
            predata = "data/write/prefix.json"
            db = fileIO(predata, "load")
            channel = ctx.message.channel
            author = ctx.message.author

            embed = discord.Embed(
                title=":warning: Prefix",
                description=
                "Are you sure you want to change this server's prefix to `{}`?"
                .format(prefix),
                color=0xffcd4c,
                timestamp=datetime.utcnow())
            embed.set_footer(text="Reply with yes to continue.")
            await ctx.send(embed=embed)

            def check(m):
                return m.channel == channel and m.author == author

            msg = await self.client.wait_for('message', check=check)
            if msg.content == "yes" or msg.content == "y":
                db[str(ctx.guild.id)] = prefix
                fileIO(predata, "save", db)

                embed = discord.Embed(
                    title=":interrobang: Prefix",
                    description="Successfully set this server's prefix to `{}`"
                    .format(prefix),
                    color=client_role_color(self, ctx),
                    timestamp=datetime.utcnow())
                embed.set_footer(icon_url=self.client.user.avatar_url,
                                 text=self.client.user.name)
                await ctx.send(embed=embed)
            else:
                embed = discord.Embed(title=":interrobang: Prefix",
                                      description="Cancelling...",
                                      color=client_role_color(self, ctx),
                                      timestamp=datetime.utcnow())
                embed.set_footer(icon_url=self.client.user.avatar_url,
                                 text=self.client.user.name)
                await ctx.send(embed=embed)
        else:
            return
示例#5
0
    async def clear(self, ctx, amnt=10):
        """CATEG_MOD Deletes a set amount of messages"""
        author = ctx.message.author
        if author.guild_permissions.manage_messages == False:
            embed = discord.Embed(
                title="🔴 Error",
                description="You do not have the necessary permissions.",
                color=0xdd2e44,
                timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        await ctx.message.delete()
        messages = []
        async for message in ctx.channel.history(limit=int(amnt)):
            messages.append(message)
        if amnt > 100:
            embed = discord.Embed(
                title="🔴 Error",
                description=
                "You cannot delete more than 100 messages at a time.",
                color=0xdd2e44,
                timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
        elif amnt == 0:
            embed = discord.Embed(title="🔴 Error",
                                  description="The limit cannot be 0.",
                                  color=0xdd2e44,
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
        else:
            try:
                await ctx.channel.delete_messages(messages)
                embed = discord.Embed(
                    title="🗑️ Clear",
                    description="Successfully deleted {} messages.".format(
                        amnt),
                    color=client_role_color(self, ctx),
                    timestamp=datetime.utcnow())
                embed.set_footer(
                    text="This message will be deleted in 5 seconds.")
                await ctx.send(embed=embed, delete_after=5.00)
            except:
                embed = discord.Embed(
                    title="🔴 Error",
                    description=
                    "Something went wrong, please check my permissions.",
                    color=0xdd2e44,
                    timestamp=datetime.utcnow())
                embed.set_footer(icon_url=self.client.user.avatar_url,
                                 text=self.client.user.name)
                await ctx.send(embed=embed)
示例#6
0
文件: fun.py 项目: notLeM/OpenBot
 async def flip(self, ctx):
     """CATEG_FUN Flip a coin."""
     embed = discord.Embed(title="📀 Coinflip",
                           description=random.choice(["Heads!", "Tails!"]),
                           color=client_role_color(self, ctx),
                           timestamp=datetime.utcnow())
     embed.set_footer(icon_url=self.client.user.avatar_url,
                      text=self.client.user.name)
     await ctx.send(embed=embed)
示例#7
0
文件: fun.py 项目: notLeM/OpenBot
 async def roll(self, ctx, number: int = 20):
     """CATEG_FUN Roll some dice."""
     author = ctx.message.author
     if number > 1:
         n = random.randint(1, number)
         embed = discord.Embed(title="🎲 Roll",
                               description="{}".format(n),
                               color=client_role_color(self, ctx),
                               timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
     else:
         embed = discord.Embed(title="🎲 Roll",
                               description="{} Maybe higher than 1?".format(
                                   author.mention),
                               color=client_role_color(self, ctx),
                               timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
示例#8
0
    async def hackban(self, ctx, user_id: int):
        """CATEG_MOD Can ban someone even if they're not in the server."""
        author = ctx.message.author
        guild = author.guild

        reason = "Hackbanned by {}".format(str(author))

        if author.guild_permissions.ban_members == False:
            embed = discord.Embed(
                title="🔴 Error",
                description="You do not have the necessary permissions.",
                color=0xdd2e44,
                timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        ban_list = await guild.bans()
        for entry in ban_list:
            if entry.user.id == user_id:
                embed = discord.Embed(
                    title="🔴 Error",
                    description="That user is already banned.",
                    color=0xdd2e44,
                    timestamp=datetime.utcnow())
                embed.set_footer(icon_url=self.client.user.avatar_url,
                                 text=self.client.user.name)
                await ctx.send(embed=embed)
                return

        user = guild.get_member(user_id)
        if user is not None:
            await ctx.invoke(self.ban, user=user, reason=reason)
            return

        try:
            await self.client.http.ban(user_id, guild.id, 0, reason=reason)
        except discord.NotFound:
            msg = "User not found. Have you provided the correct user ID?"
        except discord.Forbidden:
            msg = "I lack the permissions to do this."

        else:
            msg = "Done. That user will not be able to join this server."

        embed = discord.Embed(title="🔨 Hackban",
                              description=msg,
                              color=client_role_color(self, ctx),
                              timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,
                         text=self.client.user.name)
        await ctx.send(embed=embed)
示例#9
0
    async def ping(self, ctx):
        """CATEG_GEN Sends the bot's latency."""
        channel = ctx.message.channel
        t1 = time.perf_counter()
        await channel.trigger_typing()
        t2 = time.perf_counter()

        embed = discord.Embed(title="🏓 Pong!",
                              description="This took me {}ms.".format(
                                  round((t2 - t1) * 1000)),
                              color=client_role_color(self, ctx),
                              timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,
                         text=self.client.user.name)
        await ctx.send(embed=embed)
示例#10
0
文件: fun.py 项目: notLeM/OpenBot
 async def ask8(self, ctx):
     """CATEG_FUN Ask the almighty 8ball a question."""
     response = (random.choice([
         "It is certain.", "It is decidedly so.", "Without a doubt.",
         "Yes, definitely.", "You may rely on it.", "As I see it, yes.",
         "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.",
         "Don't count on it.", "My reply is no.", "My sources say no.",
         "Outlook not so good.", "Very doubtful."
     ]))
     embed = discord.Embed(title="🎱 8ball",
                           description=response,
                           color=client_role_color(self, ctx),
                           timestamp=datetime.utcnow())
     embed.set_footer(icon_url=self.client.user.avatar_url,
                      text=self.client.user.name)
     await ctx.send(embed=embed)
示例#11
0
 async def guildlist(self, ctx):
     """CATEG_OWN Sends a list of guilds the bot is in alongside their IDs."""
     msg = discord.Embed(
         title="📃 Guild list",
         description="Currently in {} guilds, those are:".format(
             len(self.client.guilds)),
         color=client_role_color(self, ctx))
     for x in self.client.guilds:
         msg.add_field(name=x.name,
                       value="ID: `" + str(x.id) + "`, " +
                       str(len(x.members)) + " Members",
                       inline=False)
     msg.set_footer(icon_url=self.client.user.avatar_url,
                    text=self.client.user.name)
     await tools.dmauthor(self, ctx, embed=msg)
     if ctx.guild != None:
         await ctx.message.delete()
示例#12
0
 async def status(self, ctx, *args):
     """CATEG_OWN Changes the bot's status."""
     game = " ".join(args)
     if str(game) == "":
         return
     await self.client.change_presence(
         status=discord.Status.online,
         activity=discord.Streaming(name=game,
                                    url='https://www.twitch.tv/directory',
                                    twitch_name="directory"))
     embed = discord.Embed(
         title="🎮 Status",
         description='Setting status to "{}".'.format(game),
         color=client_role_color(self, ctx))
     embed.set_footer(icon_url=self.client.user.avatar_url,
                      text=self.client.user.name)
     await ctx.send(embed=embed)
示例#13
0
文件: fun.py 项目: notLeM/OpenBot
    async def rapname(self, ctx, user: discord.Member = None):
        """CATEG_FUN Start off your Soundcloud career with a cool nickname."""
        if user == None:
            user = ctx.message.author

        with open("data/read/rap_first.json") as json.file:
            rap1 = json.load(json.file)
        with open("data/read/rap_last.json") as json.file:
            rap2 = json.load(json.file)

        result = random.choice(rap1) + " " + random.choice(rap2)
        embed = discord.Embed(title="🎤 Rapname",
                              description="{}'s rap name is: **{}**".format(
                                  user.mention, result),
                              color=client_role_color(self, ctx),
                              timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,
                         text=self.client.user.name)
        await ctx.send(embed=embed)
示例#14
0
文件: fun.py 项目: notLeM/OpenBot
    async def hug(self, ctx, user: discord.Member = None):
        """CATEG_FUN Free hugs!"""
        author = ctx.message.author

        choices = fileIO("data/read/links.json", "load")
        image = random.choice(choices["hug"])

        def msg():
            if user == None:
                return None
            if user != None:
                return "{} hugged {}!".format(author, user)

        embed = discord.Embed(title="🤗 Hug",
                              description=msg(),
                              colour=client_role_color(self, ctx))
        embed.set_image(url=image)

        return await ctx.send(embed=embed)
示例#15
0
文件: fun.py 项目: notLeM/OpenBot
 async def choose(self, ctx, *choices: str):
     """CATEG_FUN Chooses between given options at random."""
     if len(choices) < 2:
         embed = discord.Embed(
             title="🔴 Error",
             description='Not enough choices to pick from.',
             color=0xdd2e44,
             timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
     else:
         embed = discord.Embed(title="🔮 Choose",
                               description="I'd pick {}.".format(
                                   random.choice(choices)),
                               color=client_role_color(self, ctx),
                               timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
示例#16
0
文件: fun.py 项目: notLeM/OpenBot
    async def payrespects(self, ctx):
        """CATEG_FUN Send `=f` to pay respects"""
        db = fileIO("data/write/payrespects.json", "load")
        db[str(ctx.message.id)] = datetime.today().strftime('%Y-%m-%d')
        fileIO("data/write/payrespects.json", "save", db)

        dbtoday = []
        for entry in db:
            if db[entry] == datetime.today().strftime('%Y-%m-%d'):
                dbtoday.append(entry)
        TodayLen = len(dbtoday)
        TotalLen = len(db)

        embed = discord.Embed(
            title="{} has paid their respects".format(ctx.message.author.name),
            description="{} Today, {} Total".format(TodayLen, TotalLen),
            color=client_role_color(self, ctx),
            timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,
                         text=self.client.user.name)
        await ctx.send(embed=embed)
示例#17
0
 async def leaveguild(self, ctx, id: int = 0000000):
     """CATEG_OWN Leaves a guild with the provided ID."""
     if id == 0000000:
         embed = discord.Embed(
             title="🔴 Error",
             description="You need to provide a valid guild ID.",
             color=0xdd2e44,
             timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
         return
     guild = discord.utils.get(self.client.guilds, id=id)
     if guild == None:
         embed = discord.Embed(
             title="🔴 Error",
             description="You need to provide a valid guild ID.",
             color=0xdd2e44,
             timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
         return
     try:
         await guild.leave()
     except:
         embed = discord.Embed(title="🔴 Error",
                               description="I'm not in that guild.",
                               color=0xdd2e44,
                               timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         return await ctx.send(embed=embed)
     embed = discord.Embed(title="👋 Leave Guild",
                           description="Successfully left the guild.",
                           color=client_role_color(self, ctx),
                           timestamp=datetime.utcnow())
     embed.set_footer(icon_url=self.client.user.avatar_url,
                      text=self.client.user.name)
     await ctx.send(embed=embed)
示例#18
0
文件: fun.py 项目: notLeM/OpenBot
    async def gay(self, ctx, user: discord.Member = None):
        """CATEG_FUN Measures how gay you are."""
        if not user:
            user = ctx.message.author

        value = int(100)
        n = random.randint(1, value)

        #    Check if user is bot
        if user.id == self.client.user.id:
            n = int(100)
        #    Check if user is owner
        elif user.id == 254204775497859073:
            n = int(0)

        embed = discord.Embed(title="🏳️‍🌈 Gay",
                              description="{} is **{}% gay.**".format(user, n),
                              color=client_role_color(self, ctx),
                              timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,
                         text=self.client.user.name)
        await ctx.send(embed=embed)
示例#19
0
 async def invite(self, ctx):
     """CATEG_GEN Sends the bot's invite link."""
     url = discord.utils.oauth_url(
         client_id=self.client.user.id,
         permissions=discord.Permissions(permissions=1609952503))
     embed = discord.Embed(
         title="📨 Invite Link",
         description="You can invite me using [this link]({})".format(url),
         color=0x7289da,
         timestamp=datetime.utcnow())
     embed.set_footer(icon_url=self.client.user.avatar_url,
                      text=self.client.user.name)
     await tools.dmauthor(self, ctx, embed)
     if ctx.guild != None:
         embed = discord.Embed(
             title="📨 Invite",
             description="Check your DMs! :page_facing_up:",
             color=client_role_color(self, ctx),
             timestamp=datetime.utcnow())
         embed.set_footer(icon_url=self.client.user.avatar_url,
                          text=self.client.user.name)
         await ctx.send(embed=embed)
示例#20
0
    async def embed(self, ctx, *args):
        """CATEG_MOD Sends your message in an embed."""
        author = ctx.message.author

        if author.guild_permissions.manage_messages == False:
            embed = discord.Embed(
                title="🔴 Error",
                description="You do not have the necessary permissions.",
                color=0xdd2e44,
                timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        mesg = ' '.join(args)
        user = ctx.message.author
        name = user.name
        embed = discord.Embed(title="{} says:".format(name),
                              description=mesg,
                              colour=client_role_color(self, ctx),
                              timestamp=datetime.utcnow())
        embed.set_thumbnail(url=user.avatar_url)
        await ctx.send(embed=embed)
示例#21
0
文件: merit.py 项目: notLeM/OpenBot
    async def merit(self, ctx, user: discord.Member = None, *args):
        """CATEG_MOD Append a note to a server member, which may be viewed by anyone at any time. Good for noting down good behaviors."""
        if ctx.message.author.guild_permissions.manage_messages == False:
            embed=discord.Embed(title="🔴 Error", description="You do not have the necessary permissions.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        channel = ctx.message.channel
        author = ctx.message.author
        guild = ctx.message.guild

        if user == None:
            embed=discord.Embed(title="🔴 Error", description="Provide a user for this to work.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return
        if user == author:
            embed=discord.Embed(title="🔴 Error", description="You can't merit yourself! :eyes:", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return
        if user == self.client.user:
            embed=discord.Embed(title="🔴 Error", description="I can't merit myself! :eyes:", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        reason = " ".join(args)
        if reason == "":
            reason = "No reason provided."

        dm = user.dm_channel

        maxID = 999999999999999999
        minID = 100000000000000000
        meritID = random.randint(minID, maxID)
        time = datetime.now()
        fmt = "%d %b %Y %H:%M"
        timestamp = time.strftime(fmt)

        guildstr = str(guild.id)
        userstr = str(user.id)
        meritstr = str(meritID)

        merit_data = {"Reason" : reason,
                       "Date" : timestamp,
                       "Author" : str(author)}

        embed=discord.Embed(title=":warning: {}".format(self.client.user.name), description="Are you sure you want to merit {}?".format(user.mention), color=0xffcd4c, timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,text="Reply with yes to continue.")
        await ctx.send(embed=embed)

        def check(m):
            return m.channel == channel and m.author == author

        msg = await self.client.wait_for('message', check=check)
        if msg.content == "yes" or msg.content == "y":

            if guildstr in self.db:
                for x in self.db[guildstr]:
                    while meritstr in self.db[guildstr][x]:
                        meritID = random.randint(minID, maxID)
                        meritstr = str(meritID)
                if userstr not in self.db[guildstr]:
                    self.db[guildstr][userstr] = {}
            if guildstr not in self.db:
                self.db[guildstr] = {}
                self.db[guildstr][userstr] = {}

            self.db[guildstr][userstr][meritstr] = merit_data

            fileIO(self.path, "save", self.db)
            await tools.log_merit(self, ctx, user, merit_data, meritID)
            embed = discord.Embed(title="🌟 Merit", description="{} has recieved a merit.".format(user.mention), color=client_role_color(self, ctx), timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)

            try:
                replyembed = discord.Embed(title="🌟 {}".format(self.client.user.name), description="You recieved a merit in {} for the following:\n```{}```".format(guild.name, reason), color=0xffcd4c, timestamp=datetime.utcnow())
                replyembed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
                replyembed.set_thumbnail(url=guild.icon_url)
                if dm == None:
                    await user.create_dm()
                    dm = user.dm_channel
                await dm.send(embed=replyembed)
            except discord.errors.Forbidden:
                pass
        else:
            embed = discord.Embed(title="🌟 Merit", description="Cancelling...", color=client_role_color(self, ctx), timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
示例#22
0
    async def ban(self, ctx, user: discord.Member, *args):
        """CATEG_MOD Bans someone from the server."""
        author = ctx.message.author
        channel = ctx.message.channel

        if author.guild_permissions.ban_members == False:
            embed = discord.Embed(
                title="🔴 Error",
                description="You do not have the necessary permissions.",
                color=0xdd2e44,
                timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
            return
        if user == author:
            embed = discord.Embed(title="🔴 Error",
                                  description="You cannot ban yourself.",
                                  color=0xdd2e44,
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        elif user == self.client.user:
            embed = discord.Embed(
                title=":warning: {}".format(self.client.user.name),
                description="Are you sure you want me to leave this server?",
                color=0xffcd4c,
                timestamp=datetime.utcnow())
            selfkick = True
        else:
            userdm = user.dm_channel
            embed = discord.Embed(
                title=":warning: {}".format(self.client.user.name),
                description="Are you sure you want to ban {}?".format(
                    user.mention),
                color=0xffcd4c,
                timestamp=datetime.utcnow())
            selfkick = False

        embed.set_footer(icon_url=self.client.user.avatar_url,
                         text="Reply with yes to continue.")
        await ctx.send(embed=embed)

        def check(m):
            return m.channel == channel and m.author == author

        msg = await self.client.wait_for('message', check=check)
        if msg.content == "yes" or msg.content == "y":
            if selfkick == True:
                embed = discord.Embed(
                    title="🔨 {}".format(self.client.user.name),
                    description="Okay, see you later! :wave:",
                    color=client_role_color(self, ctx),
                    timestamp=datetime.utcnow())
                embed.set_footer(icon_url=self.client.user.avatar_url,
                                 text=self.client.user.name)
                await ctx.send(embed=embed)
                await msg.guild.leave()
                return
            else:
                reason = ' '.join(args)
                if reason == None or reason == "" or reason == " ":
                    reason = 'No reason provided | Banned by {}.'.format(
                        str(author))
                else:
                    reason = reason + " | Banned by {}".format(str(author))

                try:
                    replyembed = discord.Embed(
                        title=":warning: {}".format(self.client.user.name),
                        description="You've been banned from {} for: \n{}".
                        format(msg.guild.name, reason),
                        color=0xffcd4c,
                        timestamp=datetime.utcnow())
                    replyembed.set_thumbnail(url=ctx.message.guild.icon_url)
                    replyembed.set_footer(icon_url=self.client.user.avatar_url,
                                          text=self.client.user.name)
                    if userdm == None:
                        await user.create_dm()
                        userdm = user.dm_channel
                        pass
                    await userdm.send(embed=replyembed)
                except discord.errors.Forbidden:
                    pass

                try:
                    await msg.guild.ban(user=user, reason=reason)
                    embed = discord.Embed(
                        title="🔨 Ban",
                        description="Successfully banned {}.".format(
                            user.name),
                        color=client_role_color(self, ctx),
                        timestamp=datetime.utcnow())
                    embed.set_footer(icon_url=self.client.user.avatar_url,
                                     text=self.client.user.name)
                    await ctx.send(embed=embed)

                except discord.errors.Forbidden:
                    embed = discord.Embed(
                        title="🔴 Error",
                        description=
                        "I need the ``Ban Members`` permission to do this.",
                        color=0xdd2e44,
                        timestamp=datetime.utcnow())
                    embed.set_footer(icon_url=self.client.user.avatar_url,
                                     text=self.client.user.name)
                    await ctx.send(embed=embed)
        else:
            embed = discord.Embed(title="🔨 Ban",
                                  description="Cancelling...",
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            await ctx.send(embed=embed)
示例#23
0
文件: fun.py 项目: notLeM/OpenBot
    async def kill(self, ctx, user: discord.Member = None):
        """CATEG_FUN Murder someone."""
        author = ctx.message.author
        if user == None:
            user = ctx.message.author

        kills = []
        kills.append(
            '{killer} shoves a double barreled shotgun into {user}\'s mouth and squeezes the trigger of the gun, causing {user}\'s head to horrifically explode like a ripe pimple, splattering the young person\'s brain matter, gore, and bone fragments all over the walls and painting it a crimson red.'
        )
        kills.append(
            'Screaming in sheer terror and agony, {user} is horrifically dragged into the darkness by unseen forces, leaving nothing but bloody fingernails and a trail of scratch marks in the ground from which the young person had attempted to halt the dragging process.'
        )
        kills.append(
            '{killer} takes a machette and starts hacking away on {user}, chopping {user} into dozens of pieces.'
        )
        kills.append(
            '{killer} pours acid over {user}. *"Well don\'t you look pretty right now?"*'
        )
        kills.append(
            '{user} screams in terror as a giant creature with huge muscular arms grab {user}\'s head; {user}\'s screams of terror are cut off as the creature tears off the head with a sickening crunching sound. {user}\'s spinal cord, which is still attached to the dismembered head, is used by the creature as a makeshift sword to slice a perfect asymmetrical line down {user}\'s body, causing the organs to spill out as the two halves fall to their respective sides.'
        )
        kills.append(
            '{killer} grabs {user}\'s head and tears it off with superhuman speed and efficiency. Using {user}\'s head as a makeshift basketball, {killer} expertly slams dunk it into the basketball hoop, much to the applause of the audience watching the gruesome scene.'
        )
        kills.append(
            '{killer} uses a shiv to horrifically stab {user} multiple times in the chest and throat, causing {user} to gurgle up blood as the young person horrifically dies.'
        )
        kills.append(
            '{user} screams as {killer} lifts {user} up using his superhuman strength. Before {user} can even utter a scream of terror, {killer} uses his superhuman strength to horrifically tear {user} into two halves; {user} stares at the monstrosity in shock and disbelief as {user} gurgles up blood, the upper body organs spilling out of the dismembered torso, before the eyes roll backward into the skull.'
        )
        kills.append(
            '{user} steps on a land mine and is horrifically blown to multiple pieces as the device explodes, the {user}\'s entrails and gore flying up and splattering all around as if someone had thrown a watermelon onto the ground from the top of a multiple story building.'
        )
        kills.append(
            '{user} is killed instantly as the top half of his head is blown off by a Red Army sniper armed with a Mosin Nagant, {user}\'s brains splattering everywhere in a horrific fashion.'
        )

        if user == author:
            embed = discord.Embed(title="💀 Kill",
                                  description="I won't let you kill yourself!",
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            return await ctx.send(embed=embed)
        elif user.id == self.client.user.id:
            embed = discord.Embed(title="💀 Kill",
                                  description="I refuse to kill myself!",
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            return await ctx.send(embed=embed)
        else:
            message = str(random.choice(kills)).format(
                user=user.display_name, killer=author.display_name)
            embed = discord.Embed(title="💀 Kill",
                                  description=message,
                                  color=client_role_color(self, ctx),
                                  timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url,
                             text=self.client.user.name)
            return await ctx.send(embed=embed)
示例#24
0
文件: merit.py 项目: notLeM/OpenBot
    async def clearmerits(self, ctx, user: discord.Member = None):
        """CATEG_MOD Clear someone's merits."""

        channel = ctx.message.channel
        author = ctx.message.author
        guild = ctx.message.guild
        guildstr = str(guild.id)
        userstr = str(user.id)

        if ctx.message.author.guild_permissions.manage_messages == False:
            embed=discord.Embed(title="🔴 Error", description="You do not have the necessary permissions.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return
        if user == None:
            embed=discord.Embed(title="🔴 Error", description="You need to provide a user.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return
        if user == author:
            embed=discord.Embed(title="🔴 Error", description="You can't clear your own merits!", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        embed=discord.Embed(title=":warning: {}".format(self.client.user.name), description="Are you sure you want to clear {}'s merits?".format(user.mention), color=0xffcd4c, timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,text="Reply with yes to continue.")
        await ctx.send(embed=embed)

        def check(m):
            return m.channel == channel and m.author == author

        msg = await self.client.wait_for('message', check=check)
        if msg.content == "yes" or msg.content == "y":
            if self.db[guildstr][userstr]:
                del self.db[guildstr][userstr]
                fileIO(self.path, "save", self.db)
                embed = discord.Embed(title="🌟 Merit", description="Successfully cleared {}'s merits.".format(user.mention), color=client_role_color(self, ctx), timestamp=datetime.utcnow())
                embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
                await ctx.send(embed=embed)
                
                if not self.db[guildstr]:
                    del self.db[guildstr]
                fileIO(self.path, "save", self.db)
                return

            embed = discord.Embed(title="🌟 Merit", description="{} didn't have any merits to clear.".format(user.mention), color=client_role_color(self, ctx), timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
        else:
            embed = discord.Embed(title="🌟 Merit", description="Cancelling...", color=client_role_color(self, ctx), timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
示例#25
0
文件: merit.py 项目: notLeM/OpenBot
    async def rmmerit(self, ctx, meritID: int=0):
        """CATEG_MOD Delete a merit."""
        if ctx.message.author.guild_permissions.manage_messages == False:
            embed=discord.Embed(title="🔴 Error", description="You do not have the necessary permissions.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return
        if meritID < 100000000000000000 or meritID > 9999999999999999999:
            embed=discord.Embed(title="🔴 Error", description="Invalid merit ID.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
            return

        channel = ctx.message.channel
        author = ctx.message.author
        guild = ctx.message.guild
        guildstr = str(guild.id)
        meritstr = str(meritID)

        embed=discord.Embed(title=":warning: {}".format(self.client.user.name), description="Are you sure you want to delete this merit?", color=0xffcd4c, timestamp=datetime.utcnow())
        embed.set_footer(icon_url=self.client.user.avatar_url,text="Reply with yes to continue.")
        await ctx.send(embed=embed)

        def check(m):
            return m.channel == channel and m.author == author

        msg = await self.client.wait_for('message', check=check)
        if msg.content == "yes" or msg.content == "y":
            for x in self.db[guildstr]:
                if meritstr in self.db[guildstr][x]:
                    del self.db[guildstr][x][meritstr]
                    fileIO(self.path, "save", self.db)
                    embed = discord.Embed(title="🌟 Merit", description="Successfully removed the merit.", color=client_role_color(self, ctx), timestamp=datetime.utcnow())
                    embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
                    await ctx.send(embed=embed)
                    
                    if not self.db[guildstr][x]:
                        del self.db[guildstr][x]
                        if not self.db[guildstr]:
                            del self.db[guildstr]
                        fileIO(self.path, "save", self.db)
                    return
            embed=discord.Embed(title="🔴 Error", description="merit not found.", color=0xdd2e44, timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)
        else:
            embed = discord.Embed(title="🌟 Merit", description="Cancelling...", color=client_role_color(self, ctx), timestamp=datetime.utcnow())
            embed.set_footer(icon_url=self.client.user.avatar_url, text=self.client.user.name)
            await ctx.send(embed=embed)