-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.rb
41 lines (31 loc) · 1.01 KB
/
index.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true
# Import librairies
require 'discordrb'
require 'json'
# Read the token file
token = File.read('./utils/token.json')
value_token = JSON.parse(token)
PREFIX = '!'
BOT = Discordrb::Commands::CommandBot.new token: value_token['token'], prefix: PREFIX
# Import of all commands - src/modules/commands/
# Dynamic require in order to have structured project that is easy to navigate without getting lost in it
commands = Dir["src/modules/commands/*.rb"]
commands.each { |i| require_relative "#{i}" }
# Import of all events - src/modules/events/
events = Dir["src/modules/events/*.rb"]
events.each { |n| require_relative "#{n}" }
# Include cmd modules...
BOT.include! PingCmd
BOT.include! ShutdownCmd
BOT.include! ThanksCmd
BOT.include! GetServerIconInfo
BOT.include! HelpCmd
BOT.include! SayCmd
BOT.include! GetUserAvatar
#BOT.include! GetUserInfos
# Include events modules..
BOT.include! JoinAndLeaveEvent
BOT.include! Ready
# Running the bot ... - utils/Run.rb
require_relative 'utils/Run'
run(true)