示例#1
0
    async def suggest(self, ctx, *, message: str):
        member = ctx.message.author
        user = uinfo.find_one({'User id': f'{ctx.author.id}'})
        if user["Titles"]["Banned"] == 1:
            await ctx.send(
                "You may not use this command as you are blacklisted on PinkBot, for more info join PinkBots support server https://discord.gg/TUkcgWt"
            )
        else:
            channel = bot.get_channel(698581537066582066)
            channel2 = bot.get_channel(698581569371373610)
            dm = await member.create_dm()
            color = ctx.author.color
            embed = discord.Embed(title=f'{member} Suggestion',
                                  colour=color,
                                  timestamp=datetime.datetime.utcnow())
            embed.add_field(name="Name:", value=f'{member}', inline=False)
            embed.add_field(name="Suggestion:",
                            value=f"{message}",
                            inline=False)
            sent = await channel.send(embed=embed)
            await ctx.send("Your suggestion has been sent")

            def check(reaction, user_id):
                return reaction.message.id == sent.id

            try:
                reaction, _ = await self.bot.wait_for('reaction_add',
                                                      timeout=86400.0,
                                                      check=check)
                if reaction.emoji == "\U0001F44D":
                    color = ctx.author.color
                    embed = discord.Embed(title=f'{member} Suggestion',
                                          colour=color,
                                          timestamp=datetime.datetime.utcnow())
                    embed.add_field(name="Name:",
                                    value=f'{member}',
                                    inline=False)
                    embed.add_field(name="Suggestion:",
                                    value=f"{message}",
                                    inline=False)
                    sent2 = await channel2.send(embed=embed)
                    await sent2.add_reaction(emoji="\U0001F44D")
                    await sent2.add_reaction(emoji="\U0001F44E")
                    await dm.send(
                        f"Hello {member.mention}, your suggestion `{message}` has been approved to go on the main bord https://discord.gg/TUkcgWt where people can vote on your idea!"
                    )
                elif reaction.emoji == "\U0001F44E":
                    await dm.send(
                        f"Hello {member}, your suggestion `{message}` wasnt approved, this can be do to:\n1 your suggestion was spam/wasnt real \n2 This feature is already in the bot \n3 the reason is something else and you will get a dm from pinkbot staff within 10 minutes \nif you have any questions you can ask them in the support server https://discord.gg/TUkcgWt"
                    )
                elif reaction.emoji == "\u2705":
                    await dm.send(
                        f'wow {member.mention}, what a grate suggestion `{message}`, in fact, it was so grate it was auto approved, yup its going in PinkBot without the public vote'
                    )
            except asyncio.TimeoutError:
                await ctx.send(
                    f"Suggestion: `{message}` by {member.mention} wasnt approved in time"
                )
                await dm.send(
                    f"Your suggestion `{message}` wast approved in time")
示例#2
0
async def set_strike_inactive():
    user = await fetch_user_with_perms()
    if user["is_mod"]:
        bot_channel = bot.get_channel(BOT_OUTPUT_CHANNEL)
        strike_id = request.args.get("strike_id")
        strike = get_strike(strike_id)
        if not strike:
            await flash(f"Strike ID {strike_id} does not exist")
            return redirect(url_for("strikes.strikes"))
        change_active_status(strike_id, 0)
        await flash(f"Strike ID {strike_id} set to inactive")
        await response_embed(
            bot_channel,
            f"Strike set to Inactive by {user['user'].name} via Web Dashboard",
            get_strike_info_string(strike))
        striked_user = bot.get_user(strike[1])
        try:
            await response_embed(
                striked_user, "Strike no longer active (edited by a host)",
                get_strike_info_string(strike) +
                "_if you have other strikes active, you may not be able to sign up for events_"
            )
        except Forbidden:
            info(
                f"Could not send DM to {striked_user.name} about their strike expiring"
            )
        return redirect(url_for("strikes.strikes"))
    else:
        return redirect(url_for("strikes.strikes"))
