コード例 #1
0
ファイル: ScpService.cs プロジェクト: Minimum/LanDiscordBot
        public void Initialize()
        {
            Console.WriteLine("Initializing SCP service...");

            // Load SCPs
            try
            {
                Scps = ScpDao.LoadScps();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            if (Scps == null)
            {
                Scps = new Dictionary<int, ScpObject>();

                Scps.Add(173, new ScpObject()
                {
                    Id = 173,
                    Name = "The Sculpture",
                    ObjectClass = ScpObjectClass.Euclid,
                    Description = "It is constructed from concrete and rebar with traces of Krylon brand spray paint. SCP-173 is animate and extremely hostile. The object cannot move while within a direct line of sight. Line of sight must not be broken at any time with SCP-173. Personnel assigned to enter container are instructed to alert one another before blinking. Object is reported to attack by snapping the neck at the base of the skull, or by strangulation. In the event of an attack, personnel are to observe Class 4 hazardous object containment procedures."
                });

                ScpDao.SaveScps(Scps);
            }

            // Load Unknown Responses
            try
            {
                UnknownResponses = ScpDao.LoadUnknownResponses();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            if (UnknownResponses == null)
            {
                UnknownResponses = new List<String>();

                UnknownResponses.Add("I do not know of a SCP-%s, %u, please try again.");

                ScpDao.SaveUnknownResponses(UnknownResponses);
            }

            // Hook chat
            _bot.Chat.OnRegularChatMessage += ChatMessageHook;

            // Register Commands
            _bot.Chat.RegisterCommand("addscp", new AddScpCommand(_bot));
            _bot.Chat.RegisterCommand("editscp", new EditScpCommand(_bot));

            Console.WriteLine("SCP service initialization complete.");

            return;
        }
コード例 #2
0
ファイル: ScpService.cs プロジェクト: Minimum/LanDiscordBot
 public void SaveChanges()
 {
     try
     {
         ScpDao.SaveScps(Scps);
     }
     catch (Exception e)
     {
         System.Console.WriteLine(e);
     }
 }