Beispiel #1
0
    async def revokeserver(self, ctx):
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered:
            _server.remove_server()
            await self.bot.say(self.msg.SERVER_REVOKED.format(server.name))
        else:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
Beispiel #2
0
    async def setwelcomemessage(self, ctx, *, msg: str):
        server = ctx.message.server 
        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        _server.set_welcome_message(msg)

        await self.bot.say(f"🛠 | You set the server's welcome message to \"**{msg}**\".")
Beispiel #3
0
    async def removewelcomemessage(self, ctx):
        server = ctx.message.server 
        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        _server.remove_welcome_message()

        await self.bot.say("🛠 | You removed the server's welcome message.")
Beispiel #4
0
    async def removeassignable(self, ctx, *, role: discord.Role):
        _server = Server(ctx.message.server.id)

        if role.id not in _server.assignable_roles:
            await self.bot.say("❌ | The role is not self-assignable.")
            return

        _server.remove_assignable_role(role.id)

        await self.bot.say(
            f"✅ | You revoked **{role.name}**'s self assignable state.")
Beispiel #5
0
    async def assignable(self, ctx, *, role: discord.Role):
        _server = Server(ctx.message.server.id)

        if role.id in _server.assignable_roles:
            await self.bot.say("❌ | The role is already self-assignable.")
            return

        _server.add_assignable_role(role.id)

        await self.bot.say(
            f"✅ | You made **{role.name}** a self-assignable role.")
Beispiel #6
0
    async def registerserver(self, ctx):
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered:
            await self.bot.say(self.errors.SRV_ALREADY_IN_DB)
            return
        else:
            _server.append_server()
        
        await self.bot.say(self.msg.SERVER_REGISTERED.format(server.name))
Beispiel #7
0
    async def setmodrole(self, ctx, role: discord.Role):
        server = ctx.message.server 
        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        if _server.mod_role == role.id:
            await self.bot.say("❌ | This is already your mod role.")
            return
        
        _server.set_mod_role(role.id)

        await self.bot.say(f"✅ | You set {role.mention} as your server's mod role.")
Beispiel #8
0
    async def on_message_delete(self, message):
        _channel = Channel(message.channel.id)
        _server = Server(message.server.id)

        if _channel.is_log_blocked:
            return

        if _server.logging_allowed is False:
            return

        if _server.logs_channel is None:
            return

        embed = discord.Embed(title="❌ | Message DELETED",
                              color=self.themes.MAIN_COL,
                              timestamp=message.timestamp)
        embed.set_author(name=message.author,
                         icon_url=message.author.avatar_url)
        embed.add_field(name="User ID", value=message.author.id, inline=False)
        embed.add_field(name="Channel",
                        value=message.channel.mention,
                        inline=False)
        embed.add_field(name="Message",
                        value=f"\u200b{message.content}",
                        inline=False)

        logs = discord.utils.get(message.server.channels,
                                 id=_server.logs_channel)

        await self.bot.send_message(logs, embed=embed)
Beispiel #9
0
    def is_mod(ctx):
        _server = Server(ctx.message.server.id)

        mod_role = discord.utils.get(ctx.message.server.roles,
                                     id=_server.mod_role)

        return mod_role in ctx.message.author.roles or ctx.message.author.server_permissions.administrator
Beispiel #10
0
    async def removevcrole(self, ctx):
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        if _server.vc_role is None:
            await self.bot.say(self.errors.ROLE_IS_NONE)
            return

        _server.set_vc_role(None)

        await self.bot.say(self.msg.ROLE_REMOVE)
Beispiel #11
0
    async def ticketbuy(self, ctx, first: int, second: int, bet: int = 50):
        global current_pool
        author_id = ctx.message.author.id
        server_id = ctx.message.server.id
        _user = User(author_id)
        _server = Server(server_id)

        if _user.is_Registered is False:
            await self.bot.say(self.errors.USER_NOT_IN_DB)
            return

        if _user.money < bet:
            await self.bot.say(self.errors.INSUF_MONEY)
            return

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.cmd_channel is None:
            await self.bot.say("❌ | Please register a commands spam channel.")
            return

        if bet < 50:
            await self.bot.say("❌ | Minimum bet is 50 coins!")
            return

        if first > 30 or second > 30:
            await self.bot.say(
                "❌ | Numbers allowed are only in the range 1-30.")
            return

        user_draw = []
        user_draw.append(first)
        user_draw.append(second)

        try:
            _checker = server_bets[server_id]
        except:
            server_bets[server_id] = {}

        _user.add_money(-bet)

        if len(server_bets[server_id]) == 0:
            server_bets[server_id] = {author_id: user_draw}
            await self.bot.say(
                f"🎰 | You bought a ticket to the lottery with the numbers `{first}` and `{second}` respectively."
            )
            await self.startlottery(ctx, bet * 3)
        else:
            if author_id in server_bets[server_id]:
                await self.bot.say(self.errors.TICKET_DUPLICATE)
                return
            else:
                await self.bot.say(
                    f"🎰 | You bought a ticket to the lottery with the numbers `{first}` and `{second}` respectively."
                )
                server_bets[server_id][author_id] = user_draw
                current_pool[ctx.message.server.id] += bet
