/// <summary> /// Called when the bot is shutting down or restarting. /// </summary> private Task OnShuttingDownAsync(ShuttingDownEventArgs e) { shutdownMode = e.Mode; shutdownEvent.Set(); return(Task.FromResult <object>(null)); }
public static async Task InvokeAsync(this AsyncEvent <ShuttingDownEventHandler> eventHandler, ShuttingDownEventArgs e) { var subscribers = eventHandler.Subscriptions; for (int i = 0; i < subscribers.Count; i++) { await subscribers[i].Invoke(e).ConfigureAwait(false); } }