improved presets
This commit is contained in:
parent
08192b5d93
commit
b8b378a5bb
@ -22,7 +22,7 @@ def get_of(mainservice: MainService) -> Callable[[str], command_type]:
|
|||||||
async def help_(ctx: Context, args: list[str]) -> None:
|
async def help_(ctx: Context, args: list[str]) -> None:
|
||||||
match args:
|
match args:
|
||||||
case []:
|
case []:
|
||||||
await ctx.reply('music bot')
|
await ctx.reply('music bot\nhttps://music.parrrate.ru/docs/usage.html')
|
||||||
case [name]:
|
case [name]:
|
||||||
await ctx.reply(f'help for {name}: `{name} help`')
|
await ctx.reply(f'help for {name}: `{name} help`')
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class YState:
|
|||||||
try:
|
try:
|
||||||
return await future
|
return await future
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise Explicit('extraction error\nunknown ytdl error') from e
|
raise Explicit('extraction error\nunknown ytdl error (probably due to video being unavailable, e.g. because of regional restrictions)') from e
|
||||||
finally:
|
finally:
|
||||||
self.results.task_done()
|
self.results.task_done()
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ class BoundCtx:
|
|||||||
assert_admin(self.ctx.member)
|
assert_admin(self.ctx.member)
|
||||||
if not set(self.effects) <= set(string.ascii_letters + string.digits + '*,=+-/()|.^:_'):
|
if not set(self.effects) <= set(string.ascii_letters + string.digits + '*,=+-/()|.^:_'):
|
||||||
raise Explicit('malformed effects')
|
raise Explicit('malformed effects')
|
||||||
options = options_for_effects(self.effects)
|
return options_for_effects(self.effects)
|
||||||
else:
|
else:
|
||||||
options = None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class UrlCtx:
|
class UrlCtx:
|
||||||
@ -81,6 +81,12 @@ class ArgCtx:
|
|||||||
effects = default_effects
|
effects = default_effects
|
||||||
case _:
|
case _:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
if url in presets:
|
||||||
|
raise Explicit('expected url, got preset. maybe you are missing `+`?')
|
||||||
|
if url in {'+', '-'}:
|
||||||
|
raise Explicit('expected url, got `+` or `-`. maybe you tried to use multiple effects?')
|
||||||
|
if url.startswith('+') or url.startswith('-"') or url.startswith('-\''):
|
||||||
|
raise Explicit('expected url, got `+` or `-"` or `-\'`. maybe you forgot to separate control symbol from the effects?')
|
||||||
ctx = UrlCtx(url, effects)
|
ctx = UrlCtx(url, effects)
|
||||||
seconds = 0
|
seconds = 0
|
||||||
match args:
|
match args:
|
||||||
|
@ -14,5 +14,6 @@ presets: dict[str, str] = {
|
|||||||
'mono': f'{_prefix_preset}aeval=.5*val(0)+.5*val(1)|.5*val(1)+.5*val(0)',
|
'mono': f'{_prefix_preset}aeval=.5*val(0)+.5*val(1)|.5*val(1)+.5*val(0)',
|
||||||
'normal': f'{normal_prefix}',
|
'normal': f'{normal_prefix}',
|
||||||
}
|
}
|
||||||
|
presets['ayylmao'] = presets['cursed']
|
||||||
allowed_presets = ['bassboost', 'bassbooboost', 'nightcore', 'daycore', 'mono', 'normal', ]
|
allowed_presets = ['bassboost', 'bassbooboost', 'nightcore', 'daycore', 'mono', 'normal', ]
|
||||||
allowed_effects = {'', *(presets[key] for key in allowed_presets)}
|
allowed_effects = {'', *(presets[key] for key in allowed_presets)}
|
||||||
|
Loading…
Reference in New Issue
Block a user