Esempio n. 1
0
    def is_hide(channel: discord.VoiceChannel) -> bool:
        guild: discord.Guild = channel.guild
        everyone_perms = dict(channel.overwrites_for(guild.default_role))

        if everyone_perms['view_channel']:
            return False

        return True
Esempio n. 2
0
    async def setTimeChannel(self, ctx, channel: VoiceChannel):
        """
        Docstring goes here.
        """
        guild = ctx.guild
        ok = add_guild_time_channel(guild, channel)
        if ok:
            msg = (
                "{} set as the Snorlax time channel successfully."
                " Make sure Snorlax has the correct permissions!".format(
                    channel.mention
                )
            )
            # Make sure the channel permissions are set
            role = ctx.guild.default_role
            overwrites = channel.overwrites_for(role)
            overwrites.connect = False
            await channel.set_permissions(role, overwrite=overwrites)
        else:
            msg = (
                "Error when setting the time channel."
            )

        await ctx.channel.send(msg)