Skip to content

Commit

Permalink
change commands for birhtday to make it easy to use
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed Feb 13, 2024
1 parent 182e9d1 commit 06c872d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,18 @@ Take a screenshot of the current stream and send it to the chat.
!foto
//result: https://external.url/images/cclj35.png
```

## Birthday
Save your own birthdate and get other users birthdays

### commands

```javascript
!micumple 03-08
//result: @myuser cumple el dia 3 de Setiembre
```

```javascript
!cumple @otheruser
//result: @otheruser cumple el dia 3 de Setiembre
```
6 changes: 5 additions & 1 deletion lib/inputParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ class InputParser {
return text.toLowerCase().startsWith('!f5')
}

isAskingForBirthday (text) {
isAskingForGetBirthday (text) {
return text.toLowerCase().startsWith('!cuandocumple')
}

isAskingForAddBirthday (text) {
return text.toLowerCase().startsWith('!cumple')
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ class Messenger {
if (textSplit.length > 0 && inputParser.isAskingForF5(textSplit[0]) && (context['mod'] || context['vip']))
return handlers.stream.refreshPage(target, this.bot, this.notifier.bot)

if (textSplit.length === 2 && inputParser.isAskingForBirthday(textSplit[0]) && textSplit[1].includes('-')) {
if (textSplit.length === 2 && inputParser.isAskingForAddBirthday(textSplit[0]) && textSplit[1].includes('-')) {
return handlers.birthday.addBirthday(target, textSplit.slice(1).join(' '), this.bot, context['display-name'])
}

if (textSplit.length === 2 && inputParser.isAskingForBirthday(textSplit[0]) && !textSplit[1].includes('-')) {
if (textSplit.length === 2 && inputParser.isAskingForGetBirthday(textSplit[0]) && !textSplit[1].includes('-')) {
return handlers.birthday.getBirthday(target, textSplit[1], this.bot)
}
}
Expand Down

0 comments on commit 06c872d

Please sign in to comment.