Beispiel #1
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            if (wisdom.Length > 0)
            {
                Match match;

                if ((match = Regex.Match(text, @"^(\S+)", RegexOptions.IgnoreCase)).Success)
                {
                    int[] matches = (from current in wisdom.Select((value, index) => new { value, index }) where (current.value.IndexOf(match.Groups[1].Value, StringComparison.OrdinalIgnoreCase) >= 0) select current.index).ToArray();

                    if (matches.Length > 0)
                    {
                        Anxious.Send(room, wisdom[matches[random.Next(0, matches.Length)]]);
                    }
                    else
                    {
                        Anxious.Send(room, wisdom[current++ % wisdom.Length]);
                    }
                }
                else
                {
                    Anxious.Send(room, wisdom[current++ % wisdom.Length]);
                }
            }
        }
Beispiel #2
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     if (jokes.Length > 0)
     {
         Anxious.Send(room, jokes[current++ % jokes.Length]);
     }
 }
Beispiel #3
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            Match match;

            int n = 1;

            int s = 6;

            if ((match = Regex.Match(text, @"^(\d{1,6}) ?d ?(\d{1,6})", RegexOptions.IgnoreCase)).Success)
            {
                n = Int32.Parse(match.Groups[1].Value);

                s = Int32.Parse(match.Groups[2].Value);
            }
            else
            if ((match = Regex.Match(text, @"^d ?(\d{1,6})", RegexOptions.IgnoreCase)).Success)
            {
                n = 1;

                s = Int32.Parse(match.Groups[1].Value);
            }

            if (1 <= n && n <= 10 && 2 <= s && s <= 999)
            {
                Anxious.Send(room, "Rolls <" + Rolls(n, s) + "> for " + Title.GetTitle(user) + ".");
            }
        }
Beispiel #4
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            Match match;

            if ((match = Regex.Match(text, @"^(\S*)\s+(\S.*)", RegexOptions.IgnoreCase)).Success)
            {
                if (match.Groups[1].Value.Equals(Network.m_configuration.m_handleCurrent, StringComparison.OrdinalIgnoreCase))
                {
                }
                else
                if (match.Groups[1].Value.Equals("nickserv", StringComparison.OrdinalIgnoreCase))
                {
                }
                else
                if (match.Groups[1].Value.Equals(user, StringComparison.OrdinalIgnoreCase))
                {
                    messages.Add(new Message(match.Groups[1].Value, user, match.Groups[2].Value));

                    Anxious.Send(room, "You will be notified next time you join the room.");
                }
                else
                {
                    messages.Add(new Message(match.Groups[1].Value, user, match.Groups[2].Value));

                    Anxious.Send(room, Title.GetTitle(match.Groups[1].Value) + " will be notified next time they join the room.");
                }
            }
        }
Beispiel #5
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     if (questions.Length > 0)
     {
         Anxious.Send(room, questions[random.Next(0, questions.Length)] + ".");
     }
 }
Beispiel #6
0
 /**
  *  If the module needs to do anything when a user parts the channel
  *  this method can be used. It gets called whenever a user parts an
  *  observed channel. Modules that don't need to monitor this, won't
  *  be called, and thus this function, can be alltogether be removed
  */
 public static void OnUserPart(string user, string room)
 {
     if (Permission.IsBlacklisted(user))
     {
         if (offenses.Count > 0)
         {
             Anxious.Send(room, offenses[random.Next(0, offenses.Count)].Replace("<name>", user));
         }
     }
 }
Beispiel #7
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     if (date > DateTime.Now)
     {
         Anxious.Send(room, "Fallout 4 will release in " + (date - DateTime.Now).Days + " days, " + (date - DateTime.Now).Hours + " hours and " + (date - DateTime.Now).Minutes + " minutes.");
     }
     else
     {
         Anxious.Send(room, "Fallout 4 was released " + (DateTime.Now - date).Days + " days ago.");
     }
 }
