Procházet zdrojové kódy

added images/ folder and matchup command.

kmbrown418 před 6 roky
rodič
revize
4f591fd3b0
20 změnil soubory, kde provedl 15 přidání a 2 odebrání
  1. 2 1
      README.md
  2. 13 1
      bot.rb
  3. binární
      images/Type Bug.png
  4. binární
      images/Type Dark.png
  5. binární
      images/Type Dragon.png
  6. binární
      images/Type Electric.png
  7. binární
      images/Type Fairy.png
  8. binární
      images/Type Fighting.png
  9. binární
      images/Type Fire.png
  10. binární
      images/Type Flying.png
  11. binární
      images/Type Ghost.png
  12. binární
      images/Type Grass.png
  13. binární
      images/Type Ground.png
  14. binární
      images/Type Ice.png
  15. binární
      images/Type Normal.png
  16. binární
      images/Type Poison.png
  17. binární
      images/Type Psychic.png
  18. binární
      images/Type Rock.png
  19. binární
      images/Type Steel.png
  20. binární
      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

binární
images/Type Bug.png


binární
images/Type Dark.png


binární
images/Type Dragon.png


binární
images/Type Electric.png


binární
images/Type Fairy.png


binární
images/Type Fighting.png


binární
images/Type Fire.png


binární
images/Type Flying.png


binární
images/Type Ghost.png


binární
images/Type Grass.png


binární
images/Type Ground.png


binární
images/Type Ice.png


binární
images/Type Normal.png


binární
images/Type Poison.png


binární
images/Type Psychic.png


binární
images/Type Rock.png


binární
images/Type Steel.png


binární
images/Type Water.png