Compare commits

..

3 Commits

6 changed files with 22 additions and 18 deletions

View File

@ -3,11 +3,10 @@ import inspect
import time
import arguments
import constants
from state import reloaded_modules, start_time
import commands
import constants
import utils
from state import reloaded_modules, start_time
async def uptime(message):

View File

@ -173,6 +173,13 @@ async def volume(message):
if not (args := await parser.parse_args(message, tokens)):
return
if not message.guild.voice_client.source:
await utils.reply(
message,
f"there is no player currently active!",
)
return
if args.volume:
message.guild.voice_client.source.volume = float(args.volume) / 100.0
await utils.reply(
@ -180,16 +187,10 @@ async def volume(message):
f"volume set to **{args.volume}%**",
)
else:
if message.guild.voice_client.source:
await utils.reply(
message,
f"current volume is **{int(message.guild.voice_client.source.volume * 100)}%**",
)
else:
await utils.reply(
message,
f"there is no player currently active!",
)
async def play_next(message):

View File

@ -15,7 +15,7 @@ YTDL_OPTIONS = {
"outtmpl": "%(extractor)s-%(id)s-%(title)s.%(ext)s",
"quiet": True,
"restrictfilenames": True,
"socket_timeout": 10,
"socket_timeout": 15,
"source_address": "0.0.0.0",
}

View File

@ -1,5 +1,6 @@
message_handlers = {}
async def trigger_message_handlers(event_type: str, *data):
if event_type in message_handlers:
for message_handler in message_handlers[event_type]:

View File

@ -2,13 +2,12 @@ import importlib
import inspect
import time
import commands
import constants
import core
import events
from state import client, reloaded_modules, start_time
import commands
@client.event
async def on_ready():

View File

@ -37,7 +37,8 @@ class YTDLSource(disnake.PCMVolumeTransformer):
return cls(
disnake.FFmpegPCMAudio(
data["url"] if stream else ytdl.prepare_filename(data), options="-vn"
data["url"] if stream else ytdl.prepare_filename(data),
options="-vn -reconnect 1",
),
data=data,
)
@ -45,7 +46,10 @@ class YTDLSource(disnake.PCMVolumeTransformer):
def __reload_module__():
for name, module in globals().items():
if inspect.ismodule(module) and name not in constants.RELOAD_BLACKLISTED_MODULES:
if (
inspect.ismodule(module)
and name not in constants.RELOAD_BLACKLISTED_MODULES
):
importlib.reload(module)
if "__reload_module__" in dir(module) and name not in reloaded_modules:
reloaded_modules.add(name)