基于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
Unofficial python api for MicroBT Whatsminer ASICs

whatsminer-api Unofficial python api for MicroBT Whatsminer ASICs Code adapted from a python file found in the Whatsminer Telegram group that is credi

Satoshi Anonymoto 16 Dec 23, 2022
A media upload to telegraph module

A media upload to telegraph module

Fayas Noushad 5 Dec 01, 2021
A modern,feature-rich, and async ready API wrapper for Discord written in Python

discord.io A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using asyn

Vincent 18 Jan 02, 2023
Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener or similar.

BTCStealer Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener o

Some Person 6 Jun 07, 2022
Guilherme Matheus 11 Sep 11, 2022
A MassDM selfbot which is working in 2021

mass-dm-discord - Little preview of the Logger and the Spammer Features Logging User IDS Sending DMs to the logged IDs Blacklist IDs (add the ID of th

karma.meme 88 Dec 26, 2022
A modified Sequential and NLP based Bot

A modified Sequential and NLP based Bot I improvised this bot a bit with some implementations as a part of my own hobby project :) Note: I do not own

Jay Desale 2 Jan 07, 2022
Pythonic event-processing library based on decorators

Process Events In Style This library aims to simplify the common pattern of event processing. It simplifies the process of filtering, dispatching and

Nicolas Marier 3 Sep 01, 2022
Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

PyTopia 10 Mar 07, 2022
Bringing Ethereum Virtual Machine to StarkNet at warp speed!

Warp Warp brings EVM compatible languages to StarkNet, making it possible to transpile Ethereum smart contracts to Cairo, and use them on StarkNet. Ta

Nethermind 700 Dec 26, 2022
A Discord Bot created using Pycord!

Hey, I am Slash Bot. A Bot which works with Slash Commands! Prerequisites Python 3+ Check out. the requirements.txt and install all the pakages. Insta

Saumya Patel 1 Nov 29, 2021
:cloud: Python API for ThePirateBay.

Unofficial Python API for ThePirateBay. Build Status Test Coverage Version Downloads (30 days) Installation $ pip install ThePirateBay Note that ThePi

Karan Goel 334 Oct 21, 2022
Instagram - Instagram Account Reporting Tool

Instagram Instagram Account Reporting Tool Installation On Termux $ apt update $

Aryan 6 Nov 18, 2022
Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI

Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI. Used REST and WebSocket API to connect to two of the most popular cry

Francis 8 Sep 15, 2022
An all-purpose Discord bot written in Python featuring a diverse collection of practical utilities.

GlazeGlopBot Table of Contents About Setup Usage Commands Command Errors Cog Management Local Sound Files Cogs Mod QR RNG VC Weather Proposed Features

Edison Ye 0 May 12, 2022
unofficial library for discord components(on development)

discord.py-buttons unofficial library for discord buttons(on development) Install pip install --upgrade discord_buttons Example from discord import Cl

kiki7000 129 Dec 31, 2022
Un bot leggero basato su py-cord facile da hostare sul cloud

GalbiBot Un bot leggero basato su py-cord facile da hostare sul cloud Guida installazione su una macchina Per far funzionare il bot devi aver installa

Galbaninoh 2 Oct 21, 2022
A discord bot thet lets you play Space invaders.

space_Invaders A discord bot thet lets you play Space invaders. It is my first discord bot... so please give any suggestions to improve it :] Commands

2 Dec 30, 2021
PESU Academy Discord Bot built for PESsants and PESts of PES University

PESU Academy Bot PESU Academy Discord Bot built for PESsants and PESts of PES University You can add the bot to your Discord Server using this link. O

Aditeya Baral 0 Nov 16, 2021
all-in-one wrapper for NASA API's

=========== About bowshock is an all-in-one wrapper for NASA API's. Here is a list of currently supported API's : NASA Earth API NASA APOD (Astronomy

Emir Ozer 85 Nov 09, 2022