基于nonebot2的twitter推送插件

Overview

HanayoriBot(Twitter插件)

基于NoneBot2的Twitter推送插件,自带百度翻译接口

简介

本插件基于NoneBot2go-cqhttp,可以及时将Twitter用户的最新推文推送至群聊,并且自带基于百度翻译的推文翻译接口,及时跟进你所关注的Vtuber的外网动态。

名字由来:花寄女子寮(Hanayori Joshiryou) 花寄天下第一!!!!!(来自某花寄DD单推人)

  • 鹿乃ちゃん:B站(316381099)
  • 小东人魚Official:B站(441382432)
  • 花丸晴琉Official:B站(441381282)
  • 野野宫のののOfficial:B站(441403698)

特色

  1. 轻依赖:本插件在编写时尽量避免了采用使用第三方包,以减少依赖项
  2. 轻量化:本插件经由4个文件构成,可以快速集成至任何已有的机器人框架
  3. 支持aarch64架构:本插件在树莓派4B上能够正常运行,并且支持安卓平台的termux环境
  4. 强权限管理:本插件在编写时采用了强权限的设计,仅可由超级用户、群主、管理员进行操作
  5. 平行数据库:私聊好友、各群聊拥有独立的数据库,互不干扰

即刻开始

B站视频教程

  1. 前置教程 【【HanayoriBot】十分钟拥有你的群聊 单推(DD)机器人-哔哩哔哩】
  2. Twitter插件教程 待完善

安装NoneBot2

完整文档可以在 这里 查看。

懒得看文档?下面是快速安装指南:

  1. (可选)使用你喜欢的 Python 环境管理工具创建新的虚拟环境。

  2. 使用 pip (或其他) 安装 NoneBot 脚手架。

    pip install nb-cli
  3. 使用脚手架创建项目

    nb create
  4. 请在创建项目时选用cqhttp适配器,并且按照文档完成最小实例的创建

配置文件示例

  1. .env
    ENVIRONMENT=prod
  2. .env.prod
    HOST=127.0.0.1
    PORT=8080
    SECRET=
    ACCESS_TOKEN=
    SUPERUSERS=[超级用户账户(你的QQ号,不是机器人的账户)]
    COMMAND_START=["","/"]
    NICKNAME=["","/"]
    COMMAND_SEP=["."]
  3. 请务必安装以上示例配置你的Bot;go-cqhttp请自行参照官方文档配置

安装HanayoriBot(Twitter插件)

  1. pip安装
pip install nonebot-plugin-twitter

请在你的bot.py文件中加入以下内容

nonebot.load_plugin("nonebot_plugin_twitter")#添加此行
nonebot.load_from_toml("pyproject.toml")#位于本行前
  1. 使用nb-cli安装(推荐)

在你的Bot目录下执行:

nb plugin install nonebot_plugin_twitter

配置HanayoriBot(Twitter插件)

如果您的服务器位于境外,请忽略以下内容

  1. 首先确保你的代理软件支持http代理模式,并且已经开启,不推荐启用全局代理模式
  2. 明确你的代理端口号,请咨询你的代理服务提供商
  3. 根据平台不同,请按照以下方式分别设置代理:
    1. Windows平台 cmd环境
    set http_proxy=http://127.0.0.1:端口号  
    set https_proxy=http://127.0.0.1:端口号  
    1. windows平台 PowerShell环境
    $env:HTTP_PROXY="127.0.0.1:端口号"  
    $env:HTTP_PROXY="127.0.0.1:端口号" 
    1. Linux平台 Bash环境
    export http_proxy=http://127.0.0.1:端口号 
    export https_proxy=http://127.0.0.1:端口号 
  4. 在按照3设置代理后,请不要关闭终端,在当前终端执行nb run才能使机器人连上代理(请提前运行go-cqhttp) 注意:go-cqhttp也必须运行于代理环境中,保证能连接外网,否则无法发送图片!!!
  5. 在机器人成功运行后,会在机器人根目录会生成baidu_translate.json文件,若你不需要推文翻译功能,请忽略下一步
  6. 用文本编辑器打开baidu_translate.json
    {"appid": "填入你申请的百度翻译API的appid", "baidu_token": "填入你申请的百度翻译API的密钥"}
    按以上要求填写,申请可去百度翻译开放平台,申请通用翻译API即可

指令说明

以下所以指令在群聊中只允许超级用户(主人)、群主、管理员进行操作,私聊中不受限制 在群聊中使用格式:@机器人 指令 推特ID(如果指令要求的话) 在私聊中使用格式:指令 推特ID(如果指令要求的话) 推特ID:在Twitter的用户主页,@后面的部分;或者‘https://twitter.com/xxxxx’ 用户主页链接中的xxxxx 所有指令如下:

  1. 推特关注 推特ID 添加新用户
  2. 推特取关 推特ID 取关用户
  3. 推特列表 显示当前关注列表
  4. 开启翻译 推特ID 开启推文翻译
  5. 关闭翻译 推特ID 关闭推文翻译
  6. 帮助 顾名思义

遇到问题?

你可以直接提交issue,或者发送邮件到:[email protected]

