public async Task SetBotAvatar(CommandContext ctx,
                                       [Description("Image URL. Must be in jpg, png or img format.")] string query)
        {
            var stream = BotServices.CheckImageInput(ctx, query).Result;

            if (stream.Length <= 0)
            {
                return;
            }
            await ctx.Client.UpdateCurrentUserAsync(avatar : stream).ConfigureAwait(false);

            await BotServices.SendEmbedAsync(ctx, SharedData.Name + " avatar has been updated!", EmbedType.Good).ConfigureAwait(false);
        }
Beispiel #2
0
        public async Task SetBotAvatar(CommandContext ctx,
                                       [Description("Image URL. Must be in JPG, PNG or IMG format.")]
                                       string query)
        {
            var stream = BotServices.CheckImageInput(ctx, query).Result;

            if (stream.Length <= 0)
            {
                return;
            }
            await ctx.Client.UpdateCurrentUserAsync(avatar : stream).ConfigureAwait(false);

            await ctx.RespondAsync($"{Program.Settings.Name} avatar has been updated!").ConfigureAwait(false);
        }
Beispiel #3
0
        public async Task SetServerAvatar(CommandContext ctx,
                                          [Description("Image URL. Must be in jpg, png or img format.")] string query)
        {
            try
            {
                var stream = BotServices.CheckImageInput(ctx, query).Result;
                await ctx.Guild.ModifyAsync(chn => chn.Icon = stream).ConfigureAwait(false);

                await BotServices.SendEmbedAsync(ctx, ctx.Guild.Name + " server avatar has been updated!", EmbedType.Good).ConfigureAwait(false);
            }
            catch
            {
                await BotServices.SendEmbedAsync(ctx, ctx.Guild.Name + " server avatar has not been updated!", EmbedType.Error).ConfigureAwait(false);
            }
        }
Beispiel #4
0
        public async Task SetServerAvatar(CommandContext ctx,
                                          [Description("URL image in JPG, PNG or IMG format.")]
                                          string query)
        {
            try
            {
                var stream = BotServices.CheckImageInput(ctx, query).Result;
                await ctx.Guild.ModifyAsync(chn => chn.Icon = stream).ConfigureAwait(false);

                await ctx.RespondAsync(ctx.Guild.Name + " server avatar has been updated!").ConfigureAwait(false);
            }
            catch
            {
                await BotServices
                .SendResponseAsync(ctx, ctx.Guild.Name + " server avatar has not been updated!", ResponseType.Error)
                .ConfigureAwait(false);
            }
        }