瀏覽代碼

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