效果展示

效果1

效果2

Owner
鹿乃まほろ / Mahoro Kano
考研生,待业青年
鹿乃まほろ / Mahoro Kano
Twitter for Python!

Tweepy: Twitter for Python! Installation The easiest way to install the latest version from PyPI is by using pip: pip install tweepy You can also use

9.4k Jan 07, 2023
A listener for RF >= 4.0 that prints a Stack Trace to console to faster find the code section where the failure appears.

robotframework-stacktrace A listener for RF = 4.0 that prints a Stack Trace to console to faster find the code section where the failure appears. Ins

marketsquare 16 Nov 24, 2022
Scheduled Block Checker for Cardano Stakepool Operators

ScheduledBlocks Scheduled Block Checker for Cardano Stakepool Operators Lightweight and Portable Scheduled Blocks Checker for Current Epoch. No cardan

SNAKE (Cardano Stakepool) 4 Oct 18, 2022
Async boto3 with Autogenerated Data Classes

awspydk Async boto3 with Autogenerated JIT Data Classes Motivation This library is forked from an internal project that works with a lot of backend AW

1 Dec 05, 2021
A Flask & Twilio Secret Santa app.

🎄 ✨ Secret Santa Twilio ✨ 📱 A contactless Secret Santa game built with Python, Flask and Twilio! Prerequisites 📝 A Twilio account. Sign up here ngr

Sangeeta Jadoonanan 5 Dec 23, 2021
The Best Telegram UserBot Made With Pyrogram [Python]

Asterix UserBot A Powerful Telegram userbot based on Pyrogram. How To Deploy Asterix Heroku Railway Qovery Termux Tutorial Railway Deploy Comming Soon

TeamAsterix 9 Oct 17, 2022
Previewer for VapourSynth scripts.

Standalone previewer for VapourSynth scripts Fork of Endilll's vapoursynth-preview (not maintained anymore) This program is meant to be paired with a

Irrational Encoding Wizardry 26 Dec 16, 2022
A simple chat api that can also work with ipb4 and chatbox+

SimpleChatApi API for chatting that can work on its own or work with Invision Community and Chatbox+. You are also welcome to create frontend for this

Anubhav K. 1 Feb 01, 2022
Python version of PlaceNL's headless bot with automatic access token refresh

Reddit /r/place 2022 headless bot This headless Python bot will automatically login to reddit, obtain access tokens (and refreshes them when they expi

19 May 21, 2022
Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation

secp256k1 Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation Example Usage import secp256k1 as ice print('[C]',privatekey_to_addres

iceland 49 Jan 01, 2023
Pluggable Telethon - Telegram UserBot

A stable pluggable Telegram userbot, based on Telethon.

Team Ultroid 2.3k Dec 30, 2022
阿里云盘上传脚本

阿里云盘上传脚本 Author:李小恩 Github:https://github.com/Hidove/aliyundrive-uploader 如有侵权,请联系我删除 禁止用于非法用途,违者后果自负 环境要求 python3 使用方法 安装 git clone https://github.co

Hidove 301 Jan 01, 2023
WakeNote is a tool that hides notifications from you until you confirm you want to read them, with technology to help prevent the reading of depressing messages first thing in the morning.

By: Seanpm2001, Et; Al. Top README.md Read this article in a different language Sorted by: A-Z Sorting options unavailable ( af Afrikaans Afrikaans |

Sean P. Myrick V19.1.7.2 3 Oct 21, 2022
Auto like & auto followers facebook

Auto like & auto followers facebook

Fahmi Dev 23 Dec 08, 2022
This is new discord nitro generator for discord

Hello! This is new discord nitro generator for discord. If you want use it, To generator i added checker for no seraching generator and checker. This tool maked by .

ItzBolt 1 Jan 16, 2022
A basic implementation of the Battlesnake API in Python

Getting started with Battlesnake and Python This is a basic implementation of the Battlesnake API in Python. It's a great starting point for anyone wa

Gaurav Batra 2 Dec 08, 2021
The official Magenta Voice Skill SDK used to develop skills for the Magenta Voice Assistant using Voice Platform!

Magenta Voice Skill SDK Development • Support • Contribute • Contributors • Licensing Magenta Voice Skill SDK for Python is a package that assists in

Telekom Open Source Software 18 Nov 19, 2022
Send alert to telegram use telegram cli

Run standalone: Rename conf.yml.example to conf.yml Change block cli(Add your api_id and hash) Install requirements.txt Run python AlertManagerTG.py I

Eugene Arkharov 1 Nov 12, 2021
scrapes medias, likes, followers, tags and all metadata. Inspired by instagram-php-scraper,bot

instagram_scraper This is a minimalistic Instagram scraper written in Python. It can fetch media, accounts, videos, comments etc. `Comment` and `Like`

sirjoe 2.5k Nov 16, 2022
Project glow is an open source bot worked on by many people to create a good and safe moderation bot for all

Project Glow Greetings, I see you have stumbled upon project glow. Project glow is an open source bot worked on by many people to create a good and sa

Glowstikk 24 Sep 29, 2022