Ejemplo n.º 1
0
        public async Task <string> AddUser(ulong guildID, ulong channelID, string username)
        {
            TwitchGuildDefinition guildDefinition = guilds.Find(x => x.guildID == guildID);

            if (guildDefinition == null)
            {
                guilds.Add(new TwitchGuildDefinition(guildID, channelID));
                guildDefinition = guilds[guilds.Count - 1];
            }

            if (!await UserExist(username))
            {
                return("User does not exist.");
            }

            if (guildDefinition.users.Contains(username))
            {
                return("User is already being reported for this guild.");
            }

            guildDefinition.users.Add(username);

            UpdateMonitoredChannels();
            return($"Added https://www.twitch.tv/{username} to list.");
        }
Ejemplo n.º 2
0
        public bool SetPreviewMode(ulong guildID, int previewMode)
        {
            TwitchGuildDefinition guildDefinition = guilds.Find(x => x.guildID == guildID);

            if (guildDefinition == null)
            {
                return(false);
            }

            guildDefinition.previewMode = previewMode;
            return(true);
        }
Ejemplo n.º 3
0
        public string[] GetUsersInGuild(ulong guildID)
        {
            string[] users = new string[0];

            TwitchGuildDefinition guildDefinition = guilds.Find(x => x.guildID == guildID);

            if (guildDefinition != null)
            {
                users = guildDefinition.users.ToArray();
            }
            return(users);
        }
Ejemplo n.º 4
0
        public void SetAlertChannel(ulong guildID, ulong channelID)
        {
            TwitchGuildDefinition guildDefinition = guilds.Find(x => x.guildID == guildID);

            if (guildDefinition == null)
            {
                guilds.Add(new TwitchGuildDefinition(guildID, channelID));
                guildDefinition = guilds[guilds.Count - 1];
            }

            guildDefinition.textChannelID = channelID;

            UpdateMonitoredChannels();
        }
Ejemplo n.º 5
0
        public string RemoveUser(ulong guildID, string username)
        {
            TwitchGuildDefinition guildDefinition = guilds.Find(x => x.guildID == guildID);

            if (guildDefinition == null)
            {
                return("There are no users reporting in this guild.");
            }

            if (!guildDefinition.users.Contains(username))
            {
                return("User is not in the list.");
            }

            guildDefinition.users.Remove(username);
            monitorService.LiveStreams.TryRemove(username, out Stream s);

            UpdateMonitoredChannels();
            return($"Removed {username} from list.");
        }
Ejemplo n.º 6
0
        public TwitchGuildDefinition GetGuild(ulong guildID)
        {
            TwitchGuildDefinition guildDefinition = guilds.Find(x => x.guildID == guildID);

            return(guildDefinition);
        }