Beispiel #8
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            if (genres.Length > 2 && themes.Length > 0 && people.Length > 0)
            {
                genres = genres.OrderBy(x => random.Next()).ToArray();

                if (random.Next(0, 3) == 0)
                {
                    Anxious.Send(room, Title.GetTitle(user) + ", make a " + genres[0] + " " + genres[1] + " " + themes[random.Next(0, themes.Length)] + " featuring " + people[random.Next(0, people.Length)] + ".");
                }
                else
                {
                    Anxious.Send(room, Title.GetTitle(user) + ", make a " + genres[0] + " " + genres[1] + " " + themes[random.Next(0, themes.Length)] + ".");
                }
            }
        }
Beispiel #9
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            Anxious.Send(room, "Sending a command list in private.");

            Anxious.Send(user, "MODULE:                     >> EXAMPLE:                       >> SYNONYMS:");
            Anxious.Send(user, "Coin flipping:              >> !flip<number>                  >> {coin, coinflip, coins, flip}");
            Anxious.Send(user, "Dice rolling:               >> !roll <number>d<sides>         >> {die, dice, roll, rolls, throw}");
            Anxious.Send(user, "Card drawing:               >> !draw                          >> {card, cards, draw}");
            Anxious.Send(user, "Genre generator:            >> !idea                          >> {genre, idea, design, game}");
            Anxious.Send(user, "Joke telling:               >> !joke                          >> {joke, jokes, humor, funny}");
            Anxious.Send(user, "Reminding others:           >> !remind <person> <message>     >> {remind, inform, notify, ps}");
            Anxious.Send(user, "Chinese wisdom:             >> !wisdom                        >> {wisdom, chinese, advice}");
            Anxious.Send(user, "Google searching:           >> !google <sentence>             >> {google, search, lookup, find}");
            Anxious.Send(user, "Youtube search lookup:      >> !youtube <sentence>            >> {youtube, video}");

            Anxious.Send(user, "More at: http://hastebin.com/ofogapugot.xml");
        }
Beispiel #10
0
        /**
         *  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
         *  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
         *  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
         */
        public static void OnUserJoin(string user, string room)
        {
            for (int i = (messages.Count - 1); (i + 1) > 0; i--)
            {
                if (messages[i].t.Equals(user, StringComparison.OrdinalIgnoreCase))
                {
                    if (messages[i].t.Equals(messages[i].f, StringComparison.OrdinalIgnoreCase))
                    {
                        Anxious.Send(room, Title.GetTitle(messages[i].t) + ", You asked me to remind you: " + messages[i].m);
                    }
                    else
                    {
                        Anxious.Send(room, Title.GetTitle(messages[i].t) + ", " + Title.GetTitle(messages[i].f) + " has asked me to remind you: " + messages[i].m);
                    }

                    messages.RemoveAt(i);

                    return;
                }
            }
        }
Beispiel #11
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            Match match;

            if ((match = Regex.Match(text, @"((?:https?:\/\/)?www\.\S+\.\S+)", RegexOptions.IgnoreCase)).Success)
            {
                try
                {
                    var s = (new WebClient()).DownloadString(match.Groups[1].Value);

                    var r = Regex.Match(s, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value;

                    if (r.Length > 0)
                    {
                        Anxious.Send(room, WebUtility.HtmlDecode(r), true);
                    }
                }
                catch
                {
                }
            }
            else
            if ((match = Regex.Match(text, @"(https?:\/\/\S+\.\S+)", RegexOptions.IgnoreCase)).Success)
            {
                try
                {
                    var s = (new WebClient()).DownloadString(match.Groups[1].Value);

                    var r = Regex.Match(s, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value;

                    if (r.Length > 0)
                    {
                        Anxious.Send(room, WebUtility.HtmlDecode(r), true);
                    }
                }
                catch
                {
                }
            }
        }
Beispiel #12
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://thecatapi.com/api/images/get?format=src&type=gif");

                request.AllowAutoRedirect = false;

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                string r = response.Headers["Location"];

                response.Close();

                if (r.Length > 0)
                {
                    Anxious.Send(room, r);
                }
            }
            catch
            {
            }
        }
