public async Task CloseStream(CommandContext ctx, [Description("streaming-help-channel")] DiscordChannel channel, [RemainingText, Description("streaming-help-args")] string args = "") { await CommandChecks(ctx, channel, args, async(arguments, lang) => { EventStreams.RemoveData(channel.Id.ToString(), arguments); string type = (arguments.ContainsKey("title") ? "title" : "namespace"); string goal = GetGoalMessage(lang, type, arguments[type].ToString()); await ctx.RespondAsync(Locale.GetMessage("streaming-closed", lang, goal, channel.Mention)); }); }
public async Task CloseStream(CommandContext ctx, [Description("streaming-help-channel")] DiscordChannel channel, [Description("streaming-help-goal")] string goal = "", [Description("streaming-help-minlength")] int minLength = -1) { string lang = Config.GetLang(ctx.Guild.Id.ToString()); // Ensure that we are in private channel if (ctx.Channel.Name != "moderators") { await ctx.RespondAsync(Locale.GetMessage("denied", lang)); return; } ; await ctx.TriggerTypingAsync(); // Check for required parameters if (channel == null) { await ctx.RespondAsync(Locale.GetMessage("streaming-required-channel", lang, "help closeStream", Config.GetValue("prefix"))); return; } if (goal == "") { await ctx.RespondAsync(Locale.GetMessage("streaming-required-goal", lang, "help closeStream", Config.GetValue("prefix"))); return; } // Format the goal goal = goal.Replace("_", " ").Replace("\\", ""); // Change JSON config string len = (minLength != -1 ? minLength.ToString() : ""); EventStreams.RemoveData(goal, channel.Id.ToString(), len); await ctx.RespondAsync(Locale.GetMessage("streaming-removed", lang, goal, channel.Mention)); }