public async Task <IActionResult> SendMessage([FromBody] PlayQuoteBody body)
        {
            var channel = discordSocketClient.GetChannel(body.VoiceChannel);

            if (channel is not Discord.IVoiceChannel vc)
            {
                return(new BadRequestResult());
            }
            var audio = await audioRepo.GetAudioById(body.AudioId);

            await soundModule.Play(vc, audio, CancellationToken.None);

            return(new OkResult());
        }
Beispiel #2
0
        public async Task <IActionResult> Index(uint id)
        {
            var authEntry = HttpContext.GetAuthEntry();

            if (authEntry is null)
            {
                return(Redirect("/login"));
            }
            var authorized = await IsAllowedAudio(authEntry, id);

            if (!authorized)
            {
                return(Unauthorized());
            }
            var audio = await audioRepo.GetAudioById(id);

            var str = await audioRepo.GetFileFromPath(audio.Path);

            return(Redirect(str));
        }