Added Pre-made opus libraries and basic OS checking

This commit is contained in:
Logan Cusano
2023-05-18 00:57:31 -04:00
parent 6528bd22aa
commit 18d84e9e3f
5 changed files with 17 additions and 5 deletions

5
.gitignore vendored
View File

@@ -1,2 +1,5 @@
*venv/ *venv/
*__pycache__/ *__pycache__/
*.html
*.exe
LICENSE

17
main.py
View File

@@ -1,11 +1,11 @@
import argparse import argparse
from discord import Intents, Client, Member from sys import platform
from discord import Intents, Client, Member, opus
from discord.ext import commands from discord.ext import commands
from NoiseGatev2 import NoiseGate from NoiseGatev2 import NoiseGate
def main(clientId='OTQzNzQyMDQwMjU1MTE1MzA0.Yg3eRA.ZxEbRr55xahjfaUmPY8pmS-RHTY', channelId=367396189529833476, NGThreshold=50, deviceId=1): def main(clientId='OTQzNzQyMDQwMjU1MTE1MzA0.Yg3eRA.ZxEbRr55xahjfaUmPY8pmS-RHTY', channelId=367396189529833476, NGThreshold=50, deviceId=1):
intents = Intents.default() intents = Intents.default()
intents.message_content = True
client = Client(intents=intents) client = Client(intents=intents)
@@ -15,7 +15,16 @@ def main(clientId='OTQzNzQyMDQwMjU1MTE1MzA0.Yg3eRA.ZxEbRr55xahjfaUmPY8pmS-RHTY',
channelIdToJoin = client.get_channel(channelId) channelIdToJoin = client.get_channel(channelId)
print("Channel", channelIdToJoin) print("Channel", channelIdToJoin)
channelConnection = await channelIdToJoin.connect()
if platform == "linux" or platform == "linux2":
# linux
opus.load_opus('./opus/libopus_aarcch64.so')
elif platform == "win32":
# Windows...
opus.load_opus('./opus/libopus_amd64.dll')
channelConnection = await channelIdToJoin.connect(timeout=60.0, reconnect=True)
print("Joined voice") print("Joined voice")
streamHandler = NoiseGate( streamHandler = NoiseGate(
_input_device_index=deviceId, _input_device_index=deviceId,

BIN
opus/libopus_aarcch64.so Normal file

Binary file not shown.

BIN
opus/libopus_amd64.dll Normal file

Binary file not shown.

BIN
opus/libopus_armv7l.so Normal file

Binary file not shown.