示例#1
0
 protected BotSession(MainBot bot)
 {
     Bot = bot;
     UserResource = null;
     ResponseProcessor = null;
     ResponseData = null;
 }
示例#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);
		}
示例#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;
        }
示例#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();
			}
		}
示例#5
0
 public BotCommandTests()
 {
     bot = new MainBot();
     typeof(MainBot).GetProperty(nameof(MainBot.CommandManager)).SetValue(bot, new CommandManager());
     bot.CommandManager.RegisterMain(bot);
 }
示例#6
0
		public void Run(MainBot bot)
		{
			pluginObject = (ITS3ABPlugin)Activator.CreateInstance(pluginType);
			pluginObject.Initialize(bot);
		}
示例#7
0
		public Plugin(FileInfo file, MainBot parent, int id)
		{
			mainBot = parent;
			this.file = file;
			Id = id;
			status = PluginStatus.Off;
		}
示例#8
0
 public PrivateSession(MainBot bot, ClientData client)
     : base(bot)
 {
     Client = client;
 }
示例#9
0
 public PublicSession(MainBot bot)
     : base(bot)
 {
 }