yellowtides / owenbot-hs

A utility bot written in Haskell for the Edinburgh Informatics Class of ‘24’s main messaging platform (Discord server).
https://yellowtid.es/owenbot-hs/
BSD 3-Clause "New" or "Revised" License
8 stars 7 forks source link

Update discord-haskell to 1.13, update discord-haskell-monad to 1.2.0 #45

Closed yutotakano closed 2 years ago

yutotakano commented 2 years ago

This PR updates discord-haskell to 1.13, and the small discord-haskell-monad library that I made a while back to 1.2.0.

Not ready to merge, waiting for discord-haskell to update to 1.13.1 since we have changes relying on the most recent master commits.

This also fixes the issue plaguing Owen recently where Parse Errors cause a library crash.

Changes

All restCall changed to call, and should be the preferred way forward (this throws errors as exceptions instead of returning Either) The DiscordMonad typeclass doesn't contain all the functions anymore (since it was difficult to keep track which functions were local and which were defined in the class), it only contains call.

Basically stuff like this, but throughout the entire codebase:

- allGuildRoles <- getGuildRoles g
- user          <- getGuildMember g uid
+ allGuildRoles <- call $ GetGuildRoles g
+ user          <- call $ GetGuildMember g uid

Also fixes some new issues introduced by 1.13, like Snowflake parsing with commands, and shortened Interaction Commands datatype names.