Ejemplo n.º 1
0
        public async Task AddIntro(CommandContext ctx, [RemainingText, Description("Command you want used as your intro")] string customCommandName)
        {
            CustomAudioCommandModel custCom = CustomAudioCommandFile.Instance.GetAudioFileForCommand(customCommandName);

            if (custCom == null)
            {
                await ctx.RespondAsync("Cannot find command with that name :^(");

                return;
            }

            // do you have an intro already?
            CustomIntroModel introModel = CustomIntroFile.Instance.GetIntroForUsername(ctx.User.Username);

            if (introModel != null)
            {
                // user already has an intro
                if (!CustomIntroFile.Instance.ChangeIntro(ctx.User.Username, custCom.Filepath))
                {
                    await ctx.RespondAsync(string.Format("I could not change your intro for some reason :^)"));

                    return;
                }
            }

            CustomIntroFile.Instance.AddCustomIntro(ctx.User.Username, custCom.Filepath);
            await ctx.RespondAsync(string.Format("I will now play `{0}` when you join voice channels :^)", customCommandName));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Changes the intro for the specified user.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="filepath">The filepath.</param>
        /// <returns>Success boolean</returns>
        public bool ChangeIntro(string username, string filepath)
        {
            CustomIntroModel model = GetIntroForUsername(username);

            if (model == null)
            {
                return(false);
            }
            else
            {
                model.Filepath = filepath;
                SaveFile();
                return(true);
            }
        }
Ejemplo n.º 3
0
        private void IntroMethodThread()
        {
            while (isDoingIntros)
            {
                IntroQueueElement introQueueElement = introQueue.Take();
                if (isDoingIntros)
                {
                    CustomIntroModel introModel = CustomIntroFile.Instance.GetIntroForUsername(introQueueElement.NewUser.Username);
                    string           filepath;
                    if (introModel != null)
                    {
                        Program.Client.DebugLogger.Info(string.Format("Playing {0} for {1}", introModel.Filepath, introQueueElement.NewUser.Username));
                        filepath = introModel.Filepath;
                    }
                    else
                    {
                        Program.Client.DebugLogger.Warn(string.Format("No intro was found for {0}. Using default", introQueueElement.NewUser.Username));
                        filepath = @"AudioFiles\fuckyou.mp3";
                    }

                    AudioController.Instance.AddAudioToQueue(filepath, introQueueElement.ChannelToJoin, introQueueElement.GuildToJoin);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the custom intro object to the list.
 /// </summary>
 /// <param name="introToAdd">The CustomIntroModel object to add.</param>
 public void AddCustomIntro(CustomIntroModel introToAdd)
 {
     customIntros.Add(introToAdd);
     SaveFile();
 }