public CommandHandler(DiscordSocketClient client, CustomCommandService service, HandlerService s) { _client = client; _client.SetGameAsync(Global.Status, null, ActivityType.Playing); _client.SetStatusAsync(UserStatus.DoNotDisturb); _service = service; handlerService = s; _client.MessageReceived += LogMessage; _client.MessageReceived += HandleCommandAsync; //_client.UserJoined += _client_UserLeft; _client.UserJoined += WelcomeMessage; //_client.MessageReceived += responce; //_client.UserLeft += _client_UserLeft; _client.JoinedGuild += _client_JoinedGuild; _client.ReactionAdded += ReactionHandler; _client.MessageReceived += CheckYoutube; _client.Ready += Init; SwissbotCore.Modules.ModDatabase.Start(_client); Console.WriteLine("[" + DateTime.Now.TimeOfDay + "] - " + "Services loaded, update init"); }
public async Task StartAsync() { WebSocketServer.Create(); Global.systemSlash = "/"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("[" + DateTime.Now.TimeOfDay + "] - " + "Welcome, " + Environment.UserName); Global.ReadConfig(); _t = new TranscriptHandler(); await DiscordAuthKeeper.Init(); _client = new DiscordSocketClient(new DiscordSocketConfig { LogLevel = LogSeverity.Debug, AlwaysDownloadUsers = true, }); _client.Log += Log; await _client.LoginAsync(TokenType.Bot, Global.Token); await _client.StartAsync(); Global.Client = _client; _commands = new CustomCommandService(new Settings() { DefaultPrefix = Global.Preflix, HasPermissionMethod = HasPerms, CustomGuildPermissionMethod = new Dictionary <ulong, Func <SocketCommandContext, bool> >() { { 592458779006730264, HasPerms }, { 622150031092350976, (SocketCommandContext c) => { return(true); } }, { 726857672942420070, (SocketCommandContext c) => { return(false); } }, { 706397254000443392, (SocketCommandContext c) => { return(true); } } }, AllowCommandExecutionOnInvalidPermissions = true, DMCommands = false }); handlerService = new HandlerService(_client); _handler = new CommandHandler(_client, _commands, handlerService); Global.ConsoleLog("Creating Server..."); _server = new HttpServer(3000); Global.ConsoleLog("Server running!"); await Task.Delay(-1); //jabibot }
public async Task StartAsync() { Global.systemSlash = "/"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("[" + DateTime.Now.TimeOfDay + "] - " + "Welcome, " + Environment.UserName); Global.ReadConfig(); //_services = new ServiceCollection().AddSingleton(new AudioService()); _client = new DiscordSocketClient(new DiscordSocketConfig { LogLevel = LogSeverity.Debug, AlwaysDownloadUsers = true, //MessageCacheSize = 99999, }); _client.Log += Log; await _client.LoginAsync(TokenType.Bot, Global.Token); await _client.StartAsync(); Global.Client = _client; _commands = new CustomCommandService(new Settings() { DefaultPrefix = Global.Preflix, HasPermissionMethod = HasPerms, CustomGuildPermissionMethod = new Dictionary <ulong, Func <SocketCommandContext, bool> >() { { 592458779006730264, HasPerms }, { 622150031092350976, (SocketCommandContext c) => { return(true); } } }, AllowCommandExecutionOnInvalidPermissions = true, DMCommands = false }); handlerService = new HandlerService(_client); _handler = new CommandHandler(_client, _commands, handlerService); await Task.Delay(-1); //jabibot }