Beispiel #1
0
 public ReactionRoleService(DiscordSocketClient client, GuildsDefinition guildsDefinition)
 {
     this.client              = client;
     this.guildsDefinition    = guildsDefinition;
     client.ReactionAdded    += ReactionAdded;
     client.ReactionRemoved  += ReactionRemoved;
     client.ReactionsCleared += ReactionCleared;
 }
Beispiel #2
0
        public async Task MainAsync()
        {
            if (!LoadBotDefinition())
            {
                throw new Exception("No token provided.");
            }

            guildsDefinition = new GuildsDefinition();

            client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel         = LogSeverity.Info,
                MessageCacheSize = 100
            });

            client.Log   += Log;
            client.Ready += OnReadyAsync;

            lavaConfig = new LavaConfig();
            lavaNode   = new LavaNode(client, lavaConfig);

            reactionRoleService = new ReactionRoleService(client, guildsDefinition);

            commandService = new CommandService();
            commandHandler = new CommandHandler(BuildServiceProvider(), client, commandService, botDefinition);

            await commandHandler.InstallCommandsAsync();

            await client.LoginAsync(TokenType.Bot, token);

            await client.StartAsync();

            await client.SetGameAsync(botDefinition.GetCurrent().status, null, ActivityType.Playing);

            // Block this task until the program is closed.
            await Task.Delay(-1);
        }
Beispiel #3
0
 public ReactionRoleModule(DiscordSocketClient client, GuildsDefinition guildsDefinition, ReactionRoleService roleService)
 {
     this.client           = client;
     this.guildsDefinition = guildsDefinition;
     this.roleService      = roleService;
 }
Beispiel #4
0
 public UserModule(GuildsDefinition gd)
 {
     guildsDefinition = gd;
 }
Beispiel #5
0
 public SettingsUserModule(GuildsDefinition guildsDefinition)
 {
     gd = guildsDefinition;
 }