Exemplo n.º 1
0
        public async Task ClearVCTopic()
        {
            var    callingUser        = Context.User as IGuildUser;
            var    voiceChannelUserIn = callingUser.VoiceChannel;
            string vcName             = voiceChannelUserIn.Name;

            if (voiceChannelUserIn != null)
            {
                if (FuncHelpers.RemoveTopicBracket(ref vcName))
                {
                    if (Config.serverData[callingUser.GuildId].removeFirstWord_)
                    {
                        vcName = String.Format("{0}{1}", Config.serverData[callingUser.GuildId].firstWordTitle_, vcName);
                        Config.serverData[callingUser.GuildId].firstWordTitle_ = "";
                    }

                    await callingUser.VoiceChannel.ModifyAsync(x =>
                    {
                        x.Name = vcName;
                    });

                    await Context.Channel.SendMessageAsync(String.Format("Master {0}, topic was removed in {1}", callingUser.Mention, vcName));
                }
                else
                {
                    await Context.Channel.SendMessageAsync("Master, no topic was set in " + vcName);
                }
            }
            else
            {
                await Context.Channel.SendMessageAsync(String.Format("Master {0}, you need to be in a voice channel to clear a topic", callingUser.Mention));
            }
        }
Exemplo n.º 2
0
        public async Task ListVoice()
        {
            var guildUser          = Context.User as SocketGuildUser;
            var voiceChannelUserIn = guildUser.VoiceChannel;

            if (guildUser.VoiceChannel != null)
            {
                string listingReplyMsg = "";

                var    users  = voiceChannelUserIn.Users;
                string vcName = voiceChannelUserIn.Name;
                FuncHelpers.RemoveTopicBracket(ref vcName);
                EmbedBuilder em = new EmbedBuilder();
                em.WithTitle("Members in Voice " + vcName);
                em.WithColor(new Color(10, 10, 10));
                em.WithFooter("");
                foreach (var user in users)
                {
                    listingReplyMsg += "-" + user.Mention;
                    listingReplyMsg += "\n";
                }
                em.WithDescription(listingReplyMsg);
                await Context.Channel.SendMessageAsync("Master " + guildUser.Mention + ", here is your list: \n", false, em.Build());
            }
            else
            {
                await Context.Channel.SendMessageAsync(String.Format("Sorry master {0}, you need to be in a voice channel to use this command.", Context.User.Mention));
            }
        }
Exemplo n.º 3
0
        public async Task SetVCTopic([Remainder] string newTopic = "")
        {
            var guildUser          = Context.User as IGuildUser;
            var voiceChannelUserIn = guildUser.VoiceChannel;

            if (voiceChannelUserIn != null)
            {
                if (newTopic != null && newTopic != "")
                {
                    if (newTopic.Length <= Config.serverData[guildUser.GuildId].maxTopicNameLength_)
                    {
                        string vcName;

                        //remove first word if true
                        if (Config.serverData[guildUser.GuildId].removeFirstWord_ && Config.serverData[guildUser.GuildId].firstWordTitle_ == "")
                        {
                            vcName = RemoveChannelNameFirstWord(voiceChannelUserIn.Name, guildUser.GuildId);
                        }
                        else
                        {
                            vcName = voiceChannelUserIn.Name;
                        }

                        string vcNameNoTopic = FuncHelpers.RemoveTopicBracket(ref vcName) == false ? voiceChannelUserIn.Name : vcName;

                        vcName += String.Format(" ({0})", newTopic);
                        await guildUser.VoiceChannel.ModifyAsync(x =>
                        {
                            x.Name = vcName;
                        });

                        FuncHelpers.AddTopicTracking(new VCTopicData(DateTime.Now, voiceChannelUserIn));

                        await Context.Channel.SendMessageAsync(String.Format("Master {0}, the topic is now set to \"{1}\" in {2}",
                                                                             guildUser.Mention, newTopic, String.Format("{0}{1}", Config.serverData[guildUser.GuildId].firstWordTitle_, vcNameNoTopic)));
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync(String.Format("Sorry master {0}, the topic name is too long it needs to be less than {1} characters.", guildUser.Mention, Config.serverData[guildUser.GuildId].maxTopicNameLength_));
                    }
                }
                else
                {
                    await ClearVCTopic();
                }
            }
            else
            {
                await Context.Channel.SendMessageAsync(String.Format("Master {0}, you need to be in a voice channel to set a topic!", guildUser.Mention));
            }
        }