基于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
An all-in-one financial analytics and smart portfolio creator as a Discord bot!

An all-in-one financial analytics bot to help you gain quantitative financial insights. Finn is a Discord Bot that lets you explore the stock market like you've never before!

6 Jan 12, 2022
Pluggable Telethon - Telegram UserBot

A stable pluggable Telegram userbot, based on Telethon.

Team Ultroid 2.3k Dec 30, 2022
in-progress decompilation of Gauntlet Legends decompression code on the N64

Gauntlet-Legends A in-progress decompilation of Gauntlet-Legends (N64) decompression code. This project currently supports the US release. Building (L

6 Jul 23, 2022
Grade Notifyer Bot

A bot that automatically crawl the submission platform of montefiore to notify the student when a project has been graded.

Julien Gustin 2 Jun 02, 2022
KaydyPurge - Python Purge Script for Discord made by Kaydy Cain#0001

How to Install Open terminal Execute "git clone https://github.com/apolo1337/Kay

apolo 5 Jan 27, 2022
Grape - A webbrowser with its own Search Engine

Grape 🔎 A Web Browser made entirely in python. Search Engine 🔎 Installation: F

Grape 2 Sep 06, 2022
A Discord Server Cloner Which Can Clone Any Discord Server In Just Few Minutes

A Discord Server Cloner Which Can Clone Any Discord Server In Just Few Minutes.

samet 4 Jul 23, 2022
Pydapper - A pure python port of the NuGet library dapper

pydapper A pure python library inspired by the NuGet library dapper. pydapper is

Zach Schumacher 38 Jan 02, 2023
CloudFormation Drift Remediation - Use Cloud Control API to remediate drift that was detected on a CloudFormation stack

CloudFormation Drift Remediation - Use Cloud Control API to remediate drift that was detected on a CloudFormation stack

Cloudar 36 Dec 11, 2022
MassReportBot - Discord Mass Report Bot By Dropout

Discord Mass Report Bot By Dropout Discord Report Bot, Just Re-Made The "Admin R

vanis / 1800 0 Jan 20, 2022
This bot plays the most recent video from the Daily Silksong News Youtube Channel whenever a specific user enters voice chat once a day.

Do you have that one friend that really likes Hollow Knight. Are they waiting for Silksong to come out? Heckle them with this Discord bot.

Tommy Rousey 2 Feb 09, 2022
My homeserver setup. Everything managed securely using Portainer.

homeserver-traefik-portainer Features: access all services with free TLS from letsencrypt using your own domain running a side project is super simple

Tomasz Wójcik 44 Jan 03, 2023
A Python app to serve Conveyor room requests and run approvals through Slack

✨ CONVEYOR FOR SLACK ✨ This is a friendly little Python app that will allow you to integrate your instance of Conveyor with your Slack workspace. In o

Vivienne 4 Sep 27, 2021
A powerful bot to copy your google drive data to your team drive

⚛️ Clonebot - Heroku version ⚡ CloneBot is a telegram bot that allows you to copy folder/team drive to team drives. One of the main advantage of this

MsGsuite 269 Dec 23, 2022
Instagram Account Creator 🥰

Instagram Account Creatorr Instagram account creator that uses requests instead of selenium! Report Bug · Request Feature Features Request based Conta

dropout 9 Oct 27, 2021
🎥 Stream your favorite movie from the terminal!

Stream-Cli stream-cli is a Python scrapping CLI that combine scrapy and webtorrent in one command for streaming movies from your terminal. Installatio

R E D O N E 379 Dec 24, 2022
The best discord.py template with a changeable prefix

Discord.py Bot Template By noma4321#0035 With A Custom Prefix To Every Guild Function Features Has a custom prefix that is changeable for every guild

Noma4321 5 Nov 24, 2022
An API Wrapper for Gofile API

Gofile2 from gofile2 import Gofile g_a = Gofile() print(g_a.upload(file="/home/itz-fork/photo.png")) An API Wrapper for Gofile API. About API Gofile

I'm Not A Bot #Left_TG 16 Dec 10, 2022
Python library for Spurwing API to schedule appointments, manage calendars and custom integrations.

Spurwing API Python Library Lightweight Python library for Spurwing's API. Spurwing's API makes it easy to add robust scheduling and booking to your a

Spurwing 1 Jul 14, 2021
EpikCord.py - This is an API Wrapper for Discord's API for Python

EpikCord.py - This is an API Wrapper for Discord's API for Python! We've decided not to fork discord.py and start completely from scratch for a new, better structuring system!

EpikHost 28 Oct 10, 2022