def test_setChannel(self): ChannelUtil.setChannel(123, 321, Util.ChannelType.RANK_UP) result: Channel = ChannelUtil.GetChannelWithGuild( 123, Util.ChannelType.RANK_UP)[0] assert result.channel_id == 321 assert result.channel_guild_id == 123 assert result.channel_type == Util.ChannelType.RANK_UP.value
async def betting_keep_clear_group(self, ctx: commands.Context, *argv): if ctx.channel == None: await ctx.author.send("請在頻道中設置這個指令") return if not self.database.has_channel(ctx.guild.id, ctx.channel.id, Util.ChannelType.AUTO_DELETE): result = ChannelUtil.setChannel(ctx.guild.id, ctx.channel.id, Util.ChannelType.AUTO_DELETE) if result: await ctx.channel.send('這個頻道將開始自動刪除接下來的所有成員留言') self.database.set_ignore_xp_channel(ctx.guild.id, ctx.channel.id) else: await ctx.channel.send('這個頻道已經開啟自動刪除') else: await ctx.channel.send('這個頻道已經開啟自動刪除')
def set_ignore_xp_channel(self, guild_id: int, channel_id: int): ChannelUtil.setChannel(guild_id, channel_id, Util.ChannelType.IGNORE_XP, True) self.__ignoreXpChannel = ChannelUtil.getXPIgnoredChannels()