gizmo385 / discord.clj

A Clojure library for creating Discord bots
MIT License
45 stars 14 forks source link

Is there a straightforward way to send a message that isn't a reply? #11

Closed JasonKDarby closed 5 years ago

JasonKDarby commented 5 years ago

I'm looking to set up a reminder such that the bot will post a message to a specific channel on a specific server on a schedule.

I see that say needs to be called within the context of build-handler-fn and can't specify a channel directly. I also see that say* looks like it can specify a channel but is private. I tried debugging to check out a message's channel and saw that it only had an id. Could I potentially use that id or just save that entire channel object if I tried to make a say function that worked outside of build-handler-fn?

Is there already a way to do what I'm looking for or maybe there's a better way to go about it?

Thanks!

gizmo385 commented 5 years ago

There is a send-message function in the http name space that you should be able to leverage to send unprompted messages.

JasonKDarby commented 5 years ago

Thanks again! It was super easy. I was able to store the channel from a message to the bot and then call discord.http/send-message using (:auth (:client my-bot)) where my-bot was the returned value from discord.bot/create-bot.