This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aab1eaa
Showing
10 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-eossystem: pip | ||
directory: / | ||
schedule: | ||
interval: daliy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: build CI | ||
|
||
on: | ||
push: | ||
branches: master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows,macos,ubuntu] | ||
runs-on: ${{matrix.os}}-latest | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies(for linux) | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install python-tk | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Build | ||
run: pyinstaller -F -w --hidden-import=PIL._tkinter_finder --additional-hooks-dir=hooks main.py -n vcbot-bili | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-${{matrix.os}} | ||
path: ./dist/vcbot-bili |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__pycache__ | ||
.env | ||
build | ||
dist | ||
*.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// 使用 IntelliSense 了解相关属性。 | ||
// 悬停以查看现有属性的描述。 | ||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python 调试程序: 当前文件", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"program": "main.py", | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
Copyright (c) 2024 luyanci | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE | ||
OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from PyInstaller.utils.hooks import collect_data_files | ||
|
||
datas = collect_data_files("bilibili_api") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from bilibili_api import Credential,live,Danmaku,sync | ||
from bilibili_api.live import LiveDanmaku,LiveRoom | ||
|
||
def set(room:int,credential:Credential): | ||
global LiveDanma | ||
LiveDanma = LiveDanmaku(room_display_id=room,credential=credential) | ||
global liveroom | ||
liveroom = LiveRoom(room_display_id=room,credential=credential) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import tkinter as tk | ||
from bilibili_api import Credential,login,user | ||
from dotenv import load_dotenv | ||
|
||
def user_login(): | ||
a = login.login_with_qrcode(tk.Tk()) | ||
return a | ||
|
||
async def user_info(uid:int,Credential: Credential): | ||
u = user.User(uid=uid,credential=Credential) | ||
info = await u.get_user_info() | ||
return info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
import json | ||
from lib import user,live | ||
from bilibili_api import sync | ||
from dotenv import load_dotenv | ||
roomid = "roomid" | ||
def login(): | ||
global c | ||
c = user.user_login() | ||
try: | ||
c.raise_for_no_sessdata() | ||
c.raise_for_no_bili_jct() | ||
print() | ||
except: | ||
print("error!") | ||
|
||
def connect(): | ||
@live.LiveDanma.on('VERIFICATION_SUCCESSFUL') | ||
async def on_successful(event): | ||
await live.liveroom.send_danmaku(danmaku=live.Danmaku("连接成功!")) | ||
|
||
@live.LiveDanma.on('DANMU_MSG') | ||
async def on_danmaku(event): | ||
# 收到弹幕. | ||
Uid=event["data"]["info"][2][0] | ||
name=await user.user_info(uid=Uid,Credential=c) | ||
print(name["name"],event["data"]["info"][1]) | ||
|
||
|
||
@live.LiveDanma.on('SEND_GIFT') | ||
async def on_gift(event): | ||
# 收到礼物 | ||
print(json.dumps(event,ensure_ascii=False)) | ||
|
||
sync(live.LiveDanma.connect()) | ||
|
||
if __name__ == "__main__" : | ||
login() | ||
load_dotenv(dotenv_path="./.env") | ||
room=os.environ[roomid] | ||
live.set(room=room,credential=c) | ||
connect() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bilibili_api_python==16.2.0 | ||
python-dotenv==1.0.1 | ||
pyinstaller==6.7.0 |