Closed hgsipiere closed 3 years ago
Hi, I've added some more content to the command docs: https://hackage.haskell.org/package/calamity-0.1.20.1/docs/Calamity-Commands-Dsl.html
If there's some part you're confused by please let me know.
Hi, so my understanding of Polysemy is that we want to run all our effects so we get rid of metrics with runMetricsNoop
. When I do runDiNoop
I seem to get an infinite loop, what am I doing wrong?
This is the project: https://github.com/hgsipiere/problem
Specifically this is the problematic line set:
void . P.runFinal . P.embedToFinal. D.runDiNoop . runCacheInMemory . runMetricsNoop . useConstantPrefix "!" $ runBotIO (BotToken token) $ do addCommands $ do helpCommand
It seems like DiPolysemy is logging, so I assume that's what to do if I want no logging.
Hm, I compiled that project and everything works fine.
Hi sorry, it does work perfectly I was just confused. When I ran the calamity example, there seems to be logging without a run Di. If I wanted that level of logging and nothing extra (which I realise now is more than noop), what would you recommend?
ah, I've forgotten to update calamity-example.
The project that's up to date is calamity-bot, you can see an example of usage here: https://github.com/nitros12/calamity-bot/blob/master/src/CalamityBot.hs#L43
If you want to control the log level, use the filter function from di-core: https://hackage.haskell.org/package/di-core-1.0.4/docs/Di-Core.html#v:filter
Ahh thank you, that sorted my problem. The other thing that I'm confused about is the ban example (https://hackage.haskell.org/package/calamity-0.1.20.1/docs/Calamity-Commands-Dsl.html ), my alternative was
void . invoke $ CreateGuildBan guild uid (CreateGuildBanData Nothing $ Just r)
. reason
seems to conditionally implement the typeclass Request
to give invoke
from Calamity.HTTP.Reason
; in this case it also doesn't complete the curried CreateGuildBan
since it needs a GuildBanData
. There is also another definition of reason
as an AuditLogEntry constructor but that takes a Maybe Text
which is a type mismatch I think.
The other things that I was confused about were guilds since the Discord UI calls them servers, snowflakes and what bot tokens were. These were just sorted from consulting the Discord API documentation (this clarified what deleteMessageDays are for as another example).
Is there a discord or irc for questions? An issue feels kind of inappropriate.
the 'ban' example is incorrect and is missing the ban data yeah, the Calamity.HTTP.Reason.reason
function is used to add the X-Audit-Log-Reason
http header to the request, the 'reason' field of CreateGuildBanData
is the correct way to attach the reason info for bans.
I'll push an update correcting that example in a bit.
I've made a guild for calamity here: https://discord.gg/NGCThCY
Thank you, that guild is helpful. I don't know if a tutorial will be helpful as it more easily falls out of sync with the source than the documentation.
At first I thought it might be helpful to explain what the examples actually do line by line but this is more to maintain. I suppose a tutorial could be paired with a CI that runs periodically to check it builds with the latest calamity but this is a lot.
I'll close this issue tomorrow unless you have any thoughts.
On Sat, 12 Sep 2020, 22:05 Ben Simms, notifications@github.com wrote:
the 'ban' example is incorrect and is missing the ban data yeah, the Calamity.HTTP.Reason.reason function is used to add the X-Audit-Log-Reason http header to the request, the 'reason' field of CreateGuildBanData is the correct way to attach the reason info for bans.
I'll push an update correcting that example in a bit.
I've made a guild for this here: https://discord.gg/NGCThCY
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nitros12/calamity/issues/30#issuecomment-691548278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEX4U2SWCJV34FJ7ATQNMXTSFPPB3ANCNFSM4RIL6VYQ .
A tutorial, explaining step by step the DSL would be nice.