RegexBot/Kerobot/Services/Service.cs
Noikoio 47a738ddbc Remove per-guild schema
All guild data will now be stored within the same table, instead of
a new schema being created for each guild. This avoids issues with
missing schemas.
This likely wasn't a good idea to begin with.
2018-12-18 16:21:35 -08:00

28 lines
1,001 B
C#

using System.Threading.Tasks;
namespace Kerobot.Services
{
/// <summary>
/// Base class for Kerobot services.
/// </summary>
/// <remarks>
/// Services provide the core functionality of this program. Modules are expected to call into methods
/// provided by services for the times when processor-intensive or shared functionality needs to be utilized.
/// </remarks>
internal abstract class Service
{
public Kerobot Kerobot { get; }
public string Name => this.GetType().Name;
public Service(Kerobot kb) => Kerobot = kb;
/// <summary>
/// Creates a log message.
/// </summary>
/// <param name="message">Logging message contents.</param>
/// <param name="report">Determines if the log message should be sent to a reporting channel.</param>
/// <returns></returns>
protected Task Log(string message, bool report = false) => Kerobot.InstanceLogAsync(report, Name, message);
}
}