Esempio n. 1
0
        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");
        }
Esempio n. 2
0
        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
        }
Esempio n. 3
0
        public CommandHandler(DiscordSocketClient client, CustomCommandService service)
        {
            _client = client;

            _client.SetGameAsync(Global.Status, null, ActivityType.Playing);

            _client.SetStatusAsync(UserStatus.DoNotDisturb);

            _service = service;

            //create /handlers

            althandler = new AltAccountHandler(client);

            verificationHandler = new VerificationHandler(client);

            helpMessageHandler = new HelpMessageHandler(client);

            roleAssignerHandler = new RoleAssignerHandler(client);

            supportTicketHandler = new SupportTicketHandler(client);

            _client.MessageReceived += LogMessage;

            _client.MessageReceived += HandleCommandAsync;

            _client.UserJoined += UpdateUserCount;

            _client.UserJoined += WelcomeMessage;

            _client.UserJoined += althandler.CheckAlt;

            _client.MessageReceived += responce;

            _client.UserLeft += UpdateUserCount;

            _client.JoinedGuild += _client_JoinedGuild;

            _client.ReactionAdded += ReactionHandler;

            _client.LatencyUpdated += _client_LatencyUpdated;

            _client.Ready += Init;

            _client.UserUpdated += mork;

            t.Elapsed += DCRS;
            t.Enabled  = true;
            t.Interval = 300000;
            Thread t2 = new Thread(aiTrd);

            t2.Start();

            SwissbotCore.Modules.ModDatabase.Start(_client);
            Console.WriteLine("[" + DateTime.Now.TimeOfDay + "] - " + "Services loaded, update init");
        }
Esempio n. 4
0
        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
        }
Esempio n. 5
0
        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 CustomCommandService.Settings()
            {
                DefaultPrefix       = Global.Preflix,
                HasPermissionMethod = HasPerms
            });

            _handler = new CommandHandler(_client, _commands);

            Console.WriteLine("[" + DateTime.Now.TimeOfDay + "] - " + "Command Handler ready");

            await Task.Delay(-1);

            //jabibot
        }