def listwords(self, ctx: commands.Context, channel: discord.Channel=None):
"""List all words for the specified channel
Optional parameters:
- channel: the channel to show words for (defaults to the current channel)"""
author = ctx.message.author
if not channel:
channel = ctx.message.channel
if author.id not in self.settings or\
"words" not in self.settings[author.id] or\
channel.id not in self.settings[author.id]["words"] or\
not self.settings[author.id]["words"][channel.id]:
await self.bot.say("You haven't set any words to be tracked!")
else:
head = "Tracked words for {}#{} in #{}".format(author.name, author.discriminator, channel.name)
msg = ""
for word in self.settings[author.id]["words"][channel.id]:
msg += "{}\n".format(word)
await self.bot.say(box(msg, lang=head))
评论列表
文章目录