Esempio n. 1
0
        public async Task OpenStream(CommandContext ctx,
                                     [Description("streaming-help-channel")] DiscordChannel channel,
                                     [RemainingText, Description("streaming-help-args")] string args = "")
        {
            await CommandChecks(ctx, channel, args, async(arguments, lang) =>
            {
                Dictionary <string, dynamic> temp = EventStreams.SetData(channel.Id.ToString(), arguments);
                string type = (arguments.ContainsKey("title") ? "title" : "namespace");
                string goal = GetGoalMessage(lang, type, arguments[type].ToString());

                string desc = ListArguments(temp, lang);
                desc        = (desc.Length > 0 ? $":\n{desc}" : ".");
                await ctx.RespondAsync(Locale.GetMessage("streaming-opened", lang, goal, channel.Mention, desc));
            });
        }
Esempio n. 2
0
        public async Task OpenStream(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.ToString() == "")
            {
                await ctx.RespondAsync(Locale.GetMessage("streaming-required-channel", lang, "help openStream", Config.GetValue("prefix")));

                return;
            }

            if (goal == "")
            {
                await ctx.RespondAsync(Locale.GetMessage("streaming-required-goal", lang, "help openStream", Config.GetValue("prefix")));

                return;
            }

            // Format the goal
            goal = goal.Replace("_", " ").Replace("\\", "");

            // Change JSON config
            string len = (minLength != -1 ? minLength.ToString() : "");

            EventStreams.SetData(goal, channel.Id.ToString(), len);

            await ctx.RespondAsync(Locale.GetMessage("streaming-added", lang, goal, channel.Mention));
        }
Esempio n. 3
0
        public async Task EditStream(CommandContext ctx,
                                     [Description("streaming-help-channel")] DiscordChannel channel,
                                     [RemainingText, Description("streaming-help-args")] string args = "")
        {
            await CommandChecks(ctx, channel, args, async(arguments, lang) =>
            {
                Dictionary <string, dynamic> temp = EventStreams.SetData(channel.Id.ToString(), arguments, false);
                string type = (arguments.ContainsKey("title") ? "title" : "namespace");
                string goal = GetGoalMessage(lang, type, arguments[type].ToString());

                // Return a specific message if nothing was changed
                if (temp.Count == 0)
                {
                    await ctx.RespondAsync(Locale.GetMessage("streaming-edited-nothing", lang, goal, channel.Mention));
                    return;
                }

                string desc = ListArguments(temp, lang);
                await ctx.RespondAsync(Locale.GetMessage("streaming-edited", lang, goal, channel.Mention, desc));
            });
        }