voice.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Excalibot 作者: endreman0 项目源码 文件源码
def unlink(self, ctx, text: discord.TextChannel, *, voice: discord.VoiceChannel):
        """Unlinks a voice channel and deletes the corresponding role."""
        with ctx.session:
            link = ctx.session.get(TextVoiceLink, text_id=text.id, voice_id=voice.id).one_or_none()
            if link is None:
                return await ctx.send('BAKA! Those channels are not linked!')
            role_id, text_id, voice_id = link.role_id, link.text_id, link.voice_id
            ctx.session.delete(link)
        role = discord.utils.get(ctx.guild.roles, id=role_id)
        if role is None:
            await ctx.send(content='Unlinked {} from "{}" and deleted the "{}" role.'.format(text.mention, voice.name, role.name))
        else:
            await self._delete_role(ctx.guild, role, text, voice, 'Voice unlink requested by {}'.format(ctx.author))
            await ctx.send(content='Unlinked {} from "{}" and deleted the "{}" role.'.format(text.mention, voice.name, role.name))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号