Пример #1
0
        public async Task OnMessageCreated(MessageCreateEventArgs messageCreated,
                                           CancellationToken cancellationToken = default)
        {
            if (!_match.Success)
            {
                return;
            }

            var tmxId     = _match.Groups[1].Value;
            var trackInfo = await _tmnfService.GetTrackInformation(tmxId, cancellationToken);

            var embededMessage = DiscordEmbedHelper.CreateEmbedForTrackInfo(trackInfo);

            await messageCreated.Message.RespondAsync(null, false, embededMessage);
        }
Пример #2
0
        public async Task OnMessageCreated(MessageCreateEventArgs messageCreated,
                                           CancellationToken cancellationToken = default)
        {
            if (!_match.Success)
            {
                return;
            }

            var tmxId     = _match.Groups[1].Value;
            var trackInfo = await _tm2020Service.GetTrackInformation(tmxId, cancellationToken);

            var embededMessage = DiscordEmbedHelper.CreateEmbedForTrackInfo(trackInfo);

            await messageCreated.Message.RespondAsync(null, false, embededMessage);

            await Task.Delay(500, cancellationToken);

            // Remove auto embed for TM2020 Url
            await messageCreated.Message.ModifyEmbedSuppressionAsync(true);
        }