示例#3
0
async def remove_strike_endpoint():
    user = await fetch_user_with_perms()
    if user["is_mod"]:
        bot_channel = bot.get_channel(BOT_OUTPUT_CHANNEL)
        strike_id = request.args.get("strike_id")
        strike = get_strike(strike_id)
        if not strike:
            await flash(f"Strike ID {strike_id} does not exist")
            return redirect(url_for("strikes.strikes"))
        remove_strike(strike_id)
        await flash(f"Strike ID {strike_id} removed")
        striked_user = bot.get_user(strike[1])
        await response_embed(
            bot_channel,
            f"Strike removed by {user['user'].name} via Web Dashboard",
            get_strike_info_string(strike))
        striked_user = bot.get_user(strike[1])
        try:
            await response_embed(
                striked_user, "Strike deleted (removed by a host)",
                get_strike_info_string(strike) +
                "This strike has been completely removed from your record and won't count towards future punishments"
            )
        except Forbidden:
            info(
                f"Could not send DM to {striked_user.name} about their strike expiring"
            )
        return redirect(url_for("strikes.strikes"))
    else:
        return redirect(url_for("strikes.strikes"))
示例#4
0
 async def dmsend(self, ctx, user_id: int, *, message: str):
     user = uinfo.find_one({'User id': f'{ctx.author.id}'})
     if user["Titles"]['Owner'] == 1 or user["Titles"]['Admin'] == 1:
         member = bot.get_user(user_id)
         channel = await member.create_dm()
         channel2 = bot.get_channel(698635545408045087)
         color = ctx.author.color
         embed = discord.Embed(title='Dm from PinkBot', colour=color, timestamp=datetime.datetime.utcnow())
         embed.add_field(name="Name of the receiver:", value=f"{member}")
         embed.add_field(name="Message:", value=f"{message}", inline=False)
         embed.add_field(name="Note:",
                         value="If you want to send us a message please use >dm your message here(only works in dms), abuse of this or any other features can get you banned from doing commands in the future",
                         inline=False)
         await channel.send(embed=embed)
         await channel2.send(embed=embed)
示例#5
0
 async def dm(self, ctx, *, message: str):
     user = uinfo.find_one({'User id': f'{ctx.author.id}'})
     if user["Titles"]["Banned"] == 1:
         await ctx.send(
             "You may not use this command as you are blacklisted on PinkBot, for more info join PinkBots support server [here](https://discord.gg/TUkcgWt)"
         )
     else:
         channel = bot.get_channel(698635497966403636)
         color = ctx.author.color
         member = ctx.message.author
         embed = discord.Embed(title=f'Dm from {member}',
                               colour=color,
                               timestamp=datetime.datetime.utcnow())
         embed.add_field(name="Name:", value=f'{member}', inline=False)
         embed.add_field(name="Message:", value=f"{message}", inline=False)
         await channel.send(embed=embed)
         await ctx.send(
             "Your dm has been sent and will be proceed soon, remember, abuse of this or any other system could get you banned from doing these commands, dms and suggestions are monitored by PinkBots staff team"
         )
示例#6
0
async def send_message():
    if await discord.authorized:
        user = await fetch_user_with_perms()
        if user["is_mod"]:
            message_info = await request.get_json()
            guild = bot.get_guild(SLASH_COMMANDS_GUILDS[0])

            member = get(guild.members, id=user["user"].id)
            info(message_info)
            info(f"{user['user']} sent message \"{message_info['message']}\"")
            channel = bot.get_channel(int(message_info["channel_id"]))
            allowed_text_channels = [
                channel for channel in guild.text_channels
                if channel.permissions_for(member).send_messages
            ]
            if channel in allowed_text_channels:
                await channel.send(message_info["message"])
            else:
                return jsonify({
                    "success":
                    False,
                    "error":
                    "You do not have perms for this channel"
                })
            return jsonify({"success": True})
        else:
            return jsonify({
                "success": False,
                "error": "You need the PUG Mod role to do this"
            })
    else:
        return jsonify({
            "success":
            False,
            "error":
            "You are not logged in with your discord account"
        })
示例#7
0
async def _create_context(channel, message_id) -> context.Context:
    """Create a ctx from a channel message placeholder"""
    channel = bot.get_channel(channel)
    message = await channel.fetch_message(id=message_id)
    return await bot.get_context(message)
示例#8
0
 async def say(self, ctx, channel_id: int, *, message: str):
     user = uinfo.find_one({'User id': f'{ctx.author.id}'})
     if user["Titles"]['Owner'] == 1:
         channel = bot.get_channel(channel_id)
         await channel.send(message)