Esempio n. 1
0
 async def setslowmode(self, ctx, seconds: int):
     serverId = ctx.guild.id
     config = Config("config", str(serverId))
     config.setSeconds(seconds)
     embed = discord.Embed(
         title=f"Set Slowmode to {seconds} seconds",
         description=
         f"Slowmode seconds has been changed to {seconds} seconds",
         color=0x27ca1c)
     embed.set_author(name=f"Requested by {ctx.message.author.name}",
                      icon_url=ctx.message.author.avatar_url)
     embed.set_footer(text="AntiRaider | Bot by xYarin#2280")
     await ctx.send(embed=embed)
Esempio n. 2
0
async def on_voice_state_update(member, before, after):
    if member.guild.id != 560924142040383503:
        return
    config = Config("config", str(member.guild.id))
    channel = client.get_channel(708793816425037866)
    msg = await channel.fetch_message(770700693244739634)
    membercount = 0
    for vc in member.guild.voice_channels:
        membercount += len(vc.members)
    if config.getHighestMembers() < membercount:
        config.setHighestMembers(membercount)

    await msg.edit(
        content=
        f"{membercount} members are currently in voice channels in {member.guild.name}.\nHighest members in voice at the same time is {config.getHighestMembers()}"
    )
Esempio n. 3
0
    async def setNotifyChannel(self, ctx, channel : discord.TextChannel):
        """setNotifyChannel set the notify channel to notify a new user

        Args:
            ctx (discord.ext.commands.Context): required arguement for a discord command
            channel (discord.TextChannel): the desired text channel

        Returns:
            False: if no channel found
        """
        config = Config("config", str(ctx.guild.id))
        if discord.utils.get(ctx.guild.text_channels, id=channel.id) == None:
            await ctx.send("Please tag a channel that is in the server...")
            return False
        config.setNotifyChannel(channel.id)
        await ctx.send(f"Updated notify channel to <#{channel.id}>")
Esempio n. 4
0
    async def getStartHour(self, ctx):
        """getStartHour get the start hour from the config and send it in the chat

        Args:
            ctx (discord.ext.commands.Context): required argument for a discord command
        """
        config = Config("config", str(ctx.guild.id))
        await ctx.send(f"Start hour is {config.getStartHour()}")
Esempio n. 5
0
    async def setNotify(self, ctx, value):
        """setNotify set if you want to get notified about new discord users (look notify.py)

        Args:
            ctx (discord.ext.commands.Context): required arguement for a discord command
            value (bool): the value, must be True / False
        """
        config = Config("config", str(ctx.guild.id))
        value = str(value).capitalize()
        if value != "True" and value != "False":
            await ctx.send("Please enter a valid boolean (True / False)")
            return None
        elif value == "True":
            value = True
        elif value == "False":
            value = False
        config.setCheckingAge(value)
        await ctx.send(f"Changed the value to {config.isCheckingAge()}")
Esempio n. 6
0
    async def getChannels(self, ctx):
        """getChannels get the channel ID's from the config and send it in the chat

        Args:
            ctx (discord.ext.commands.Context): required arguement for a discord command

        """
        config = Config("config", str(ctx.guild.id))
        await ctx.send(f"Channels are {config.getChannels()}")
Esempio n. 7
0
    async def on_member_join(self, member):
        """on_member_join an event when a member joins a discord server the bot is in

        Args:
            member (discord.Member): the member object who joined the guild
        """
        print(f"member joined {member.guild.name}")
        server_id = member.guild.id
        config = Config('config', str(server_id))
        if config.isCheckingAge() and self.isNew(member):
            days = datetime.now() - member.created_at
            print(f"[DETECTED] New User in {member.guild.name}")
            staff_chat = discord.utils.get(member.guild.text_channels,
                                           id=config.getNotifyChat())
            embed = discord.Embed(title="New User Notify",
                                  description=f"{member.mention} has joined",
                                  color=0xe11414)
            embed.add_field(
                name="Creation date:",
                value=
                f"{days.days if days.days > 0 else 0} days ago, {days.seconds // 3600} hours ago, {days.seconds // 60 % 60} minutes ago",
                inline=True)
            embed.set_author(name="AntiRaider Notifier",
                             icon_url=self.bot.user.avatar_url)
            embed.set_thumbnail(url=member.avatar_url)
            embed.set_footer(text="AntiRaider | Bot by xYarin#2280")
            await staff_chat.send(embed=embed)
            role = config.getRoleNotifierId()
            if role != 0:
                if type(role) == list:
                    msg = ""
                    for r in role:
                        msg += f" <@&{r}> "
                    await staff_chat.send(msg)
                else:
                    await staff_chat.send(f"<@&{role}>")
            else:
                await staff_chat.send(member.guild.default_role)