public async Task CreateVoice(CommandContext ctx, [Description("New voice channel name.")][RemainingText] string name = "") { if (!BotServices.CheckChannelName(name)) { await BotServices.SendResponseAsync(ctx, Resources.ERR_CHANNEL_NAME, ResponseType.Warning) .ConfigureAwait(false); return; } if (ctx.Guild.Channels.Any(chn => string.Equals(name, chn.Value.Name, StringComparison.OrdinalIgnoreCase))) { await BotServices.SendResponseAsync(ctx, Resources.ERR_CHANNEL_EXISTS, ResponseType.Warning) .ConfigureAwait(false); return; } var channel = await ctx.Guild.CreateVoiceChannelAsync(name.Trim().Replace(" ", "-")) .ConfigureAwait(false); await ctx.RespondAsync("Successfully created the voice channel " + Formatter.Bold(channel.Name)) .ConfigureAwait(false); }
public async Task CreateChannelCategory(CommandContext ctx, [Description("New category name")][RemainingText] string name) { if (!BotServices.CheckChannelName(name)) { await BotServices.SendEmbedAsync(ctx, Resources.ERR_CHANNEL_NAME, EmbedType.Warning).ConfigureAwait(false); } else { var category = await ctx.Guild.CreateChannelCategoryAsync(name.Trim()).ConfigureAwait(false); await BotServices.SendEmbedAsync(ctx, "Successfully created category " + Formatter.Bold(category.Name), EmbedType.Good).ConfigureAwait(false); } }
public async Task SetChannelName(CommandContext ctx, [Description("Channel to rename")] DiscordChannel channel, [Description("New channel name")][RemainingText] string name) { if (!BotServices.CheckChannelName(name)) { await BotServices.SendEmbedAsync(ctx, Resources.ERR_CHANNEL_NAME, EmbedType.Warning).ConfigureAwait(false); } else { var old_name = channel.Name; await channel.ModifyAsync(new Action <ChannelEditModel>(m => m.Name = name.Trim().Replace(" ", "-"))).ConfigureAwait(false); await BotServices.SendEmbedAsync(ctx, $"Successfully renamed the channel " + Formatter.Bold(old_name) + " to " + Formatter.Bold(name), EmbedType.Good).ConfigureAwait(false); } }
public async Task CreateVoiceChannel(CommandContext ctx, [Description("New voice channel name")][RemainingText] string name = "") { if (!BotServices.CheckChannelName(name)) { await BotServices.SendEmbedAsync(ctx, Resources.ERR_CHANNEL_NAME, EmbedType.Warning).ConfigureAwait(false); } else if (ctx.Guild.Channels.Any(chn => string.Compare(name, chn.Value.Name, true) == 0)) { await BotServices.SendEmbedAsync(ctx, Resources.ERR_CHANNEL_EXISTS, EmbedType.Warning).ConfigureAwait(false); } else { var channel = await ctx.Guild.CreateVoiceChannelAsync(name : name.Trim().Replace(" ", "-")).ConfigureAwait(false); await BotServices.SendEmbedAsync(ctx, "Successfully created the voice channel " + Formatter.Bold(channel.Name), EmbedType.Good).ConfigureAwait(false); } }
public async Task SetChannelName(CommandContext ctx, [Description("Channel to rename.")] DiscordChannel channel, [Description("New channel name.")][RemainingText] string name) { if (!BotServices.CheckChannelName(name)) { await BotServices.SendResponseAsync(ctx, Resources.ERR_CHANNEL_NAME, ResponseType.Warning) .ConfigureAwait(false); return; } var oldName = channel.Name; await channel.ModifyAsync(m => m.Name = name.Trim().Replace(" ", "-")).ConfigureAwait(false); await ctx.RespondAsync("Successfully renamed the channel " + Formatter.Bold(oldName) + " to " + Formatter.Bold(name)).ConfigureAwait(false); }