浏览代码

added images/ folder and matchup command.

kmbrown418 6 年之前
父节点
当前提交
4f591fd3b0
共有 20 个文件被更改,包括 15 次插入2 次删除
  1. 2 1
      README.md
  2. 13 1
      bot.rb
  3. 二进制
      images/Type Bug.png
  4. 二进制
      images/Type Dark.png
  5. 二进制
      images/Type Dragon.png
  6. 二进制
      images/Type Electric.png
  7. 二进制
      images/Type Fairy.png
  8. 二进制
      images/Type Fighting.png
  9. 二进制
      images/Type Fire.png
  10. 二进制
      images/Type Flying.png
  11. 二进制
      images/Type Ghost.png
  12. 二进制
      images/Type Grass.png
  13. 二进制
      images/Type Ground.png
  14. 二进制
      images/Type Ice.png
  15. 二进制
      images/Type Normal.png
  16. 二进制
      images/Type Poison.png
  17. 二进制
      images/Type Psychic.png
  18. 二进制
      images/Type Rock.png
  19. 二进制
      images/Type Steel.png
  20. 二进制
      images/Type Water.png

+ 2 - 1
README.md

@@ -17,7 +17,8 @@ $ git push origin/[branch_name]       #to push branch
 ```
 
 ### Features
-  * Says hello
+  * Says Hello
+  * Displays Type Matchups
 
 ## Setup
 This application runs using Ruby and Postgres. In order to run the bot locally

+ 13 - 1
bot.rb

@@ -62,10 +62,22 @@ hello = Command.new(:hello) do |event|
   )
 end
 
+matchup = Command.new(:matchup) do |event, type|
+  channel = event.channel.id
+  file = "images/Type #{type.capitalize}.png"
+
+  if File.exists?(file)
+    bot.send_file(channel, File.open(file, 'r'))
+  else
+    bot.respond("I do not know this pokemon type! Please try again!")
+  end
+end
+
 # ---
 
 commands = [
-  hello
+  hello,
+  matchup
 ]
 
 # This will trigger on every message sent in discord

二进制
images/Type Bug.png


二进制
images/Type Dark.png


二进制
images/Type Dragon.png


二进制
images/Type Electric.png


二进制
images/Type Fairy.png


二进制
images/Type Fighting.png


二进制
images/Type Fire.png


二进制
images/Type Flying.png


二进制
images/Type Ghost.png


二进制
images/Type Grass.png


二进制
images/Type Ground.png


二进制
images/Type Ice.png


二进制
images/Type Normal.png


二进制
images/Type Poison.png


二进制
images/Type Psychic.png


二进制
images/Type Rock.png


二进制
images/Type Steel.png


二进制
images/Type Water.png