DEV Community

Kien Nguyen Chi
Kien Nguyen Chi

Posted on

OSD600 - Week 5 - Release 0.2 - Hacktoberfest


This week, I start my Release 0.2 Project by working on Hacktoberfest. After few hours or I can say half of a day, scrolling hundreds of projects on Hacktoberfest, I finally find one that interests me. The project is A Discord-Bot to play Werewolf with your friends.

My Issue

The program is written in Rust - language that I haven't used before. I take me a lot of time to read the code and read about Rust syntax to understand how it works. Although this new thing is unfamiliar with me, I still want to give it a try.

Issue Explanation

In the current program, the Bot allows you to start a game round with 0 Players and 0 Roles, which should not happen because it does not make any sense at all.

Working Process

After the step of initializing players for the round, I implement the code to figure out if there is a player or not. If there is more than player, the program will start the round. Otherwise, it will display an appropriate message. The owner supports me a lot to understand how the structure of the program is, so I can implement my code in an appropriate location. Also, the owner supports me about Rust syntax, which I'm not yet familiar.

After finishing everything supposed to work, the owner realizes the string type in Rust does not implement the std::error::Error (for the program to display error message). So we simply create new type of StringError converting string to make the it usable for Rust Error type.

let playerCount: usize = source.state.participants.len();
if playerCount < 1{
      return Err(TransitionError::new(StringError("Cannot start the game with no player".to_string())));
Enter fullscreen mode Exit fullscreen mode


Overall, in order to implement few lines of code, I have to spend a lot of time to read how the Rust language works. This is also a new interesting experience for me to work in a language that I have never done before.

The owner of the repo is very nice. He replies me so quickly whenever I have a question or there is a typo needed to be fixed in my code.

I am very happy that I worked in a project like this. If you are interesting in this project, please take a look at the links provided below.


Owner's Repository: Original Repo
My Repository: My Repo
My Issue: Issue #4
My Pull Request: PR #13

Top comments (0)