Example #1
0
        public static void ConnCommand(int _i = -1, string _msg = "")
        {
            switch (_i)
            {
            case 0:    //unset
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_0, _msg);
                break;

            case 1:    //define client nick name
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_1, _msg);
                break;

            case 2:    //join left slot of game
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_2, _msg);
                break;

            case 3:    //join right slot of game
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_3, _msg);
                break;

            case 4:    //players list
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_4, _msg);
                break;

            case 5:    //
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_5, _msg);
                break;

            case 6:    //
                SharedCommands.SendCommandHandler(Stream, SharedCommands.Command_6, _msg);
                break;
            }
        }
Example #2
0
 public static void SendMessage(string _command, string _msg)
 {
     foreach (ConnectedClient cntClnt in ConnClientList)
     {
         try
         {
             if (SharedCommands.SendCommandHandler(cntClnt.stream, _command, _msg))
             {
                 Console.WriteLine("Succesfully send msg to {0}", cntClnt.thread.Name);
             }
             else
             {
                 Console.WriteLine("Msg send failed to {0}", cntClnt.thread.Name);
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("cant write to the client... disconnecting...");
             cntClnt.thread.Abort();
             cntClnt.stream.Close();
             cntClnt.Client.Close();
             ConnClientList.Remove(cntClnt);
             Console.WriteLine("RESPONSE ERROR: " + ex);
         }
     }
 }
Example #3
0
        /// <summary>
        /// Displays the current song being played from Spotify
        /// </summary>
        /// <param name="chatter">User that sent the message</param>
        private async Task <DateTime> SpotifyCurrentSongAsync(TwitchChatter chatter)
        {
            try
            {
                _irc.SendPublicChatMessage(await SharedCommands.SpotifyCurrentSongAsync(chatter, _spotify));
            }
            catch (Exception ex)
            {
                await _errHndlrInstance.LogError(ex, "SpotifyFeature", "SpotifyCurrentSong(TwitchChatter)", false, "!spotifysong");
            }

            return(DateTime.Now);
        }
Example #4
0
        protected override void GetDisplayContent(DiscordTarget target, out List <Tuple <string, DiscordLinkEmbed> > tagAndContent)
        {
            tagAndContent = new List <Tuple <string, DiscordLinkEmbed> >();
            List <string> trackedTrades = DLStorage.WorldData.PlayerTrackedTrades[(target as UserLink).Member.Id];

            foreach (string trade in trackedTrades)
            {
                string result = SharedCommands.Trades(trade, out string matchedName, out bool isItem, out StoreOfferList groupedBuyOffers, out StoreOfferList groupedSellOffers);
                if (!string.IsNullOrEmpty(result))
                {
                    continue; // There was an error
                }
                DiscordLinkEmbed embedContent;
                MessageBuilder.Discord.FormatTrades(matchedName, isItem, groupedBuyOffers, groupedSellOffers, out embedContent);
                tagAndContent.Add(new Tuple <string, DiscordLinkEmbed>($"{BaseTag} [{matchedName}]", embedContent));
            }
        }