ailitonia / omega-miya Goto Github PK
View Code? Open in Web Editor NEW基于 nonebot2 的多平台机器人
License: MIT License
基于 nonebot2 的多平台机器人
License: MIT License
主要图片比较多,容易刷屏,没在聊天的时候还好,如果是在聊天,就很影响
而且专辑内容比较和谐,应该不太会被风控
重构经过数次功能调整后代码结构宛若脑瘫的B站直播及动态推送插件
nonebot2_miya/omega_miya/plugins/omega_sign_in/utils.py 第335行,应为file://
很多几千张几万张的,把我人都看傻了
其实我自己做了,不过做的比较糙,在nonebot2_miya/omega_miya/utils/Omega_plugin_utils/rules.py中添加
from nonebot.adapters.cqhttp import MessageEvent
def has_flash_permission() -> Rule:
async def _has_flash_permission(bot: Bot, event: MessageEvent, state: T_State) -> bool:
msg = str(event.get_message())
# 检查当前消息类型
if 'type=flash,' in msg:
return True
else:
return False
return Rule(_has_flash_permission)
就能检测闪照了
顺便吐槽一句,github的代码块功能真烂
订阅画师作品更新
因画师作品内容不定,将不与萌图插件共用pixiv_illust表
教程好简略啊,数据库配置直接给我整蒙了,看不懂
/usr/local/lib/python3.9/dist-packages/apscheduler/triggers/cron/init.py:159: PytzUsageWarning: The localize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
return self.timezone.localize(datetime(**values))
/usr/local/lib/python3.9/dist-packages/apscheduler/triggers/cron/init.py:146: PytzUsageWarning: The normalize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
return self.timezone.normalize(dateval + difference), fieldnum
/usr/local/lib/python3.9/dist-packages/apscheduler/util.py:95: PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
if obj.zone == 'local':
前置条件已达成, 开始适配工作
订阅推特更新
目前Subscription表sub_id字段为int,为满足之后可能更多的订阅类型的需要,计划将该字段调整为str类型,并对其他相关字段进行优化,数据表结构将不可避免地再进行一次调整QAQ
原因不明
数据库初始化失败, error: InternalError("(pymysql.err.InternalError) (1071, 'Specified key was too long; max key length is 767 bytes')")
Traceback (most recent call last):
File "/www/workplace/omega-miya/omega_miya/utils/Omega_Base/database.py", line 45, in database_init
await conn.run_sync(Base.metadata.create_all)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/ext/asyncio/engine.py", line 472, in run_sync
return await greenlet_spawn(fn, conn, *arg, **kw)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 120, in greenlet_spawn
result = context.throw(*sys.exc_info())
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/schema.py", line 4744, in create_all
bind._run_ddl_visitor(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2081, in _run_ddl_visitor
visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 485, in traverse_single
return meth(obj, **kw)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 846, in visit_metadata
self.traverse_single(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 485, in traverse_single
return meth(obj, **kw)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 902, in visit_table
self.traverse_single(index, create_ok=True)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 485, in traverse_single
return meth(obj, **kw)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 933, in visit_index
self.connection.execute(CreateIndex(index))
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/future/engine.py", line 280, in execute
return self._execute_20(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1582, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 77, in _execute_on_connection
return connection._execute_ddl(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1352, in _execute_ddl
ret = self._execute_context(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1813, in _execute_context
self._handle_dbapi_exception(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1994, in _handle_dbapi_exception
util.raise_(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1770, in _execute_context
self.dialect.do_execute(
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/dialects/mysql/aiomysql.py", line 95, in execute
return self.await_(self._execute_async(operation, parameters))
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 62, in await_only
return current.driver.switch(awaitable)
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 115, in greenlet_spawn
value = await result
File "/usr/local/python3/lib/python3.9/site-packages/sqlalchemy/dialects/mysql/aiomysql.py", line 107, in _execute_async
result = await self._cursor.execute(operation, parameters)
File "/usr/local/python3/lib/python3.9/site-packages/aiomysql/cursors.py", line 239, in execute
await self._query(query)
File "/usr/local/python3/lib/python3.9/site-packages/aiomysql/cursors.py", line 457, in _query
await conn.query(q)
File "/usr/local/python3/lib/python3.9/site-packages/aiomysql/connection.py", line 428, in query
await self._read_query_result(unbuffered=unbuffered)
File "/usr/local/python3/lib/python3.9/site-packages/aiomysql/connection.py", line 622, in _read_query_result
await result.read()
File "/usr/local/python3/lib/python3.9/site-packages/aiomysql/connection.py", line 1105, in read
first_packet = await self.connection._read_packet()
File "/usr/local/python3/lib/python3.9/site-packages/aiomysql/connection.py", line 593, in _read_packet
packet.check_error()
File "/usr/local/python3/lib/python3.9/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/python3/lib/python3.9/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1071, 'Specified key was too long; max key length is 767 bytes')
[SQL: CREATE UNIQUE INDEX ix_omega_pixiv_tag_tagname ON omega_pixiv_tag (tagname)]
(Background on this error at: http://sqlalche.me/e/14/2j85)
升级SQLAlchemy到1.4
数据库操作全部重构为异步版本
https://www.baidu.com/s?ie=UTF-8&wd=vocation
Did you mean: vacation?
疑问:
1.来点萌图 / 来点涩图这个功能是要自己导入图片吗?使用/来点萌图
都会提示找不到萌图QAQ
(机器人已部署在外网)
建议:
1.能否增加油管订阅
2.能否增加推特订阅
3.能否增加嘴臭功能
4.抽卡功能增加PCR和原神
.replace("i.pximg.net", "i.pixiv.cat")
试了下,感觉下载速度快了不少,也不用加header了
我自己写了一些ghs的插件,发的内容都比较那啥
我想起之前在tg的时候,那边很多机器人都是发完一段时间后自动撤回
这个框架能做自动撤回吗
突然想到的
没配置超级用户的qq号无法使用命令吗?另外问一下机器人是在国内服务器挂的,http代理应该怎么搞?难道装个v2ray吗?
启动时会报错def __get_level(favorability: float) -> tuple[int, int, int]: 的 'type' object is not subscriptable
但我删掉-> tuple[int, int, int]就能正常使用 能知道是什么原因吗
此处roll不是类似"d6"吗,直接int会不会报错(
包含 youtube 用户、频道、直播订阅功能
readme里python要求是3.8+,已安装的python版本是3.8.10,使用抽卡时报错
TypeError: sample() got an unexpected keyword argument 'counts'
发现使用的random.sample()的参数counts不支持,查询python文档后发现在3.9才添加的counts参数random.sample,更换到python3.9.5后可以正常使用了。
插件管理
可单独启用/停用插件
添加多协议端支持
数据库表结构大改,预计不能支持旧版本直接升级或迁移
灵感来自于https://github.com/pcrbot/whattoeat
我感觉他做的不够详细,可以把食物细分为早上,中午,晚上,夜宵等
发对应的命令,出对应类型的图片
因为我没有配置b站的东西,所以一直看到提示获取b站直播信息失败,由此想到的,可以加个插件开关的功能
刚才看群友聊天说为了防和谐,有人用发作业的形式发涩图
然后忽然想起之防和谐做的发送前添加噪点,用了几个星期,效果还行,r18的都不会和谐掉
import cv2
import numpy as np
def random_noise(image):
'''
添加随机噪点(实际上就是随机在图像上将像素点的灰度值变为255即白色)
:param image: 需要加噪的图片途径
:param noise_num: 添加的噪音点数目,几个就行
:return: img_noise
'''
#
noise_num = random.randint(1, 10)
# 参数image:,noise_num:
img = cv2.imread(image)
img_noise = img
# cv2.imshow("src", img)
rows, cols, chn = img_noise.shape
# 加噪声
for i in range(noise_num):
x = np.random.randint(0, rows) # 随机生成指定范围的整数
y = np.random.randint(0, cols)
img_noise[x, y, :] = 255
cv2.imwrite(image, img_noise)
这个项目能和go-cqhttp搭配使用吗...如果能的话go-cqhttp端要怎么配置通信方式呢
群友有时候莫名用一些很不舒服的图片刷屏,想给自动撤回
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.