Browse Source

Updated CommandsHandler.rb

Added prefix to each command in commands.
Now it shows prefix when using the COMMANDS argument in files.
master
Tearzz 6 years ago
committed by GitHub
parent
commit
e900325a66
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      CommandsHandler.rb

+ 7
- 2
CommandsHandler.rb View File

@ -20,6 +20,10 @@ def HandleCommands(line)
"commands",
"chatbot",]
if commands.length > 0
commands.map! { |command| prefix + command } # apply prefix to all commands
end
replacements = [
["USER", "@#{user}"],
["CHANNEL", "#{CHANNEL}"],
@ -50,7 +54,7 @@ def HandleCommands(line)
# ----- ADMIN COMMANDS ----- #
if user == CHANNEL
admin_commands.each do |command, value|
if message.include?(prefix + command)
if message.include?(command)
return value + "\r\n"
end
end
@ -58,7 +62,8 @@ def HandleCommands(line)
# ----- COMMANDS ----- #
commands.each do |command|
if message.include?(prefix + command)
if message.include?(command)
command.tr!("!", "") # Remove "!"
file = open("Responses/" + command + ".txt")
response = file.read
file.close

Loading…
Cancel
Save