Beispiel #1
0
        public async Task TestLive(string platform)
        {
            if (platform.ToLower() != Constants.Mixer.ToLower() && platform.ToLower() != Constants.YouTube.ToLower() && platform.ToLower() != Constants.Twitch.ToLower() && platform.ToLower() != Constants.Smashcast.ToLower())
            {
                await Context.Channel.SendMessageAsync("Please pass in mixer, smashcast, twitch, youtube or youtube gaming when requesting a test message. (ie: !cb message test youtube)");

                return;
            }

            var guild = ((IGuildUser)Context.Message.Author).Guild;

            var user = ((IGuildUser)Context.Message.Author);

            if (!user.GuildPermissions.ManageGuild)
            {
                return;
            }

            var message = await _messagingService.BuildTestMessage((SocketUser)Context.User, Context.Guild.Id, Context.Channel.Id, platform.ToLower());

            if (message != null)
            {
                try
                {
                    if (message.Embed != null)
                    {
                        RequestOptions options = new RequestOptions();
                        options.RetryMode = RetryMode.AlwaysRetry;
                        var msg = await Context.Channel.SendMessageAsync(message.Message, false, message.Embed, options);
                    }
                    else
                    {
                        var msg = await Context.Channel.SendMessageAsync(message.Message);
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogError("Error in Message.Test Command: " + ex.Message);
                }
            }
        }