public TemporaryCommandHandler(DiscordBotManager discordBot, CommandHandler commandHandler, User user, params string[] identifiers) { DiscordBot = discordBot; ParentCommandHandler = commandHandler; User = user; BotCommands = new Dictionary<string, BotCommand>(); CommandIdentifiers = new List<string>(identifiers); }
public Dalamud(DalamudStartInfo info, LoggingLevelSwitch loggingLevelSwitch) { this.StartInfo = info; this.loggingLevelSwitch = loggingLevelSwitch; this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath); this.localizationMgr = new Localization(this.StartInfo.WorkingDirectory); if (!string.IsNullOrEmpty(this.Configuration.LanguageOverride)) { this.localizationMgr.SetupWithLangCode(this.Configuration.LanguageOverride); } else { this.localizationMgr.SetupWithUiCulture(); } this.baseDirectory = info.WorkingDirectory; this.unloadSignal = new ManualResetEvent(false); // Initialize the process information. this.targetModule = Process.GetCurrentProcess().MainModule; this.SigScanner = new SigScanner(this.targetModule, true); // Initialize game subsystem this.Framework = new Framework(this.SigScanner, this); // Initialize managers. Basically handlers for the logic this.CommandManager = new CommandManager(this, info.Language); SetupCommands(); this.ChatHandlers = new ChatHandlers(this); this.NetworkHandlers = new NetworkHandlers(this, this.Configuration.OptOutMbCollection); this.Data = new DataManager(this.StartInfo.Language); this.Data.Initialize(); this.ClientState = new ClientState(this, info, this.SigScanner); this.BotManager = new DiscordBotManager(this, this.Configuration.DiscordFeatureConfig); this.WinSock2 = new WinSockHandlers(); try { this.InterfaceManager = new InterfaceManager(this, this.SigScanner); this.InterfaceManager.OnDraw += BuildDalamudUi; } catch (Exception e) { Log.Information(e, "Could not init interface."); } }
public FullMessage(DiscordBotManager discordBot, Message message) { DiscordBot = discordBot; ID = message.ID; Sender = discordBot.ActiveGuild.Users.FirstOrDefault(u => u.ID == message.User.ID); Content = message.Content; Channel = message.GuildID != null? discordBot.ActiveGuild.TextChannels.FirstOrDefault(c => c.ID == message.ChannelID) : discordBot.DMChannels.FirstOrDefault(c => c.ID == message.ChannelID); guild = new Lazy <Guild?>(() => discordBot.ActiveGuild); mentions = new Lazy <IEnumerable <User> >(() => discordBot.ActiveGuild.Users.Where(u => message.Mentions.Any(m => m.ID == u.ID))); mentionRoles = new Lazy <IEnumerable <Role> >(() => discordBot.ActiveGuild.Roles.Where(r => message.MentionRoles.Contains(r.ID))); //TODO: Get list of channels from DMs or other based on channel type mentionChannels = new Lazy <IEnumerable <Channel> >(() => discordBot.ActiveGuild.TextChannels.Where(u => message.MentionChannels.Any(m => m.ID == u.ID))); }
public Dalamud(DalamudStartInfo info) { this.StartInfo = info; this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath); this.baseDirectory = info.WorkingDirectory; this.unloadSignal = new ManualResetEvent(false); // Initialize the process information. this.targetModule = Process.GetCurrentProcess().MainModule; this.sigScanner = new SigScanner(this.targetModule); // Initialize game subsystem Framework = new Framework(this.sigScanner, this); // Initialize managers. Basically handlers for the logic CommandManager = new CommandManager(this, info.Language); SetupCommands(); ChatHandlers = new ChatHandlers(this); NetworkHandlers = new NetworkHandlers(this, this.Configuration.OptOutMbCollection); this.ClientState = new ClientState(this, info, this.sigScanner, this.targetModule); this.BotManager = new DiscordBotManager(this, this.Configuration.DiscordFeatureConfig); this.PluginManager = new PluginManager(this, info.PluginDirectory, info.DefaultPluginDirectory); this.IconReplacer = new IconReplacer(this, this.sigScanner); this.WinSock2 = new WinSockHandlers(); try { this.PluginManager.LoadPlugins(); } catch (Exception ex) { Framework.Gui.Chat.PrintError( "[XIVLAUNCHER] There was an error loading additional plugins. Please check the log for more details."); Log.Error(ex, "Plugin load failed."); } }
public Dalamud(DalamudStartInfo info, LoggingLevelSwitch loggingLevelSwitch) { this.StartInfo = info; this.loggingLevelSwitch = loggingLevelSwitch; this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath); this.baseDirectory = info.WorkingDirectory; this.unloadSignal = new ManualResetEvent(false); // Initialize the process information. this.targetModule = Process.GetCurrentProcess().MainModule; this.SigScanner = new SigScanner(this.targetModule, true); // Initialize game subsystem this.Framework = new Framework(this.SigScanner, this); this.ClientState = new ClientState(this, info, this.SigScanner); this.WinSock2 = new WinSockHandlers(); AssetManager.EnsureAssets(this.baseDirectory).ContinueWith(async task => { if (task.IsCanceled || task.IsFaulted) { throw new Exception("Could not ensure assets.", task.Exception); } this.LocalizationManager = new Localization(this.StartInfo.WorkingDirectory); if (!string.IsNullOrEmpty(this.Configuration.LanguageOverride)) { this.LocalizationManager.SetupWithLangCode(this.Configuration.LanguageOverride); } else { this.LocalizationManager.SetupWithUiCulture(); } var pluginDir = this.StartInfo.PluginDirectory; if (this.Configuration.DoPluginTest) { pluginDir = Path.Combine(pluginDir, "..", "testPlugins"); } PluginRepository = new PluginRepository(this, pluginDir, this.StartInfo.GameVersion); if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_INTERFACE") ?? "false")) { try { InterfaceManager = new InterfaceManager(this, this.SigScanner); InterfaceManager.OnDraw += BuildDalamudUi; InterfaceManager.Enable(); } catch (Exception e) { Log.Information(e, "Could not init interface."); } } Data = new DataManager(this.StartInfo.Language); await Data.Initialize(this.baseDirectory); SeStringManager = new SeStringManager(Data); NetworkHandlers = new NetworkHandlers(this, this.Configuration.OptOutMbCollection); // Initialize managers. Basically handlers for the logic CommandManager = new CommandManager(this, info.Language); SetupCommands(); ChatHandlers = new ChatHandlers(this); // Discord Bot Manager BotManager = new DiscordBotManager(this, this.Configuration.DiscordFeatureConfig); BotManager.Start(); if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false")) { try { PluginRepository.CleanupPlugins(); PluginManager = new PluginManager(this, pluginDir, this.StartInfo.DefaultPluginDirectory); PluginManager.LoadPlugins(); } catch (Exception ex) { Log.Error(ex, "Plugin load failed."); } } this.Framework.Enable(); this.ClientState.Enable(); IsReady = true; }); }