基于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
Intelligent Trading Bot: Automatically generating signals and trading based on machine learning and feature engineering

Intelligent Trading Bot: Automatically generating signals and trading based on machine learning and feature engineering

Alexandr Savinov 326 Jan 03, 2023
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API

TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API, which provides functiona

Tim Dorssers 233 Dec 30, 2022
A simple language translator with python and google translate api

Language translator with python A simple language translator with python and google translate api Install pip and python 3.9. All the required depende

0 Nov 11, 2021
A python script to extract information from a Microsoft Remote Desktop Web Access (RDWA) application

This python script allow to extract various information from a Microsoft Remote Desktop Web Access (RDWA) application, such as the FQDN of the remote server, the internal AD domain name (from the FQD

Podalirius 60 Dec 09, 2022
Projeto Informações Conta do Instagram - Instagram Account Information Project

VESTA-tools A collection of simple tools that proved to be needed for handling large periodic calculations with the VASP software package. distTotCalc

Thiago Souza 1 Dec 02, 2021
A Tᴇʟᴇɢʀᴀᴍ Vɪᴅᴇᴏ Pʟᴀʏᴇʀ Bᴏᴛ Tᴏ Pʟᴀʏ YT Vɪᴅᴇᴏs & Lɪᴠᴇ Sᴛʀᴇᴀᴍ.

Tuktuky_Music Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram medi

TᑌKTᑌKY ᖇᗩᕼᗰᗩᑎ 3 Sep 14, 2021
Telegram bot to trim and download videos from youtube.

Inline-YouTube-Trim-Bot Telegram bot to trim and download youtube videos Deploy You can deploy this bot anywhere. Demo - YouTubeBot Required Variables

SUBIN 56 Dec 11, 2022
A Python library to access Instagram's private API.

Instagram Private API A Python wrapper for the Instagram private API with no 3rd party dependencies. Supports both the app and web APIs. Overview I wr

2.6k Jan 05, 2023
A unified API wrapper for YouTube and Twitch chat bots.

Chatto A unified API wrapper for YouTube and Twitch chat bots. Contributing Chatto is open to contributions. To find out where to get started, have a

Ethan Henderson 5 Aug 01, 2022
A project that alerts me when there's a dog outside so I can go look at it.

Dog Detector A project that alerts me when there's a dog outside so I can go look at it. Tech Specs This script uses the YOLOv3 object detection model

rydercalmdown 58 Jul 29, 2022
A simple telegram voting bot based on the python-telegram-bot api.

A simple telegram voting bot based on the python-telegram-bot api. *To make it more easy to use, I might make a C++ code in the future so you don't ha

3 Sep 13, 2021
Software com interface gráfica para criar postagens anônimas no Telegra.ph do Telegram e compartilhar onde quiser...

Software com interface gráfica para criar postagens anônimas no Telegra.ph do Telegram e compartilhar onde quiser...

Elizeu Barbosa Abreu 4 Feb 05, 2022
A repo containing toolings and software useful for a DevOps Engineer

DevOps-Tooling A repo containing toolings and software useful for a DevOps Engineer (or if you're setting up your Mac from the beginning) Currently se

Mohamed Abukar 45 Dec 12, 2022
BleachBit system cleaner for Windows and Linux

BleachBit BleachBit cleans files to free disk space and to maintain privacy. Running from source To run BleachBit without installation, unpack the tar

1.9k Jan 06, 2023
discord voice bot to stream radio

Radio-Id Bot (Discord Voice Bot) Radio-id-bot (Radio Indonesia) is a simple Discord Music Bot built with discord.py to play a radio from some Indonesi

Adi Fahmi 20 Sep 20, 2022
Azure DevOps Extension for Azure CLI

Azure DevOps Extension for Azure CLI The Azure DevOps Extension for Azure CLI adds Pipelines, Boards, Repos, Artifacts and DevOps commands to the Azur

1 Nov 03, 2021
A simple, lightweight Discord bot running with only 512 MB memory on Heroku

Haruka This used to be a music bot, but people keep using it for NSFW content. Can't everyone be less horny? Bot commands See the built-in help comman

Haruka 4 Dec 26, 2022
Cool Discord bot for you

BountyBot Баунти – современный бот созданный с целью сделать ваш сервер лучше! В кратце В нем присутствует множество основных и интересных функций, та

Leestarb Original 1 Nov 22, 2021
Easy and simple, Telegram Bot to Show alert when some edits a message in Group

Edit-Message-Alert Just a simple bot to show alert when someone edits a message sent by them, Just 17 Lines of Code These codes are for those who incu

Nuhman Pk 6 Dec 15, 2021
Lending-Club-Loans - Using TensorFlow to create an ANN model to predict whether people would charge off or pay back their loans.

Lending Club Loans: Brief Introduction LendingClub is a US peer-to-peer lending company, headquartered in San Francisco, California.[3] It was the fir

Ali Akram 1 Jan 03, 2022