forked from Ikaros-521/AI-Vtuber
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
02b0d5c
commit c8d862c
Showing
12 changed files
with
1,809 additions
and
1,275 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
|
@@ -135,4 +135,5 @@ zhipuai==1.0.7 | |
bardapi==0.1.33 | ||
revTongYi==0.0.1.0 | ||
pyautogui | ||
nicegui==1.3.14 | ||
nicegui==1.3.14 | ||
pytchat==0.5.5 |
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,38 @@ | ||
openai | ||
pygame | ||
edge-tts==6.1.6 | ||
langid | ||
aiohttp | ||
asyncio | ||
slack_sdk==3.21.3 | ||
profanity==1.1 | ||
elevenlabs | ||
PyPDF2 | ||
protobuf | ||
protobuf_inspector | ||
requests | ||
websocket-client | ||
langchain==0.0.142 | ||
PyQt5 | ||
pyqt5-tools | ||
tiktoken | ||
pyahocorasick | ||
webuiapi | ||
pyvirtualcam | ||
numpy | ||
faiss-cpu | ||
sentence_transformers | ||
pydub | ||
send2trash | ||
pypinyin | ||
sparkdesk-api | ||
gradio_client | ||
schedule | ||
pyhandytools | ||
curl_cffi | ||
zhipuai | ||
bardapi | ||
revTongYi | ||
pyautogui | ||
nicegui | ||
socket |
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,37 @@ | ||
from TikTokLive import TikTokLiveClient | ||
from TikTokLive.types.events import CommentEvent, ConnectEvent, DisconnectEvent, JoinEvent | ||
|
||
proxies = { | ||
"http://": "http://127.0.0.1:10809", | ||
"https://": "http://127.0.0.1:10809" | ||
} | ||
|
||
# Instantiate the client with the user's username | ||
client: TikTokLiveClient = TikTokLiveClient(unique_id="@markus864", proxies=proxies) | ||
|
||
|
||
# Define how you want to handle specific events via decorator | ||
@client.on("connect") | ||
async def on_connect(_: ConnectEvent): | ||
print("Connected to Room ID:", client.room_id) | ||
|
||
@client.on("disconnect") | ||
async def on_disconnect(event: DisconnectEvent): | ||
print("Disconnected") | ||
|
||
@client.on("join") | ||
async def on_join(event: JoinEvent): | ||
print(f"@{event.user.unique_id} joined the stream!") | ||
|
||
# Notice no decorator? | ||
async def on_comment(event: CommentEvent): | ||
print(f"{event.user.nickname} -> {event.comment}") | ||
|
||
|
||
# Define handling an event via a "callback" | ||
client.add_listener("comment", on_comment) | ||
|
||
if __name__ == '__main__': | ||
# Run the client and block the main thread | ||
# await client.start() to run non-blocking | ||
client.run() |
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,56 @@ | ||
import socks, re | ||
from emoji import demojize | ||
|
||
server = 'irc.chat.twitch.tv' | ||
port = 6667 | ||
nickname = '主人' | ||
token = 'oauth:xxx' # 访问 https://twitchapps.com/tmi/ 获取 | ||
user = 'love_ikaros' # 你的Twitch用户名 Your Twitch username | ||
channel = '#prettyyjj' # 要从中检索消息的频道,注意#必须携带在头部 The channel you want to retrieve messages from | ||
|
||
# 代理服务器的地址和端口 | ||
proxy_server = "127.0.0.1" | ||
proxy_port = 10809 | ||
|
||
# 配置代理服务器 | ||
socks.set_default_proxy(socks.HTTP, proxy_server, proxy_port) | ||
|
||
# 创建socket对象 | ||
sock = socks.socksocket() | ||
|
||
try: | ||
sock.connect((server, port)) | ||
print("成功连接 Twitch IRC server") | ||
except Exception as e: | ||
print(f"连接 Twitch IRC server 失败: {e}") | ||
|
||
|
||
sock.send(f"PASS {token}\n".encode('utf-8')) | ||
sock.send(f"NICK {nickname}\n".encode('utf-8')) | ||
sock.send(f"JOIN {channel}\n".encode('utf-8')) | ||
|
||
regex = r":(\w+)!\w+@\w+\.tmi\.twitch\.tv PRIVMSG #\w+ :(.+)" | ||
|
||
while True: | ||
try: | ||
resp = sock.recv(2048).decode('utf-8') | ||
|
||
# 输出所有接收到的内容,包括PING/PONG | ||
# print(resp) | ||
|
||
if resp.startswith('PING'): | ||
sock.send("PONG\n".encode('utf-8')) | ||
|
||
elif not user in resp: | ||
resp = demojize(resp) | ||
match = re.match(regex, resp) | ||
|
||
username = match.group(1) | ||
message = match.group(2) | ||
|
||
|
||
chat = '[' + username + ']: ' + message | ||
print(chat) | ||
|
||
except Exception as e: | ||
print("Error receiving chat: {0}".format(e)) |
Oops, something went wrong.