public async Task MainAsync() { responder = new WebsocketResponder(this); Path = setStorage ?? Environment.GetEnvironmentVariable("ANDROID_STORAGE", EnvironmentVariableTarget.Machine); if (Path == null) { Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/android_bot/"; Console.WriteLine("%ANDROID_STORAGE% has not been set, falling back to " + Path); } if (!Path.EndsWith("/")) { Console.WriteLine("%ANDROID_STORAGE% does not end with a backslash"); Path += "/"; } ApiKey = ApiKey ?? Environment.GetEnvironmentVariable("ANDROID_STEAM_API", EnvironmentVariableTarget.Machine); Client.Log += Log; Client.MessageReceived += (arg) => MessageReceived(arg, false); Client.MessageUpdated += MessageUpdated; await Client.LoginAsync(TokenType.Bot, DiscordToken); await Client.StartAsync(); MuteSystem = new MuteSystem(this); await MuteSystem.Initialise(); Listeners.AddRange(ActiveListeners); foreach (MessageListener listener in Listeners) { await listener.Initialise(this); Console.WriteLine(listener.GetType().Name + " initialised"); } WebsocketServer.Start(); await Task.Run(() => { while (true) { if (shouldShutDown && Client.ConnectionState == ConnectionState.Disconnected) { break; } } }); }
public MuteSystem(Android android) { this.android = android; Main = this; }