Beispiel #12
0
    async def setvcrole(self, ctx, role: discord.Role):
        role_id = role.id
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        if _server.vc_role == role_id:
            await self.bot.say(self.errors.ROLE_SET_ALREADY)
            return
        
        _server.set_vc_role(role_id)

        await self.bot.say(self.msg.ROLE_SET.format(role.name))
Beispiel #13
0
    async def setlogs(self, ctx, channel: discord.Channel):
        channel_id = channel.id
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        if _server.logs_channel == channel_id:
            await self.bot.say(self.errors.LOGS_CHAN_REG)
            return
        
        _server.set_logs_channel(channel_id)

        await self.bot.say(self.msg.LOGS_CHAN_SET.format(channel.mention))
Beispiel #14
0
    async def muterole(self, ctx, *, role: discord.Role):
        role_id = role.id
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.mute_role == role_id:
            await self.bot.say(self.errors.MUTE_ROLE_REG)
            return
        
        _server.set_mute_role(role_id)

        await self.bot.say(self.msg.MUTE_ROLE_SET.format(role.mention))
Beispiel #15
0
    async def suggest(self, ctx, *, string: str):
        suggest_user = discord.Embed(
            title="💹🔵Suggestions🔴💹",
            description=
            "Thank you for submitting your suggestion! Abusing this feature can lead to sanctions from the moderators. Thank you for contributing in making this server better!",
            color=self.themes.MAIN_COL,
            timestamp=ctx.message.timestamp)

        _server = Server(ctx.message.server.id)

        if _server.suggest_channel is None:
            await self.bot.say(
                "❌ | You don't have a suggestions and reports channel.")
            return

        await self.bot.delete_message(ctx.message)

        await self.bot.say(embed=suggest_user)

        ticket_id = ctx.message.id

        await self.bot.send_message(
            ctx.message.author,
            f"🔵 | You submitted a suggestion on **{ctx.message.server.name}** and your ticket id is `{ticket_id}`."
        )

        suggest_admin = discord.Embed(title="User ID",
                                      description=ctx.message.author.id,
                                      color=self.themes.MAIN_COL,
                                      timestamp=ctx.message.timestamp)
        suggest_admin.set_author(name=ctx.message.author.name,
                                 icon_url=ctx.message.author.avatar_url)
        suggest_admin.add_field(name="Suggestion", value=string)
        suggest_admin.add_field(name="Ticket ID", value=ticket_id)

        channel = discord.utils.get(ctx.message.server.channels,
                                    id=_server.suggest_channel)

        msg = await self.bot.send_message(channel, embed=suggest_admin)

        await self.bot.add_reaction(msg, '👍')
        await self.bot.add_reaction(msg, '👎')

        if _server.is_public_suggest:
            suggest_public = discord.Embed(title="Suggestion",
                                           description=string,
                                           color=self.themes.MAIN_COL,
                                           timestamp=ctx.message.timestamp)
            suggest_public.set_author(name=ctx.message.author.name,
                                      icon_url=ctx.message.author.avatar_url)

            public_channel = discord.utils.get(
                ctx.message.server.channels, id=_server.public_suggest_channel)

            pub = await self.bot.send_message(public_channel,
                                              embed=suggest_public)
            await self.bot.add_reaction(pub, '👍')
            await self.bot.add_reaction(pub, '👎')
Beispiel #16
0
    async def removecmdchannel(self, ctx, channel: discord.Channel = None):
        if channel is None:
            channel = ctx.message.channel

        server = ctx.message.server 
        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return
        
        if _server.cmd_channel is None:
            await self.bot.say(self.errors.CMD_NONE)
            return
        
        _server.set_cmd_channel(None)

        await self.bot.say(self.msg.CMD_REMOVE.format(channel.name))
