Пример #1
0
    async def mod_request_listener(self, message):
        # If it's a command, ignore
        if (await self.bot.get_context(message)).valid:
            return

        if message.guild != self.bot.democraciv_guild_object:
            return

        if message.author.bot:
            return

        try:
            mod_role = mk.get_democraciv_role(
                self.bot, mk.DemocracivRole.MODERATION_ROLE)
        except exceptions.RoleNotFoundError:
            return

        if mod_role is None:
            return

        if mod_role in message.role_mentions:
            embed = self.bot.embeds.embed_builder(
                title=f":pushpin:  New Request in #{message.channel.name}",
                description=message.content)
            embed.add_field(name="From", value=message.author.mention)
            embed.add_field(name="Original",
                            value=f"[Jump!]({message.jump_url})")
            await mk.get_democraciv_channel(
                self.bot,
                mk.DemocracivChannel.MODERATION_NOTIFICATIONS_CHANNEL).send(
                    embed=embed)
    async def streaming_rules_reminder(self):
        executive_channel = mk.get_democraciv_channel(self.bot, mk.DemocracivChannel.EXECUTIVE_CHANNEL)

        try:
            minister_role = mk.get_democraciv_role(self.bot, mk.DemocracivRole.MINISTER_ROLE)
            governor_role = mk.get_democraciv_role(self.bot, mk.DemocracivRole.GOVERNOR_ROLE)
            executive_proxy_role = mk.get_democraciv_role(self.bot, mk.DemocracivRole.EXECUTIVE_PROXY_ROLE)
        except exceptions.RoleNotFoundError:
            minister_role = governor_role = executive_proxy_role = None

        if executive_channel is None:
            raise exceptions.ChannelNotFoundError("executive")

        embed = self.bot.embeds.embed_builder(title="Streaming Guidelines",
                                              description="Looks like you're starting another game session. "
                                                          "Remember these guidelines!")

        embed.add_field(name="Don't show the stream key",
                        value="Never show the stream key or the DMs with the "
                              "moderator that sent you the key on stream!",
                        inline=False)

        embed.add_field(name="Introduce yourself",
                        value="No one knows which voice belongs to whom! "
                              "Introduce yourself with your name and position.",
                        inline=False)

        embed.add_field(name="Keep it short",
                        value="In the past, streams often were too long. Keep the stream "
                              "short and don't waste time by starting the stream when not everyone "
                              "is ready or the game is not even started yet!",
                        inline=False)

        embed.add_field(name="Hand over the save-game",
                        value="Remember to send the save-game to one of "
                              "the moderators after the stream!",
                        inline=False)

        embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/423938725525979146/"
                                "645394491133394966/01-twitch-logo.jpg")

        if minister_role is not None and governor_role is not None and executive_proxy_role is not None:
            await executive_channel.send(f"{minister_role.mention} {governor_role.mention} "
                                         f"{executive_proxy_role.mention}")

        await executive_channel.send(embed=embed)
Пример #3
0
    async def safe_send_mod_links(self, ctx, embed):
        if len(ctx.channel.members) >= 20:
            await ctx.message.add_reaction("\U0001f4e9")
            return await ctx.author.send(embed=embed)

        unsafe_members = [
            member for member in ctx.channel.members if not member.bot
            and mk.get_democraciv_role(self.bot, mk.DemocracivRole.
                                       MODERATION_ROLE) not in member.roles
        ]

        if unsafe_members:
            await ctx.message.add_reaction("\U0001f4e9")
            await ctx.author.send(embed=embed)
        else:
            await ctx.send(embed=embed)
Пример #4
0
 def judge_role(self) -> typing.Optional[discord.Role]:
     return mk.get_democraciv_role(self.bot, mk.DemocracivRole.JUDGE_ROLE)
Пример #5
0
 def chief(self) -> typing.Optional[discord.Member]:
     try:
         return mk.get_democraciv_role(
             self.bot, mk.DemocracivRole.CHIEF_JUSTICE_ROLE).members[0]
     except (IndexError, exceptions.RoleNotFoundError):
         return None
Пример #6
0
    async def report(self, ctx):
        """Report something to the Democraciv Moderation

         This command only works in DMs with me."""

        flow = Flow(self.bot, ctx)

        anon_question = await ctx.send(
            "You can report something directly to the mods with this command. Abuse "
            "(i.e. spamming joke reports) will be punished.\n\n\n:information_source: "
            "Do you want this report to be anonymous?")

        is_anon = True

        reaction = await flow.get_yes_no_reaction_confirm(anon_question, 150)

        if reaction is None:
            return

        if reaction:
            is_anon = True

        elif not reaction:
            is_anon = False

        await ctx.send(
            ":information_source: Reply with the details of your report. This will abort after"
            " 10 minutes of no reply.")

        content = await flow.get_text_input(600)

        if not content:
            return

        if len(content) > 2048:
            return await ctx.send(
                ":x: Text cannot be more than 2048 characters.")

        pretty_anon = "be anonymous" if is_anon else "not be anonymous"

        are_you_sure = await ctx.send(
            f":information_source: Are you sure that you want to send this report? "
            f"The report will **{pretty_anon}**.")

        reaction = await flow.get_yes_no_reaction_confirm(are_you_sure, 150)

        if reaction is None:
            return

        if reaction:
            embed = self.bot.embeds.embed_builder(
                title=":exclamation: New Report", description=content)

            if is_anon:
                from_value = "*Anonymous Report*"
            else:
                from_value = str(ctx.author)

            embed.add_field(name="From", value=from_value)

            await mk.get_democraciv_channel(
                self.bot,
                mk.DemocracivChannel.MODERATION_NOTIFICATIONS_CHANNEL).send(
                    content=mk.get_democraciv_role(
                        self.bot, mk.DemocracivRole.MODERATION_ROLE).mention,
                    embed=embed)

            await ctx.send(":white_check_mark: Report was sent.")

        elif not reaction:
            return await ctx.send("Aborted.")
Пример #7
0
 def speaker(self) -> typing.Optional[discord.Member]:
     try:
         return mk.get_democraciv_role(self.bot, mk.DemocracivRole.SPEAKER_ROLE).members[0]
     except (IndexError, exceptions.RoleNotFoundError):
         return None
Пример #8
0
 def lt_prime_minister(self) -> typing.Optional[discord.Member]:
     try:
         return mk.get_democraciv_role(self.bot, mk.DemocracivRole.LT_PRIME_MINISTER_ROLE).members[0]
     except (IndexError, exceptions.RoleNotFoundError):
         return None