public RightsManager(MainBot bot, RightsManagerData rmd) { botParent = bot; rightsManagerData = rmd; cachedRights = new Cache <InvokerData, ExecuteContext>(); registeredRights = new HashSet <string>(); }
public UserSession(MainBot bot, ClientData client) { this.client = client; Bot = bot; ResponseProcessor = null; ResponseData = null; }
protected BotSession(MainBot bot) { Bot = bot; UserResource = null; ResponseProcessor = null; ResponseData = null; }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnConnected += Lib_OnConnected; Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public ExecutionInformation(MainBot bot, InvokerData invoker, string textMessage, UserSession userSession = null) { Bot = bot; TextMessage = textMessage; InvokerData = invoker; Session = userSession; }
public PluginManager(MainBot bot, PluginManagerData pmd) { mainBot = bot ?? throw new ArgumentNullException(nameof(bot)); pluginManagerData = pmd; Util.Init(ref plugins); Util.Init(ref usedIds); }
public Plugin(FileInfo file, MainBot parent, int id) { mainBot = parent; this.file = file; Id = id; status = PluginStatus.Off; }
public ResourceFactoryManager(MainBot bot) { mainBot = bot; Util.Init(ref allFacories); Util.Init(ref resFactories); Util.Init(ref listFactories); }
public void Initialize(MainBot mainBot) { //bot = mainBot.Bots.GetBot(0); bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); bot.PlayManager.AfterResourceStarted += PlayManager_AfterResourceStarted; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = bot.QueryConnection.GetLowLibrary <Ts3FullClient>(); mainBot.RightsManager.RegisterRights("PMRedirect.isowner"); lib.OnTextMessageReceived += Lib_OnTextMessageReceived; Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public Plugin(FileInfo pluginFile, MainBot parent, int id) { mainBot = parent; PluginFile = pluginFile; Id = id; Status = PluginStatus.Off; corePluginType = PluginType.None; }
public void Initialize(Core mainBot) { bot = mainBot.Bots.GetBot(0); lib = bot.QueryConnection.GetLowLibrary <Ts3FullClient>(); mainBot.RightsManager.RegisterRights("TestPlugin.dummyperm"); //lib.OnErrorEvent() PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
//TickWorker pushUpdate; public SongChangedEvent(string sitePath, MainBot bot) : base(sitePath) { playMgr = bot.PlayManager; audio = bot.AudioFramework; playListMgr = bot.PlaylistManager; playMgr.AfterResourceStarted += Audio_OnResourceStarted; //pushUpdate = TickPool.RegisterTick(InvokeEvent, TimeSpan.FromSeconds(5), true); }
public UserSession(MainBot bot, ClientData client) { Bot = bot; Client = client; ResponseProcessor = null; ResponseData = null; Token = null; }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); //var PluginPath = Directory.GetCurrentDirectory(); //Directory.CreateDirectory(Path.Combine(PluginPath, "ClientQuery")); PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); StartTelnetServer(IPAddress.Parse(Settings.Default.HostAddress), Settings.Default.Port); }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnClientMoved += Lib_OnClientMoved; lib.OnConnected += Lib_OnConnected; Timer = TickPool.RegisterTick(Tick, TimeSpan.FromSeconds(1), false); Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public Goal_Achievement_Control() { InitializeComponent(); BaseBot bot = new MainBot(); //композиция this.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); }
public void Initialize(MainBot mainBot) { bot = mainBot; mainBot.RightsManager.RegisterRights("TestPlugin.dummyperm"); lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); mainBot.QueryConnection.OnClientConnect += QueryConnection_OnClientConnect; mainBot.QueryConnection.OnClientDisconnect += QueryConnection_OnClientDisconnect; mainBot.QueryConnection.OnMessageReceived += QueryConnection_OnMessageReceived; mainBot.PlayManager.AfterResourceStarted += PlayManager_AfterResourceStarted; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public WebDisplay(MainBot bot) : base(bot) { var baseDir = new DirectoryInfo(Path.Combine("..", "..", "Web", "Interface")); var dir = new FolderProvider(baseDir); map.Map("/", dir); map.Map("/site/", dir); Site404 = map.TryGetSite(new Uri("http://localhost/404.html")); map.Map("/", map.TryGetSite(new Uri("http://localhost/index.html"))); }
public BotCommandTests() { bot = new MainBot(); var prop = typeof(MainBot).GetProperty(nameof(MainBot.CommandManager)); if (prop != null) { prop.SetValue(bot, new CommandManager()); } bot.CommandManager.RegisterMain(bot); }
public WebManager(MainBot mainBot, WebData webd) { webData = webd; webListener = new HttpListener { AuthenticationSchemes = AuthenticationSchemes.Anonymous | AuthenticationSchemes.Basic, Realm = WebRealm, }; webListener.AuthenticationSchemeSelectorDelegate = AuthenticationSchemeSelector; InitializeSubcomponents(mainBot); }
public void RegisterMain(MainBot main) { if (baseCommands.Count > 0) { throw new InvalidOperationException("Operation can only be executed once."); } foreach (var com in GetBotCommands(GetCommandMethods(main))) { LoadCommand(com); baseCommands.Add(com); } }
public void Initialize(MainBot mainBot) { bot = mainBot; //var pluginPath = mainBot.ConfigManager.GetDataStruct<PluginManagerData>("PluginManager", true).PluginPath; var pluginPath = "Plugins"; cfgfile = Path.Combine(pluginPath, $"{PluginInfo.Name}.cfg"); try { if (File.Exists(cfgfile)) { var parser = new FileIniDataParser(); cfg = parser.ReadFile(cfgfile); PluginLog(Log.Level.Debug, $"cfgfile = {cfgfile}"); if (cfg["Ignore"]["uids"].Contains(',')) { whitelistUID = cfg["Ignore"]["uids"].Split(',').ToList(); } else { whitelistUID.Add(cfg["Ignore"]["uids"]); } if (cfg["Ignore"]["sgids"].Contains(',')) { var _whitelistSGID = cfg["Ignore"]["sgids"].Split(','); foreach (var wsgid in _whitelistSGID) { whitelistSGID.Add(ServerGroupIdT.Parse(wsgid)); } } else { whitelistSGID.Add(ServerGroupIdT.Parse(cfg["Ignore"]["sgids"])); } } } catch (Exception ex) { throw new Exception($"{PluginInfo.Name} Can't load \"{cfgfile}\"! Error:\n{ex}"); cfg = new IniData(); //while (!Setup()) { } } ispfile = Path.Combine(pluginPath, "ISPs.txt"); PluginLog(Log.Level.Debug, $"ispfile = {ispfile}"); if (File.Exists(ispfile)) { isps = File.ReadAllLines(ispfile).ToList(); } lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnClientEnterView += Lib_OnClientEnterView; lib.OnConnected += Lib_OnConnected; ClearCache = TickPool.RegisterTick(Tick, TimeSpan.FromMinutes(UInt64.Parse(cfg["General"]["clearcache"])), false); Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
private void InitializeSubcomponents(MainBot mainBot) { startWebServer = false; if (webData.EnableApi) { Api = new Api.WebApi(mainBot); startWebServer = true; } if (webData.EnableWebinterface) { Display = new Interface.WebDisplay(mainBot); startWebServer = true; } }
public static void Main(string[] args) { IWebHost webHost = CreateWebHostBuilder(args).Build(); MainBot KpBot = new MainBot(webHost.Services); Task t1 = KpBot.KeepAlive(); //try //{ // Task t2 = KpBot.MainAsync(); //} //catch //{ //} webHost.Run(); }
public void RegisterMain(MainBot main) { if (BaseCommands != null) { throw new InvalidOperationException("Operation can only be executed once."); } var comList = new List <BotCommand>(); foreach (var com in GetBotCommands(GetCommandMethods(main))) { LoadCommand(com); comList.Add(com); } BaseCommands = comList.AsReadOnly(); }
static void Main(string[] args) { const bool writeSubCommands = false; var bot = new MainBot(); typeof(MainBot).GetProperty(nameof(MainBot.CommandManager)).SetValue(bot, new CommandManager()); bot.CommandManager.RegisterMain(bot); var lines = new List <string>(); foreach (var com in bot.CommandManager.AllCommands) { if (!writeSubCommands && com.InvokeName.Contains(" ")) { continue; } string description; if (string.IsNullOrEmpty(com.Description)) { description = " - no description yet -"; } else { description = com.Description; } lines.Add($"* *{com.InvokeName}*: {description}"); } // adding commands which only have subcommands lines.Add("* *history*: Shows recently played songs."); lines.Sort(); string final = string.Join("\n", lines); Console.WriteLine(final); File.WriteAllText("docs.txt", final); Console.ReadLine(); }
public UserSession CreateSession(MainBot bot, ClientData client) { if (bot == null) { throw new ArgumentNullException(nameof(bot)); } lock (openSessions) { if (openSessions.TryGetValue(client.ClientId, out var session)) { return(session); } Log.Write(Log.Level.Debug, "SM User {0} created session with the bot", client.NickName); session = new UserSession(bot, client); openSessions.Add(client.ClientId, session); return(session); } }
public void Initialize(MainBot mainBot) { var dbpath = Path.Combine(Directory.GetCurrentDirectory(), "RegistriertChannel.db"); var firstStart = File.Exists(dbpath); if (firstStart) { SQLiteConnection.CreateFile(dbpath); } db = new SQLiteConnection("Data Source=" + dbpath + ";Version=3;"); db.Open(); if (firstStart) { new SQLiteCommand("create table optout (uid varchar(28))", db).ExecuteNonQuery(); } bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnClientMoved += Lib_OnClientMoved; lib.OnTextMessageReceived += Lib_OnTextMessageReceived; Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
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); }
public int AddToRobotsDict(MainBot robot) { robots.Add (robot); return robots.Count - 1; }
public void RegisterMain(MainBot main) { if (BaseCommands != null) throw new InvalidOperationException("Operation can only be executed once."); var comList = new List<BotCommand>(); foreach (var com in GetBotCommands(GetCommandMethods(main))) { LoadCommand(com); comList.Add(com); } BaseCommands = comList.AsReadOnly(); }