@@ -35,12 +35,12 @@ exports.joinServer = async (req, res) => {
|
|||||||
log.INFO("Join requested to: ", deviceId, channelId, clientId, presetName, NGThreshold);
|
log.INFO("Join requested to: ", deviceId, channelId, clientId, presetName, NGThreshold);
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
log.DEBUG("Starting Windows Python");
|
log.DEBUG("Starting Windows Python");
|
||||||
pythonProcess = await spawn('python.exe', [resolve(__dirname, "../pdab/main.py"), deviceId, channelId, clientId, '-n', NGThreshold], { cwd: resolve(__dirname, "../pdab/").toString() });
|
pythonProcess = await spawn('python.exe', [resolve(__dirname, "../pdab/main.py"), deviceId, channelId, clientId, '-n', NGThreshold, '-p', presetName ], { cwd: resolve(__dirname, "../pdab/").toString() });
|
||||||
//pythonProcess = await spawn('C:\\Python310\\python.exe', [resolve(__dirname, "../PDAB/main.py"), deviceId, channelId, clientId, NGThreshold ]);
|
//pythonProcess = await spawn('C:\\Python310\\python.exe', [resolve(__dirname, "../PDAB/main.py"), deviceId, channelId, clientId, NGThreshold ]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.DEBUG("Starting Linux Python");
|
log.DEBUG("Starting Linux Python");
|
||||||
pythonProcess = await spawn('python3', [resolve(__dirname, "../pdab/main.py"), deviceId, channelId, clientId,'-n', NGThreshold ], { cwd: resolve(__dirname, "../pdab/") });
|
pythonProcess = await spawn('python3', [resolve(__dirname, "../pdab/main.py"), deviceId, channelId, clientId,'-n', NGThreshold, '-p', presetName ], { cwd: resolve(__dirname, "../pdab/") });
|
||||||
}
|
}
|
||||||
|
|
||||||
log.VERBOSE("Python Process: ", pythonProcess);
|
log.VERBOSE("Python Process: ", pythonProcess);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import argparse, platform, os
|
import argparse, platform, os
|
||||||
from discord import Intents, Client, Member, opus
|
from discord import Intents, Client, Member, opus, Activity, ActivityType
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from NoiseGatev2 import NoiseGate
|
from NoiseGatev2 import NoiseGate
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ async def load_opus():
|
|||||||
return "armv7l"
|
return "armv7l"
|
||||||
|
|
||||||
|
|
||||||
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, presence="the radio"):
|
||||||
intents = Intents.default()
|
intents = Intents.default()
|
||||||
|
|
||||||
client = commands.Bot(command_prefix='!', intents=intents)
|
client = commands.Bot(command_prefix='!', intents=intents)
|
||||||
@@ -33,6 +33,8 @@ def main(clientId='OTQzNzQyMDQwMjU1MTE1MzA0.Yg3eRA.ZxEbRr55xahjfaUmPY8pmS-RHTY',
|
|||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f'We have logged in as {client.user}')
|
print(f'We have logged in as {client.user}')
|
||||||
|
# Set the presence of the bot (what it's listening to)
|
||||||
|
await client.change_presence(activity=Activity(type=ActivityType.listening, name=presence))
|
||||||
|
|
||||||
channelIdToJoin = client.get_channel(channelId)
|
channelIdToJoin = client.get_channel(channelId)
|
||||||
print("Channel", channelIdToJoin)
|
print("Channel", channelIdToJoin)
|
||||||
@@ -55,21 +57,24 @@ def main(clientId='OTQzNzQyMDQwMjU1MTE1MzA0.Yg3eRA.ZxEbRr55xahjfaUmPY8pmS-RHTY',
|
|||||||
|
|
||||||
client.run(clientId)
|
client.run(clientId)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
if __name__ == "__main__":
|
||||||
parser.add_argument("deviceId", type=int, help="The ID of the audio device to use")
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("channelId", type=int, help="The ID of the voice channel to use")
|
parser.add_argument("deviceId", type=int, help="The ID of the audio device to use")
|
||||||
parser.add_argument("clientId", type=str, help="The discord client ID")
|
parser.add_argument("channelId", type=int, help="The ID of the voice channel to use")
|
||||||
parser.add_argument("-n", "--NGThreshold", type=int, help="Change the noisegate threshold. This defaults to 50")
|
parser.add_argument("clientId", type=str, help="The discord client ID")
|
||||||
args = parser.parse_args()
|
parser.add_argument("-n", "--NGThreshold", type=int, help="Change the noisegate threshold. This defaults to 50")
|
||||||
|
parser.add_argument("-p", "--presence", type=str, help="What the bot should be listening to")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
if (not args.NGThreshold):
|
if (not args.NGThreshold):
|
||||||
args.NGThreshold = 50
|
args.NGThreshold = 50
|
||||||
|
|
||||||
print("Arguments:", args)
|
print("Arguments:", args)
|
||||||
|
|
||||||
main(
|
main(
|
||||||
clientId=args.clientId,
|
clientId=args.clientId,
|
||||||
channelId=args.channelId,
|
channelId=args.channelId,
|
||||||
NGThreshold=args.NGThreshold,
|
NGThreshold=args.NGThreshold,
|
||||||
deviceId=args.deviceId
|
deviceId=args.deviceId,
|
||||||
)
|
presence=args.presence
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user