Skip to content

Commit

Permalink
Unification of examples (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
dave7895 authored Mar 31, 2021
1 parent 0e47eea commit 11767ed
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions examples/pingpong.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ module Ping

using Discord

function on_message_create(client::Client, event::MessageCreate)
function on_message_create(c::Client, event::MessageCreate)
if event.message.content == "ping"
reply(client, event.message, "Pong!")
reply(c, event.message, "Pong!")
elseif event.message.content == "pong"
reply(client, event.message, "Ping!")
reply(c, event.message, "Ping!")
end
end

function main()
client = Client(ENV["DISCORD_TOKEN"])
open(client)
add_handler!(client, MessageCreate, on_message_create; tag=:ping)
return client
c = Client(ENV["DISCORD_TOKEN"])
open(c)
add_handler!(c, MessageCreate, on_message_create; tag=:ping)
return c
end

end

if abspath(PROGRAM_FILE) == @__FILE__
client = Ping.main()
wait(client)
c = Ping.main()
wait(c)
end

0 comments on commit 11767ed

Please sign in to comment.