Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmethod handle-event "!create-bet"
- [event-type {:keys [channel-id content]}]
- (let [split-content (str/split content #" ")
- pw (get split-content 1)
- game-id (get split-content 2)
- team1 (get split-content 3)
- team2 (get split-content 4)]
- (when (and (= 5 (count split-content))
- (= (hash pw) (:password @state)))
- (swap! state assoc
- :open? true
- :game-id game-id
- :team1 team1
- :team2 team2)
- (m/create-message! (:messaging @state) (:default-announcement-channel @state)
- :content (str "Bets are now open for game " game-id
- "\n" team1 " vs " team2 "!"
- "\ntype ```!bet 1 <amount>``` to bet on " team1
- "\nand ```!bet 2 <amount>``` to bet on " team2
- "\nYou have " (/ (:betting-time @state) 1000) " seconds to make your bet!"))
- (Thread/sleep (:betting-time @state)) ;;want to sleep here without disrupting other commands
- (swap! state assoc :open? false)
- (m/create-message! (:messaging @state) (:default-announcement-channel @state)
- :content "Bets are now closed! Good luck!"))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement