Code Monkey home page Code Monkey logo

Comments (4)

GentleCP avatar GentleCP commented on June 3, 2024 1

我没有用过腾讯云的定时器(看了下文档好像和linux自带的crontab差不多),不过看你的需求应该是在特定时间段发送消息是吧? 这个功能的实现应该有很多选项,例如crontab (定时执行脚本),python的apscheduler (定时任务库) ,这些都可以达到你需要的定时回复任务。这些内容网上有很多教程可以参考。

我个人推荐使用crontab ,你可以先利用corpwechatbot编写好一个python 脚本,例如hello.py (功能是发送你好到企业微信) ,然后我希望每天9: 00 都能定时收到该信息,在linux终端输入crontab -e ,填入如下信息:

0 9 * * * python3 hello.py

from corpwechatbot.

xiyuvi avatar xiyuvi commented on June 3, 2024

谢谢您的指点,请问下个版本可以设置成可以同时配置好几个发送信息,然后随机挑一条发送过去吗

from corpwechatbot.

GentleCP avatar GentleCP commented on June 3, 2024

同时配置好几个消息随机发送,不知道为什么会有这个需求?(想不到使用场景)像接口一次性传入多个消息(例如消息队列),然后逐条发送,这种是会考虑的,但是不知道随机是有什么作用,不过这个问题现在也很好解决,只要你自己设置一个消息列表,例如:

msgs = [
    'hello',
    'world',
    'nice to meet u',
]

然后在发送前你用random函数初始化一个种子,从消息列表中随机取出一条消息(可以通过索引下标也可以直接通过列表随机取元素),用send_xxx()方法发送即可,并不需要专门为这个做开发,希望能解答你的疑惑。

from corpwechatbot.

xiyuvi avatar xiyuvi commented on June 3, 2024

我想搞一个以我家猫的角度定时提醒摸他的提示,所以可能换几个内容比较好一些。我不懂py,谢谢你的思路,我去查文档研究一下

from corpwechatbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.