2022-07-21 01:55:08 +00:00
|
|
|
|
using System.Reflection;
|
2018-05-06 20:09:17 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
namespace RegexBot;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The RegexBot client instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class RegexbotClient {
|
2018-05-06 20:09:17 +00:00
|
|
|
|
/// <summary>
|
2022-03-29 05:03:01 +00:00
|
|
|
|
/// Gets application instance configuration.
|
2018-05-06 20:09:17 +00:00
|
|
|
|
/// </summary>
|
2022-12-05 00:30:50 +00:00
|
|
|
|
internal Configuration Config { get; }
|
2018-05-11 06:13:00 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the Discord client instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DiscordSocketClient DiscordClient { get; }
|
2019-02-16 00:49:54 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all loaded modules in an iterable form.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal IReadOnlyCollection<RegexbotModule> Modules { get; }
|
2018-05-06 20:09:17 +00:00
|
|
|
|
|
2022-12-05 00:30:50 +00:00
|
|
|
|
internal RegexbotClient(Configuration conf, DiscordSocketClient client) {
|
2022-03-29 05:03:01 +00:00
|
|
|
|
Config = conf;
|
|
|
|
|
DiscordClient = client;
|
2018-05-11 06:13:00 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
// Get all services started up
|
|
|
|
|
_svcLogging = new Services.Logging.LoggingService(this);
|
2022-08-17 23:59:30 +00:00
|
|
|
|
_svcSharedEvents = new Services.SharedEventService.SharedEventService(this);
|
2022-12-05 00:30:50 +00:00
|
|
|
|
_svcGuildState = new Services.ModuleState.ModuleStateService(this, conf.ServerConfigs);
|
2022-03-29 05:03:01 +00:00
|
|
|
|
_svcCommonFunctions = new Services.CommonFunctions.CommonFunctionsService(this);
|
|
|
|
|
_svcEntityCache = new Services.EntityCache.EntityCacheService(this);
|
2018-05-11 06:13:00 +00:00
|
|
|
|
|
2022-07-28 02:23:49 +00:00
|
|
|
|
var ver = Assembly.GetExecutingAssembly().GetName().Version!.ToString(3);
|
|
|
|
|
_svcLogging.DoLog(nameof(RegexBot), $"{nameof(RegexBot)} v{ver} - https://github.com/NoiTheCat/RegexBot");
|
2022-05-26 02:27:53 +00:00
|
|
|
|
|
2022-03-29 05:03:01 +00:00
|
|
|
|
// Load externally defined functionality
|
|
|
|
|
Modules = ModuleLoader.Load(Config, this);
|
2018-05-06 20:09:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|