Beispiel #13
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "http://stackoverflow.com/search?q=" + WebUtility.UrlEncode(text));
 }
Beispiel #14
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "https://www.tumblr.com/search/" + WebUtility.UrlEncode(text));
 }
Beispiel #15
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "https://simple.wikipedia.org/w/index.php?search=" + WebUtility.UrlEncode(text));
 }
Beispiel #16
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "http://www.bbc.co.uk/search?q=" + WebUtility.UrlEncode(text));
 }
Beispiel #17
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "http://www.metacritic.com/search/game/" + WebUtility.UrlEncode(text) + "/results");
 }
Beispiel #18
0
        /**
         *  This event is called whenever someone, either in a private query
         *  or in a channel, calls up the bot, with any command that matches
         *  this modules synonyms. Any remaining part of the message is then
         *  delivered here along with the room to reply to, and the user who
         *  called it. In order to send out a message back out, then use the
         *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
         *  supposed to be send in private then insert the user parameter in
         *  the target, else insert the rooms parameter. In the message part
         *  please keep the replies short to avoid sending too much flooding
         */
        public static void OnMessage(string user, string room, string text)
        {
            if (current == 50)
            {
                remaining = new string[]
                {
                    "Ace of clubs",
                    "Two of clubs",
                    "Three of clubs",
                    "Four of clubs",
                    "Five of clubs",
                    "Six of clubs",
                    "Seven of clubs",
                    "Eight of clubs",
                    "Nine of clubs",
                    "Ten of clubs",
                    "Jack of clubs",
                    "Queen of clubs",
                    "King of clubs",

                    "Ace of diamonds",
                    "Two of diamonds",
                    "Three of diamonds",
                    "Four of diamonds",
                    "Five of diamonds",
                    "Six of diamonds",
                    "Seven of diamonds",
                    "Eight of diamonds",
                    "Nine of diamonds",
                    "Ten of diamonds",
                    "Jack of diamonds",
                    "Queen of diamonds",
                    "King of diamonds",

                    "Ace of spades",
                    "Two of spades",
                    "Three of spades",
                    "Four of spades",
                    "Five of spades",
                    "Six of spades",
                    "Seven of spades",
                    "Eight of spades",
                    "Nine of spades",
                    "Ten of spades",
                    "Jack of spades",
                    "Queen of spades",
                    "King of spades",

                    "Ace of hearts",
                    "Two of hearts",
                    "Three of hearts",
                    "Four of hearts",
                    "Five of hearts",
                    "Six of hearts",
                    "Seven of hearts",
                    "Eight of hearts",
                    "Nine of hearts",
                    "Ten of hearts",
                    "Jack of hearts",
                    "Queen of hearts",
                    "King of hearts",

                    "Joker"
                };

                remaining = remaining.OrderBy(n => random.Next()).ToArray();

                current = 0;
            }

            Anxious.Send(room, "Deals a <" + remaining[current++] + "> to " + Title.GetTitle(user) + ".");
        }
Beispiel #19
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "https://www.google.com/#q=" + WebUtility.UrlEncode(text));
 }
Beispiel #20
0
 /**
  *  This event is called whenever someone, either in a private query
  *  or in a channel, calls up the bot, with any command that matches
  *  this modules synonyms. Any remaining part of the message is then
  *  delivered here along with the room to reply to, and the user who
  *  called it. In order to send out a message back out, then use the
  *  syntax of 'Anxious.Send(<target>, <message>)'. If the message is
  *  supposed to be send in private then insert the user parameter in
  *  the target, else insert the rooms parameter. In the message part
  *  please keep the replies short to avoid sending too much flooding
  */
 public static void OnMessage(string user, string room, string text)
 {
     Anxious.Send(room, "https://www.youtube.com/results?search_query=" + WebUtility.UrlEncode(text));
 }