twitter.py 文件源码

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

项目:Harmonbot 作者: Harmon758 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号