def twitter_remove(self, ctx, handle : str):
'''
Remove a Twitter handle from a text channel
A delay of up to 2 min. is possible due to Twitter rate limits
'''
try:
self.feeds_info["channels"].get(ctx.message.channel.id, {}).get("handles", []).remove(handle)
except ValueError:
await self.bot.embed_reply(":no_entry: This text channel isn't following that Twitter handle")
else:
with open("data/twitter_feeds.json", 'w') as feeds_file:
json.dump(self.feeds_info, feeds_file, indent = 4)
message, embed = await self.bot.embed_reply(":hourglass: Please wait")
await self.stream_listener.remove_feed(ctx.message.channel, handle)
embed.description = "Removed the Twitter handle, [`{0}`](https://twitter.com/{0}), from this text channel.".format(handle)
await self.bot.edit_message(message, embed = embed)
评论列表
文章目录