cscs181 / qq-github-bot Goto Github PK
View Code? Open in Web Editor NEWGitHub Bot for QQ
License: MIT License
GitHub Bot for QQ
License: MIT License
Use official Primer css and html instead
Docker Hub
or ghcr
to pull pre-built image.env.prod
docker-compose up -d
No Need to build docker image on local machine any more!!
Github Action will do it for you
如
PPP
DDD
希望显示全部展开后的样子
data_source.py中函数
def disk_usage(): disk_parts = psutil.disk_partitions() for d in disk_parts: return {d.mountpoint: psutil.disk_usage(d.mountpoint)}
上面是我改完之后,原函数运行报错,因为遍历到最后一个 光驱会说无法访问,然后崩溃
pull_request.head.repo
is None in rendering nonebot/nonebot2#1
戳一戳在一些旧版设备上无法使用, 使用这些协议的bot不能触发
如题,提供类似教程会适当增大机器人的应用范围并降低部分情况下的部署难度
俩个数据库均已配置好,成功连上了.
bot正常跑起来了,使用/auth
跳转到 github
再跳转回来的时候报错
08-08 01:49:07 [INFO] uvicorn | 127.0.0.1:43930 - "GET /github/auth?code=ea025bbac5e9efd12693&state=65fddb1a2e164f71b0e679acc7e184c0 HTTP/1.0" 500
08-08 01:49:07 [ERROR] uvicorn | Exception in ASGI application
Traceback (most recent call last):
File "/bot/.venv/lib/python3.10/site-packages/tortoise/backends/asyncpg/client.py", line 82, in _translate_exceptions
return await func(self, *args, **kwargs)
File "/bot/.venv/lib/python3.10/site-packages/tortoise/backends/asyncpg/client.py", line 143, in execute_query
rows = await connection.fetch(*params)
File "/bot/.venv/lib/python3.10/site-packages/asyncpg/connection.py", line 620, in fetch
return await self._execute(
File "/bot/.venv/lib/python3.10/site-packages/asyncpg/connection.py", line 1659, in _execute
result, _ = await self.__execute(
File "/bot/.venv/lib/python3.10/site-packages/asyncpg/connection.py", line 1684, in __execute
return await self._do_execute(
File "/bot/.venv/lib/python3.10/site-packages/asyncpg/connection.py", line 1711, in _do_execute
stmt = await self._get_statement(
File "/bot/.venv/lib/python3.10/site-packages/asyncpg/connection.py", line 397, in _get_statement
statement = await self._protocol.prepare(
File "asyncpg/protocol/protocol.pyx", line 168, in prepare
return await waiter
asyncpg.exceptions.UndefinedTableError: 关系 "user" 不存在
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/bot/bot.py", line 39, in <module>
nonebot.run(app="__mp_main__:app")
File "/bot/.venv/lib/python3.10/site-packages/nonebot/__init__.py", line 309, in run
get_driver().run(*args, **kwargs)
File "/bot/.venv/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 198, in run
uvicorn.run(
File "/bot/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 578, in run
server.run()
File "/bot/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
> File "/bot/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/bot/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "/bot/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 284, in __call__
await super().__call__(scope, receive, send)
File "/bot/.venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/bot/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/bot/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/bot/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/bot/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/bot/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "/bot/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "/bot/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/bot/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/bot/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/bot/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 241, in app
raw_response = await run_endpoint_function(
File "/bot/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 167, in run_endpoint_function
return await dependant.call(**values)
File "/bot/src/plugins/github/apis/auth.py", line 51, in auth
await delete_state_data(state)
File "/bot/src/plugins/github/libs/auth.py", line 45, in create_auth_user
return await create_or_update_user(info, access_token=access_token)
File "/bot/src/plugins/github/libs/platform/user_crud.py", line 41, in create_or_update_user
user, _ = await User.update_or_create(
File "/bot/.venv/lib/python3.10/site-packages/tortoise/models.py", line 1105, in update_or_create
instance = await cls.select_for_update().using_db(connection).get_or_none(**kwargs)
File "/bot/.venv/lib/python3.10/site-packages/tortoise/queryset.py", line 1006, in _execute
instance_list = await self._db.executor_class(
File "/bot/.venv/lib/python3.10/site-packages/tortoise/backends/base/executor.py", line 130, in execute_select
_, raw_results = await self.db.execute_query(query.get_sql())
File "/bot/.venv/lib/python3.10/site-packages/tortoise/backends/base_postgres/client.py", line 34, in _translate_exceptions
return await self._translate_exceptions(func, *args, **kwargs)
File "/bot/.venv/lib/python3.10/site-packages/tortoise/backends/asyncpg/client.py", line 84, in _translate_exceptions
raise OperationalError(exc)
tortoise.exceptions.OperationalError: 关系 "user" 不存在
k8s pvc strategy改为Retain
,并且添加selector
https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged
using github pulls api: /repos/{owner}/{repo}/pulls/{pull_number}/merge
Response if pull request has been merged: Status: 204 No Content
Not Found if pull request has not been merged: Status: 404 Not Found
data_source.py中函数
def disk_usage():
disk_parts = psutil.disk_partitions()
for d in disk_parts:
return {d.mountpoint: psutil.disk_usage(d.mountpoint)}
上面是我改完之后,原函数运行报错,因为遍历到最后一个 光驱会说无法访问,然后崩溃
希望能够支持对于多核服务器能分别显示每个核的利用率
throttled event:
debounced event:
event cache key should consider the backport model
如题
在多worker负载均衡的时候,会出现session不同步,是由于nb的matchers不同步导致的,可能需要同步matchers。
(WIP) Generate code from GitHub spec, build some toolkit like octokit.
reference: https://github.com/github/rest-api-description
Done in https://github.com/yanyongyu/githubkit
reference: https://github.com/octokit/graphql-schema
Done in https://github.com/yanyongyu/githubkit
reference: https://github.com/octokit/webhooks
Done in https://github.com/yanyongyu/githubkit
wrap the githubkit core and webhook definition
types:
marked_as_duplicate
: https://github.com/nonebot/nb-cli/issues/78
unmarked_as_duplicate
: ...subscribed
: ignoreauto_squash_enabled
: https://github.com/he0119/nonebot-plugin-treehelp/pull/22
auto_merge_disabled
: https://github.com/he0119/CoolQBot/pull/286
unsubscribed
: ignoreuser_blocked
: https://github.com/mamoe/mirai/issues/850
Using Jinja2 templates without autoescaping enabled leaves application vulnerable to [XSS attacks](https://owasp.org/www-project-top-ten/2017/A72017-Cross-SiteScripting_(XSS).
Autoescaping is the concept of automatically escaping special characters. Special characters for HTML, XML and XHTMl are &, >, <, " as well as '. These characters carry specific meanings so need to be replaced by so called entities if you want to use them for text. Not doing so makes application susceptible to Cross Site Scripting (XSS) attacks.
When configuring the Jinja2 environment, the option to use autoescaping on input can be specified. By default, autoescaping is disabled. When enabled, Jinja2 will filter input strings to escape any HTML content submitted via template variables.
QQ-GitHub-Bot/src/plugins/nonebot_plugin_status/__init__.py
Lines 54 to 56 in 2fcc039
上下文错误,要使用user token
QQ-GitHub-Bot/src/plugins/github/plugins/github_subscribe/__init__.py
Lines 165 to 178 in 2fba9b1
config.env
is string not Env
pr review avatar not rounded
Example pr: https://github.com/python/cpython/pull/102539
.env
里漏了一项
Doc: https://docs.github.com/en/rest/reference/issues#list-timeline-events-for-an-issue
API: api.github.com/{owner}/{repo}/issues/{issue_number}/timeline
Header:
- Accept
: application/vnd.github.mockingbird-preview.full+json
rollback to callable to get a new context
cqgttp适配器名已修改,原为 nonebot-adapter-cqhttp,现为 nonebot-adapter-onebot
系统: Ubuntu 20.04
Docker: 24.06
镜像版本: 2.1.3
使用QQ频道通信
Logs:
2023-12-30T09:58:38.956795128Z 12-30 17:58:38 [SUCCESS] nonebot | QQ 102082715 | [EventType.DIRECT_MESSAGE_CREATE]: Message 088dddabb296f6f2b3950110d690fddbaabb8fa501380948cdd3bfac06 from MagicMC: [Text(type='text', data={'text': '/install'})]
2023-12-30T09:58:39.019977508Z 12-30 17:58:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.github.plugins.github_install, lineno=37)
2023-12-30T09:58:39.920385349Z 12-30 17:58:39 [INFO] httpx | HTTP Request: POST https://api.sgroup.qq.com/dms/10765797397038296717/messages "HTTP/1.1 403 Forbidden"
2023-12-30T09:58:39.923047283Z 12-30 17:58:39 [INFO] nonebot | Matcher(type='message', module=src.plugins.github.plugins.github_install, lineno=37) running complete
2023-12-30T09:58:39.931981383Z 12-30 17:58:39 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.github.plugins.github_install, lineno=37) failed.
2023-12-30T09:58:39.932076415Z Traceback (most recent call last):
2023-12-30T09:58:39.932093864Z File "/usr/local/bin/gunicorn", line 8, in <module>
2023-12-30T09:58:39.932103717Z sys.exit(run())
2023-12-30T09:58:39.932111144Z File "/usr/local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
2023-12-30T09:58:39.932119098Z WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2023-12-30T09:58:39.932129361Z File "/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py", line 236, in run
2023-12-30T09:58:39.932153631Z super().run()
2023-12-30T09:58:39.932170036Z File "/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py", line 72, in run
2023-12-30T09:58:39.932185631Z Arbiter(self).run()
2023-12-30T09:58:39.932199523Z File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 202, in run
2023-12-30T09:58:39.932215524Z self.manage_workers()
2023-12-30T09:58:39.932230367Z File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 571, in manage_workers
2023-12-30T09:58:39.932247813Z self.spawn_workers()
2023-12-30T09:58:39.932263172Z File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 642, in spawn_workers
2023-12-30T09:58:39.932278141Z self.spawn_worker()
2023-12-30T09:58:39.932303200Z File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
2023-12-30T09:58:39.932319608Z worker.init_process()
2023-12-30T09:58:39.932336097Z File "/usr/local/lib/python3.11/site-packages/uvicorn/workers.py", line 66, in init_process
2023-12-30T09:58:39.932351121Z super(UvicornWorker, self).init_process()
2023-12-30T09:58:39.932367581Z File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 142, in init_process
2023-12-30T09:58:39.932385362Z self.run()
2023-12-30T09:58:39.932400593Z File "/usr/local/lib/python3.11/site-packages/uvicorn/workers.py", line 98, in run
2023-12-30T09:58:39.932420064Z return asyncio.run(self._serve())
2023-12-30T09:58:39.932437696Z File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
2023-12-30T09:58:39.932454602Z return runner.run(main)
2023-12-30T09:58:39.932521127Z File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
2023-12-30T09:58:39.932542386Z return self._loop.run_until_complete(task)
2023-12-30T09:58:39.932558530Z File "/usr/local/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
2023-12-30T09:58:39.932575874Z await _run_matcher(
2023-12-30T09:58:39.932591526Z > File "/usr/local/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher
2023-12-30T09:58:39.932606992Z await matcher.run(bot, event, state, stack, dependency_cache)
2023-12-30T09:58:39.932627420Z File "/usr/local/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 846, in run
2023-12-30T09:58:39.932644263Z await self.simple_run(bot, event, state, stack, dependency_cache)
2023-12-30T09:58:39.932660305Z File "/usr/local/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 821, in simple_run
2023-12-30T09:58:39.932677432Z await handler(
2023-12-30T09:58:39.932697690Z File "/usr/local/lib/python3.11/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
2023-12-30T09:58:39.932714301Z return await cast(Callable[..., Awaitable[R]], self.call)(**values)
2023-12-30T09:58:39.932729890Z File "/app/src/plugins/github/plugins/github_install/__init__.py", line 53, in handle_private
2023-12-30T09:58:39.932745555Z await install.finish(
2023-12-30T09:58:39.932760900Z File "/usr/local/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 570, in finish
2023-12-30T09:58:39.932777184Z await cls.send(message, **kwargs)
2023-12-30T09:58:39.932791878Z File "/usr/local/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 554, in send
2023-12-30T09:58:39.932808436Z return await bot.send(event=event, message=_message, **kwargs)
2023-12-30T09:58:39.932823136Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 481, in send
2023-12-30T09:58:39.932837900Z return await self.send_to_dms(
2023-12-30T09:58:39.932854974Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 347, in send_to_dms
2023-12-30T09:58:39.932881943Z return await self.post_dms_messages(
2023-12-30T09:58:39.932992317Z File "/usr/local/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 123, in call_api
2023-12-30T09:58:39.933225580Z raise exception
2023-12-30T09:58:39.933378034Z File "/usr/local/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 98, in call_api
2023-12-30T09:58:39.933526954Z result = await self.adapter._call_api(self, api, **data)
2023-12-30T09:58:39.933701966Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/adapter.py", line 416, in _call_api
2023-12-30T09:58:39.933798252Z return await api_handler(bot, **data)
2023-12-30T09:58:39.933996039Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/utils.py", line 64, in __call__
2023-12-30T09:58:39.934185685Z return await self.func(inst, *args, **kwds)
2023-12-30T09:58:39.934314738Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 1079, in post_dms_messages
2023-12-30T09:58:39.934479042Z return parse_obj_as(GuildMessage, await self._request(request))
2023-12-30T09:58:39.934677957Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 549, in _request
2023-12-30T09:58:39.934921948Z return self._handle_response(response)
2023-12-30T09:58:39.935065234Z File "/usr/local/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 538, in _handle_response
2023-12-30T09:58:39.935214018Z raise ActionFailed(response)
2023-12-30T09:58:39.935346662Z nonebot.adapters.qq.exception.ActionFailed: <ActionFailed: 403, code=304003, message=url not allowed, trace_id=0868b2b9dae353cd4188faf30f332625>
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.