Skip to main content

NoneBot2插件 - 获取Hacker News文章并进行播报

Project description

nonebot-plugin-hacker-news

获取 Hacker News 热门文章的Nonebot插件, 支持获取热门、最新、最佳文章以及文章详情和评论

安装

通过 pip 安装

pip install nonebot-plugin-hacker-news

通过 nb-cli 安装

nb plugin install nonebot-plugin-hacker-news

基本命令

/hn:获取Hacker News热门文章,默认获取前5条
/hn top [数量]:获取热门文章,默认5条
/hn new [数量]:获取最新文章,默认5条
/hn best [数量]:获取最佳文章,默认5条
/hn item [ID]:获取特定文章详情
/hn comments [ID]:获取特定文章及其评论

定时播报控制

/hn_broadcast on:开启定时播报功能
/hn_broadcast off:关闭定时播报功能
/hn_broadcast status:查看定时播报状态
/hn_broadcast mode [interval|cron]:设置播报模式(间隔或定时)
/hn_broadcast interval [秒数]:设置播报间隔(最小60秒)
/hn_broadcast cron [表达式]:设置每天固定时间播报,格式为"分 时 日 月 星期"

配置

hn_api_base_url = "https://hacker-news.firebaseio.com/v0"
hn_api_timeout = 10  # 请求超时时间,单位秒

hn_auto_broadcast = False  # 是否开启定时播报
hn_broadcast_mode = "interval"  # "interval"为间隔模式,"cron"为定时模式
hn_broadcast_interval = 3600  # 定时播报间隔,单位秒(interval模式)
hn_broadcast_cron = "0 8 * * *"  # cron表达式,默认每天早上八点(cron模式)
hn_max_comments_depth = 3  # 获取评论的最大深度
hn_max_items_per_request = 10  # 单次请求最大获取条数
hn_broadcast_groups = [123456789]  # 定时播报群组列表
hn_broadcast_articles_count = 5  # 每次播报的文章数量

依赖

  • Python 3.8+
  • nonebot2 >= 2.0.0rc3
  • nonebot-adapter-onebot >= 2.2.1
  • httpx >= 0.24.0
  • nonebot_plugin_apscheduler (用于定时播报功能)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_hacker_news-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_hacker_news-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_hacker_news-0.1.1.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_hacker_news-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0936d065e64bbbb328e7e62f2db030f93a771de33a07db506415fbc408124b8f
MD5 52dcfe69d78b8eed18251c77ce20d318
BLAKE2b-256 88e215e2a9cf9125801b252aec5c9f14dadc7979a32042f41508a968b0a4ca05

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_hacker_news-0.1.1.tar.gz:

Publisher: python-publish.yml on perfsakuya/nonebot-plugin-hacker-news

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nonebot_plugin_hacker_news-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_hacker_news-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa8a2446bc13b36faf3ef0d3bc340d50eab46f935d81179f928015e64cf5fb72
MD5 3b2be8f58445af9f1d79f612ff955b56
BLAKE2b-256 25d72698f7aef6c72a34773113da60ea2e72542477e98eaf7839996a64bd892e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_hacker_news-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on perfsakuya/nonebot-plugin-hacker-news

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page