Closed petrspelos closed 4 years ago
Hello! I'm interested in helping with this feature. First time contributor here, eager to learn! Experience in C, hoping it transfers over to C#... Let me know if I can be assigned to this issue.
Hello, @lopezayl! Welcome! By all means, we're really glad you decided to help out. If you have any questions, feel free to ask. And of course this task is all yours. 😊
Also, if you'd like a more direct Q&A experience, we have a Discord server you can join. Once you read and accept the rules, there is a #miunie-dev channel just for this project. 🙂
Architecture got reworked, the issue is now applicable again. 🎉
The Service implementation (MiscService) still applies the same as above.
We have moved our string resources (previously found in the Lang.json files) into Strings.resx
This is where you can define new Keys & Values.
Ideally you would have a single key: YES_NO_MAYBE
with the different output values being seperated with {{OR}}
Example:
This would in effect give it the randomness because we already pick a random value in the method: GetPhrase()
The rest of the implementation would still be the same:
Inside the MiscService call SendMessage from IDiscordMessages and pass in the new Phrase. YES_NO_MAYBE.
Due to this issue being open for nearly a month now and it being a nice easy beginer freindly one, It is now open again for someone else to take.
Since noone is interested in this one, I'm gonna grab it :)
I'm interested in doimg this
Sadly this issue is blocked while we implement some side features. If you want to keep up to date with the latest projects we are doing though, please feel free to join our Discord Server. You can find a link to it on the main page of this Repo :)
This is yet again up for grabs. 😊
It would be fun to implement a command like this:
Point being it would be a random Yes/No/Maybe answer.
How this should be done
MiscService.cs
This feature should be provided by a
MiscService
(standing for Miscellaneous service).This new
MiscService.cs
fits in nicely to where all the other services are, that is:Miunie/src/Miunie.Core/Services
IDiscordMessages
dependencyIn your
MiscService
create a constructor that will getIDiscordMessages messages
passed into it as a parameter and store it in a local field. 💡 See this example for inspiration.Miunie needs to know what to say in response.
You should create a new language entry by editing the
Miunie/src/Miunie.Core/Strings.resx
file. (💡 you should open this file from Visual Studio for a better editting experience)Ideally you would create a single key:
YES_NO_MAYBE
with the different output values being separated with{{OR}}
💡 Example:
In the previous step you defined
YES_NO_MAYBE
as the Key of your language entry. We now need to add it to the PhraseKeys.All you need to do is add the entry into the
src/Miunie.Core/Entities/PhraseKey.cs
enum.In your
MiscService.cs
you should create a new method. Give it a descriptive name, something likeSendRandomYesNoAnswer
.This method should have the following signature:
public async Task SendRandomYesNoAnswer(MiunieChannel channel)
In this method, simply call
await _messages.SendMessage(
and pass in theMiunieChannel
you got passed into this method and thePhraseKey
you defined in the previous step.The last step is to create a command module in
src/Miunie.Discord/CommandModules
. Something likeMiscCommands.cs
should be fine.Create your module similar to this example.
The only difference between your implementation and the example is that instead of
RemoteRepositoryService
, you want to ask forMiscService
you defined in step 1.You only need to require it in the constructor, nothing else needs to be done for it to get injected, though you do want to store it in a private field
_miscService
or similar.The command attribute should be
"what do you think?"
Then you need to convert the channel into
MiunieChannel
like this inside your command.The last this is to call
await _miscService.SendRandomYesNoAnswer(channel);
🎉 Congrats! You did it, it's time to test your code and submit your changes! If you need help with running the bot or submitting your changes, feel free to contact either me (@petrspelos or @DraxCodes on our discord server, we'll be more than happy to help you out). ❤️