Example #1
0
 protected BotSession(MainBot bot)
 {
     Bot = bot;
     UserResource = null;
     ResponseProcessor = null;
     ResponseData = null;
 }
Example #2
0
		public PluginManager(MainBot bot, PluginManagerData pmd)
		{
			if (bot == null)
				throw new ArgumentNullException(nameof(bot));

			mainBot = bot;
			pluginManagerData = pmd;
			Util.Init(ref plugins);
			Util.Init(ref usedIds);
		}
Example #3
0
        public BotSession CreateSession(MainBot bot, ushort invokerId)
        {
            if (bot == null)
                throw new ArgumentNullException(nameof(bot));

            if (ExistsSession(invokerId))
                return GetSession(MessageTarget.Private, invokerId);
            ClientData client = bot.QueryConnection.GetClientById(invokerId);
            if (client == null)
                throw new SessionManagerException("Could not find the requested client.");
            var newSession = new PrivateSession(bot, client);
            openSessions.Add(newSession);
            return newSession;
        }
Example #4
0
		static void Main(string[] args)
		{
			using (MainBot bot = new MainBot())
			{
				AppDomain.CurrentDomain.UnhandledException += (s, e) =>
				{
					Log.Write(Log.Level.Error, "Critical program failure! Logs will follow.");
					Exception ex = e.ExceptionObject as Exception;
					while (ex != null)
					{
						Log.Write(Log.Level.Error, "MSG: {0}\nSTACK:{1}", ex.Message, ex.StackTrace);
						ex = ex.InnerException;
					}
					bot?.Dispose();
				};

				if (!bot.ReadParameter(args)) return;
				if (!bot.InitializeBot()) return;
				bot.Run();
			}
		}
 public BotCommandTests()
 {
     bot = new MainBot();
     typeof(MainBot).GetProperty(nameof(MainBot.CommandManager)).SetValue(bot, new CommandManager());
     bot.CommandManager.RegisterMain(bot);
 }
Example #6
0
		public void Run(MainBot bot)
		{
			pluginObject = (ITS3ABPlugin)Activator.CreateInstance(pluginType);
			pluginObject.Initialize(bot);
		}
Example #7
0
		public Plugin(FileInfo file, MainBot parent, int id)
		{
			mainBot = parent;
			this.file = file;
			Id = id;
			status = PluginStatus.Off;
		}
Example #8
0
 public PrivateSession(MainBot bot, ClientData client)
     : base(bot)
 {
     Client = client;
 }
Example #9
0
 public PublicSession(MainBot bot)
     : base(bot)
 {
 }