当前位置: 首页>>代码示例>>Python>>正文


Python Twitter.next_tweet_delay方法代码示例

本文整理汇总了Python中twitter.Twitter.next_tweet_delay方法的典型用法代码示例。如果您正苦于以下问题:Python Twitter.next_tweet_delay方法的具体用法?Python Twitter.next_tweet_delay怎么用?Python Twitter.next_tweet_delay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter.Twitter的用法示例。


在下文中一共展示了Twitter.next_tweet_delay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: NDA

# 需要导入模块: from twitter import Twitter [as 别名]
# 或者: from twitter.Twitter import next_tweet_delay [as 别名]

#.........这里部分代码省略.........
        def send_mail():
            if len(args) < 2:
                return
            to = args[0]
            msg = " ".join(args[1:])
            self.database.mail_send(source_nick, to, msg)
            self.send_message(source_nick, "message sent to %s :)" % to)

        def unsend_mail():
            if len(args) < 1:
                return
            try:
                id = int(args[0])
                success = self.database.mail_unsend(source_nick, id)
                self.send_message(source_nick, "message %i unsent :)" % id if success else "message %i wasn't found :(")
            except ValueError:
                pass

        def outbox():
            messages = self.database.mail_outbox(source_nick)
            if len(messages) == 0:
                self.send_message(source_nick, "no unsent messages")
            else:
                self.send_messages(source_nick, messages)

        def tweet():
            if len(raw_args) > 140:
                self.send_message(reply_target, "tweet too long (%i characters) :(" % len(raw_args))
                return

            if self.twitter.tweet(raw_args):
                self.send_message(reply_target, "sent :)")
            else:
                delay = self.twitter.next_tweet_delay()
                reason = "in %i seconds" % delay if delay > 0 else "now, but something went wrong"
                self.send_message(reply_target, "not sent (next tweet available %s) :(" % reason)

        def su():
            if raw_args == self.admin_password:
                self.admin_sessions[source_nick] = datetime.utcnow()
                self.send_message(source_nick, "you are now authenticated for %i seconds" % self.admin_duration)
            else:
                self.send_message(source_nick, "how about no >:(")

        def die():
            raise KeyboardInterrupt

        def penis():
            link = link_generator.penis_link(self.reddit_consumer_key, self.reddit_consumer_secret)
            self.send_message(reply_target, link if link is not None else "couldn't grab a dick for you, sorry :(")

        def set_time():
            if len(args) > 0:
                self.send_message(reply_target, self.database.set_current_time(source_nick, args[0]))
            else:
                self.send_message(reply_target, "missing utc offset :(")

        def get_time():
            if len(args) > 0:
                self.send_message(reply_target, self.database.current_time(args[0]))
            else:
                self.send_message(reply_target, "missing nick :(")

        def history():
            history_channel = self.get_channel(args[0]) if len(args) > 0 else channel
开发者ID:proog,项目名称:nda,代码行数:69,代码来源:nda.py


注:本文中的twitter.Twitter.next_tweet_delay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。