Beispiel #17
0
    async def removesuggestchannel(self, ctx, channel: discord.Channel = None):
        if channel is None:
            channel = ctx.message.channel

        _server = Server(ctx.message.server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.suggest_channel is None:
            await self.bot.say(
                "❌ | You don't have a suggestions and reports channel.")
            return

        _server.remove_suggest_channel()

        await self.bot.say(
            "✅ | You removed your server's suggestions and reports channel.")
Beispiel #18
0
    async def setsuggestchannel(self, ctx, channel: discord.Channel = None):
        if channel is None:
            channel = ctx.message.channel

        _server = Server(ctx.message.server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.suggest_channel == channel.id:
            await self.bot.say(
                "❌ | Channel already registered as your suggestions and reports channel."
            )
            return

        _server.set_suggest_channel(channel.id)

        await self.bot.say(
            f"✅ | You set **{channel.name}** as your suggestions and reports channel."
        )
Beispiel #19
0
    async def warn(self, ctx, user: discord.Member, *, reason: str):
        _user = User(user.id)
        _server = Server(ctx.message.server.id)
        _author = ctx.message.author

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _user.is_Registered is False:
            await self.bot.say(self.errors.USER_NOT_IN_DB)
            return

        warn = discord.Embed(title=self.msg.WARN_TITLE,
                             description=self.msg.WARN_STR,
                             color=self.themes.MAIN_COL,
                             timestamp=ctx.message.timestamp)
        warn.add_field(name="Server:",
                       value=ctx.message.server.name,
                       inline=False)
        warn.add_field(name="Reason:", value=reason, inline=False)

        _user.increment_warning

        await self.bot.send_message(user, embed=warn)
        await self.bot.say(self.msg.WARN_SUCCESS.format(user.mention))

        if _server.sanction_logs_allowed:
            if len(_server.logs_channel) == 0:
                await self.bot.say(self.errors.NO_LOGS_CHAN)
                return
            else:
                logger = discord.Embed(title=self.msg.LOG_WARN,
                                       description=self.msg.LOG_WARN_DESC,
                                       color=self.themes.MAIN_COL,
                                       timestamp=ctx.message.timestamp)
                logger.add_field(name=self.msg.LOG_WARNER,
                                 value=_author.mention,
                                 inline=False)
                logger.add_field(name=self.msg.LOG_WARNED,
                                 value=user.mention,
                                 inline=False)
                logger.add_field(name=self.msg.LOG_WARN_REASON,
                                 value=reason,
                                 inline=False)
                logger.add_field(name=self.msg.LOG_WARN_USER_TOT,
                                 value=_user.warnings,
                                 inline=False)

                logs = discord.utils.get(ctx.message.server.channels,
                                         id=_server.logs_channel)

                await self.bot.send_message(logs, embed=logger)
Beispiel #20
0
    async def startlottery(self, ctx, pool: int):
        global current_pool
        global draw
        _server = Server(ctx.message.server.id)
        cmd_channel = discord.utils.get(ctx.message.server.channels,
                                        id=_server.cmd_channel)

        current_pool[ctx.message.server.id] = pool

        second = 0

        await self.bot.send_message(
            cmd_channel,
            f"🎰 | Lottery started with a prize pool of **{pool}** coins plus the accumulated bets."
        )

        while second != 900:
            await asyncio.sleep(1)
            if second == 300:
                await self.bot.send_message(
                    cmd_channel,
                    "🎰 | **10 minutes** left until the draw of lottery results."
                )
            elif second == 600:
                await self.bot.send_message(
                    cmd_channel,
                    "🎰 | **5 minutes** left until the draw of lottery results."
                )
            elif second == 840:
                await self.bot.send_message(
                    cmd_channel,
                    "🎰 | **1 minute** left until the draw of lottery results.")
            elif second == 890:
                await self.bot.send_message(
                    cmd_channel,
                    "🎰 | **10 seconds** left until the draw of lottery results."
                )
            elif second == 895:
                await self.bot.send_message(
                    cmd_channel,
                    "🎰 | **5 seconds** left until the draw of lottery results."
                )
            second += 1
            try:
                if draw[ctx.message.server.id] is True:
                    break
            except:
                pass

        await self.drawresults(ctx, cmd_channel)
Beispiel #21
0
    async def join(self, ctx, *, role: discord.Role):
        _server = Server(ctx.message.server.id)
        author = ctx.message.author

        if role.id not in _server.assignable_roles:
            await self.bot.say("❌ | The role is not self-assignable.")
            return

        if role in author.roles:
            await self.bot.say("❌ | You already have this role.")
            return

        await self.bot.add_roles(author, role)

        await self.bot.say(f"✅ | {author.mention} joined **{role.name}**!")
Beispiel #22
0
    async def on_voice_state_update(self, before, after):
        _server = Server(before.server.id)

        if _server.vc_role is None:
            return

        try:
            role = discord.utils.get(after.server.roles, id=_server.vc_role)
        except:
            return

        if not before.voice.voice_channel and after.voice.voice_channel and after.voice.voice_channel != before.server.afk_channel:
            await self.bot.add_roles(after, role)
        elif before.voice.voice_channel and not after.voice.voice_channel:
            await self.bot.remove_roles(after, role)
Beispiel #23
0
    async def leave(self, ctx, *, role: discord.Role):
        _server = Server(ctx.message.server.id)
        author = ctx.message.author

        if role.id not in _server.assignable_roles:
            await self.bot.say("❌ | The role is not self-assignable.")
            return

        if role not in author.roles:
            await self.bot.say("❌ | don't have this role.")
            return

        await self.bot.remove_roles(author, role)

        await self.bot.say(f"✅ | {author.mention} left **{role.name}**!")
Beispiel #24
0
async def on_member_join(member):
    _server = Server(member.server.id)

    if _server.is_Registered is False:
        return

    welcome = discord.Embed(
        title=f"Welcome to {member.server}!",
        description="This bot is created by Friendly Tagalogchatting.",
        color=themes.MAIN_COL,
    )
    welcome.add_field(name="Welcome Message", value=_server.welcome_message)
    welcome.set_author(name=member.server, icon_url=member.server.icon_url)
    welcome.set_footer(
        text=f"Need help with this bot? Use {configs.PREFIX}help.")

    await bot.send_message(member, embed=welcome)
Beispiel #25
0
    async def togglepublicsuggest(self, ctx):
        _server = Server(ctx.message.server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.is_public_suggest:
            await self.bot.say("📴 | You turned public suggestions off.")
            _server.toggle_public_suggest(False)
        else:
            await self.bot.say("✅ | You turned public suggestions on.")
            _server.toggle_public_suggest(True)
Beispiel #26
0
    async def on_message(self, message):
        if message.server is None:
            return
            
        _server = Server(message.server.id)

        try:
            nrt = nrt_state[message.server.id]

            if _server.is_strict_nrt:
                if nrt[1]:
                    if message.author.id != nrt[0] and message.author.bot is False and nrt[2] == message.channel.id:
                        await self.bot.delete_message(message)
                    else:
                        if message.content.lower() == "end":
                            nrt_state.pop(message.server.id)
                            await self.bot.send_message(message.channel, "🚫 No Reply Thread ended. 🚫")
        except:
            pass
Beispiel #27
0
    async def togglenrt(self, ctx):
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.is_strict_nrt:
            _server.toggle_strict_nrt(False)
            await self.bot.say(self.msg.TOGGLE_NRT_OFF.format(server.name))
        else:
            _server.toggle_strict_nrt(True)
            await self.bot.say(self.msg.TOGGLE_NRT_ON.format(server.name))
Beispiel #28
0
    async def togglelogging(self, ctx):
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.logging_allowed:
            _server.toggle_logging(False)
            await self.bot.say(self.msg.TOGGLE_LOGGING_OFF.format(server.name))
        else:
            _server.toggle_logging(True)
            await self.bot.say(self.msg.TOGGLE_LOGGING_ON.format(server.name))
Beispiel #29
0
    async def togglesanctions(self, ctx):
        server = ctx.message.server

        _server = Server(server.id)

        if _server.is_Registered is False:
            await self.bot.say(self.errors.SRV_NOT_IN_DB)
            return

        if _server.sanction_logs_allowed:
            _server.toggle_sanctions(False)
            await self.bot.say(self.msg.TOGGLE_SANCTIONS_OFF.format(server.name))
        else:
            _server.toggle_sanctions(True)
            await self.bot.say(self.msg.TOGGLE_SANCTIONS_ON.format(server.name))
Beispiel #30
0
    async def report(self, ctx, *, string: str):
        report_user = discord.Embed(
            title="🔴Report🔴",
            description=
            "Thank you for submitting a report ticket! Abusing this feature can lead to sanctions. Thank you for contributing in making this server better!",
            color=0xfc1235,
            timestamp=ctx.message.timestamp)

        _server = Server(ctx.message.server.id)

        if _server.suggest_channel is None:
            await self.bot.say(
                "❌ | You don't have a suggestions and reports channel.")
            return

        await self.bot.delete_message(ctx.message)

        await self.bot.say(embed=report_user)

        ticket_id = ctx.message.id

        await self.bot.send_message(
            ctx.message.author,
            f"🔴 | You submitted a report on **{ctx.message.server.name}** and your ticket id is `{ticket_id}`."
        )

        report_admin = discord.Embed(title="User ID",
                                     description=ctx.message.author.id,
                                     color=0xfc1235,
                                     timestamp=ctx.message.timestamp)
        report_admin.set_author(name=ctx.message.author.name,
                                icon_url=ctx.message.author.avatar_url)
        report_admin.add_field(name="Report", value=string)
        report_admin.add_field(name="Ticket ID", value=ticket_id)

        channel = discord.utils.get(ctx.message.server.channels,
                                    id=_server.suggest_channel)

        await self.bot.send_message(channel, embed=report_admin)