play attachment + block monitor
This commit is contained in:
parent
b96dc477c0
commit
b3601bfbf3
@ -1,6 +1,6 @@
|
||||
ptvp35 @ git+https://gitea.parrrate.ru/PTV/ptvp35.git@c9cdbf86a67eaf817baf0bc23e0440b54c070362
|
||||
v6d0auth @ git+https://gitea.parrrate.ru/PTV/v6d0auth.git@c4b7a4900d36cb74b5aa544864cbbd3125415bb4
|
||||
v6d1tokens @ git+https://gitea.parrrate.ru/PTV/v6d1tokens.git@22c9784d20d6d9d860d4f1c0da41254db17ab9a2
|
||||
v6d2ctx @ git+https://gitea.parrrate.ru/PTV/v6d2ctx.git@2f0ac33c0228d43b9263ca31f584be2f96ad84eb
|
||||
v6d2ctx @ git+https://gitea.parrrate.ru/PTV/v6d2ctx.git@782a934af9a54ea3026ac075673ca40dc5359c3e
|
||||
rainbowadn @ git+https://gitea.parrrate.ru/PTV/rainbowadn.git@add1e7cdbf817811d4b85baec63ed0b87ae96dae
|
||||
adaas @ git+https://gitea.parrrate.ru/PTV/adaas.git@a598939c635e91c1b8482c5846b23d6442bcaa8e
|
||||
|
@ -38,6 +38,10 @@ presets: {shlex.join(allowed_presets)}
|
||||
)
|
||||
async with lock_for(ctx.guild, 'not in a guild'):
|
||||
queue = await queue_for(ctx, create=True, force_play=False)
|
||||
if ctx.message.attachments:
|
||||
if len(ctx.message.attachments) > 1:
|
||||
raise Explicit('no more than one attachment')
|
||||
args = [ctx.message.attachments[0].url] + args
|
||||
async for audio in yt_audios(ctx, args):
|
||||
queue.append(audio)
|
||||
await ctx.reply('done')
|
||||
|
@ -10,6 +10,7 @@ from v6d3music.utils.info_tuple import info_tuple
|
||||
|
||||
async def yt_audios(ctx: Context, args: list[str]) -> AsyncIterable[YTAudio]:
|
||||
tuples: list[info_tuple] = []
|
||||
assert ctx.guild is not None
|
||||
async for info, effects, already_read, tor in entries_effects_for_args(args, ctx.guild.id):
|
||||
tuples.append((info, effects, already_read, tor))
|
||||
if len(tuples) >= 5:
|
||||
|
@ -2,7 +2,6 @@ import asyncio
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
||||
import discord
|
||||
@ -10,6 +9,7 @@ from v6d1tokens.client import request_token
|
||||
from v6d2ctx.handle_content import handle_content
|
||||
from v6d2ctx.lock_for import lock_for
|
||||
from v6d2ctx.serve import serve
|
||||
from v6d2ctx.pain import ABlockMonitor
|
||||
|
||||
from v6d3music.app import MusicAppFactory, session_db
|
||||
from v6d3music.commands import register_commands
|
||||
@ -115,7 +115,7 @@ async def save_vcs(delay: bool):
|
||||
|
||||
|
||||
async def save_commit():
|
||||
await queue_db.set('commit', time.time())
|
||||
await queue_db.commit()
|
||||
|
||||
|
||||
async def save_all(delay: bool, save_playing: bool):
|
||||
@ -148,8 +148,9 @@ async def setup_tasks():
|
||||
loop.create_task(start_app())
|
||||
|
||||
|
||||
|
||||
async def main():
|
||||
async with volume_db, queue_db, cache_db, session_db, effects_db:
|
||||
async with volume_db, queue_db, cache_db, session_db, effects_db, ABlockMonitor():
|
||||
if 'guerilla' in sys.argv:
|
||||
from pathlib import Path
|
||||
tokenpath = Path('.token.txt')
|
||||
|
@ -3,8 +3,10 @@ from typing import Iterable
|
||||
from v6d2ctx.context import Context, Implicit
|
||||
|
||||
|
||||
async def catch(ctx: Context, args: list[str], reply: str, *catched: (Iterable[str] | str)):
|
||||
catched = {(case,) if isinstance(case, str) else tuple(case) for case in catched}
|
||||
if tuple(args) in catched:
|
||||
async def catch(ctx: Context, args: list[str], reply: str, *catched: (Iterable[str] | str), attachments_ok=True):
|
||||
if ctx.message.attachments and attachments_ok:
|
||||
return
|
||||
real_catched = {(case,) if isinstance(case, str) else tuple(case) for case in catched}
|
||||
if tuple(args) in real_catched:
|
||||
await ctx.reply(reply.strip())
|
||||
raise Implicit
|
||||
|
Loading…
Reference in New Issue
Block a user