def link(self, ctx, text: discord.TextChannel, *, voice: discord.VoiceChannel):
"""Links an existing text channel to a voice channel."""
with ctx.session:
link = ctx.session.get(TextVoiceLink, text_id=text.id, voice_id=voice.id).one_or_none()
if link is not None:
return await ctx.send('BAKA! Those channels are already linked!')
role = await self._create_role(ctx.guild, text, voice, 'Voice link requested by {}'.format(ctx.author))
link = ctx.session.add(TextVoiceLink(role_id=role.id, text_id=text.id, voice_id=voice.id))
await ctx.send(content='Linked {} to "{}"'.format(text.mention, voice.name))
评论列表
文章目录