protected BotSession(MainBot bot) { Bot = bot; UserResource = null; ResponseProcessor = null; ResponseData = null; }
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); }
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; }
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); }
public void Run(MainBot bot) { pluginObject = (ITS3ABPlugin)Activator.CreateInstance(pluginType); pluginObject.Initialize(bot); }
public Plugin(FileInfo file, MainBot parent, int id) { mainBot = parent; this.file = file; Id = id; status = PluginStatus.Off; }
public PrivateSession(MainBot bot, ClientData client) : base(bot) { Client = client; }
public PublicSession(MainBot bot) : base(bot) { }