knights-of-academia / horace

discord.js bot powering the Knights of Academia server with commands like info, AFK, and more
MIT License
23 stars 19 forks source link

Habitica Expansion (early version) #182

Closed lanqueh closed 3 years ago

lanqueh commented 4 years ago

This commit response to issue #169 (excluding #10 as someone else is working on it, and the command to check 'actual' participation ---- will be coming with other exciting feature!). Track of cowt participation is done using command !log. Setting and checking habitica profile is done with command !habitica.

To account for the possibility that habitica api might be broken, the !clans command would use cache of the leader (more on this later) and memeber count from previous request to generate the clan list. If the information is outdated, !clans update can be used to update the values from habitica API (if it is working!). The authentication informations would be stored in db but a function is provided to insert them to the db from existing js object array like the one in data/clan-data-auth-sample.js. The !apply command however, make request to the API when it is called to make sure it doesn't send the link to the user if the clan is full at that moment.

The command name !log is chosen in mind that such command can potentially be used in other channel for other purposes, e.g. in sleep club, to summarize the user's sleep log. An additional feature, !log details, is added to allow horace sending a dm to the user of all the vows he/she made.

The !habitica command has many sub-command. Therefore a seperate help message is provided (use !habitica or !habitica help to get the dm). It is worth noticing that due to the property of the habitica API, finding out a discord user's habitica profile would require that user to provide their habitica uuid to horace beforehead (or allow a guardian/ the habitica mananger to do so). Consequently, this would require the clan leaders to provide their habitica uuid in order for their discord name to be displayed in the !clans message (otherwise their habitica user name will show up).

There are still some details that needs refinement and some more to come. But with the current functionality I think it is ready for a pull request to get some testing and feedback from the community. I would appericate any feedback in terms of performance and coding styles.

debashisbiswas commented 3 years ago

It's been almost a year since the PR was last active - is there any intention to continue this? Will close if not