Skip to content

Commit

Permalink
Merge pull request #6 from lluisd/remove_trains
Browse files Browse the repository at this point in the history
Remove trains
  • Loading branch information
lluisd authored Aug 27, 2024
2 parents 8207266 + e7a9a8b commit 2fc15db
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 2,746 deletions.
49 changes: 24 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# twitch-mz-bot

A twitch chatbot to get specific information about weather predictions, train timings and other information.
A twitch chatbot to get specific information about weather predictions and other information.

Status: https://mz-status.311312.xyz/

Expand All @@ -20,10 +20,6 @@ TELEGRAM_CHAT_ID //Telegram chat id to send the notifications
EXTERNAL_URL //external url of the running app to create the public image urls
BROWSERLESS_URL //browserless websocket url to take screenshots
BROWSERLESS_TOKEN //browserless token
MYSQL_HOST //mysql host ip/domain
MYSQL_USER //mysql user
MYSQL_PASSWORD //mysql password
MYSQL_DB //mysql database
STATUS_URL //uptime url for /status tiwtch chat command
WHITE_LIST_ADMINS //twitch user ids seperated by comma to run ban/unban commands
WHITE_LIST_EDITORS //twitch user ids seperated by comma to run !title/!game commands
Expand All @@ -33,37 +29,22 @@ WHITE_LIST_EDITORS //twitch user ids seperated by comma to run !title/!game comm
Information from weather comes from AEMET OpenData to get Spain weather predictions.

### commands
```javascript
```code
!amanecer girona
//result: Girona amanece a las 08:02
```

```javascript
```code
!atardecer girona
//result: Girona atardece a las 17:59
```

## Train
~Find next departure time of the train from a given origin and destination. It uses the renfe GTFS dataset improved_gtfs.zip (https://gtfs.pro/en/spain/Renfe-Operadora/renfe)~

### commands

```javascript
~!md girona, sant celoni~
~//result: Próximo tren MD de Girona a Sant Celoni sale a las 14:49:00~
```

```javascript
~!ave girona, sants~
~//result: Próximo tren AVE de Girona a Barcelona-Sants sale a las 16:30:00~
```

## Photo
Take a screenshot of the current stream and send it to the chat.

### commands

```javascript
```code
!foto
//result: https://external.url/i/cclj35.jpg
```
Expand All @@ -73,12 +54,30 @@ Save your own birthdate and get other users birthdays

### commands

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

```javascript
```code
!cumple @otheruser
//result: @otheruser cumple el dia 3 de Setiembre
```

## Bans
Get band requests, ban, unban, timeout

### commands

```code
!bans
//result: a**a, as**sd ban requests pending
```

```code
!ban username //bans username from the cannel
!timeout username //bans username during 600 (by default) seconds
!timeout username 60 //bans username during 60 seconds
!unban username //removes the ban of the given username
```
6 changes: 0 additions & 6 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ module.exports = {
token: process.env.BROWSERLESS_TOKEN,
version: process.env.BROWSERLESS_VERSION
},
mariadb: {
host: process.env.MYSQL_HOST,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
db: process.env.MYSQL_DB
},
statusUrl: process.env.STATUS_URL,
whitelistAdmins: process.env.WHITE_LIST_ADMINS.split(','),
whitelistEditors: process.env.WHITE_LIST_EDITORS.split(',')
Expand Down
2 changes: 0 additions & 2 deletions handlers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const Generic = require('./generic')
const Weather = require('./Weather')
const Train = require('./Train')
const Stream = require('./Stream')
const Birthday = require('./Birthday')
const TempsDeFlors = require('./TempsDeFlors')
Expand All @@ -10,7 +9,6 @@ const Events = require('./Events')
module.exports = {
generic: new Generic(),
weather: new Weather(),
train: new Train(),
stream: new Stream(),
birthday: new Birthday(),
tempsDeFlors: new TempsDeFlors(),
Expand Down
28 changes: 0 additions & 28 deletions handlers/train.js

This file was deleted.

60 changes: 0 additions & 60 deletions helpers/mysqlManager.js

This file was deleted.

8 changes: 0 additions & 8 deletions lib/inputParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ class InputParser {
return text.startsWith('!amanecer')
}

isAskingForNextMDTrain (text) {
return text.toLowerCase().startsWith('!md')
}

isAskingForNextAveTrain (text) {
return text.toLowerCase().startsWith('!ave')
}

isAskingForTakeScreenshot (text) {
return text.toLowerCase().startsWith('!foto')
}
Expand Down
8 changes: 0 additions & 8 deletions lib/messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ class Messenger {
return handlers.weather.getSunrise(target, textSplit.slice(1).join(' '), this.bot)
}

if (textSplit.length > 2 && inputParser.isAskingForNextMDTrain(textSplit[0])) {
return handlers.train.getNextMD(target, textSplit.slice(1).join(' '), this.bot)
}

if (textSplit.length > 2 && inputParser.isAskingForNextAveTrain(textSplit[0])) {
return handlers.train.getNextAVE(target, textSplit.slice(1).join(' '), this.bot)
}

if (textSplit.length > 0 && inputParser.isAskingForF5(textSplit[0]) &&
(this._isVip(context) || this._isMod(context) || this._isBroadcaster(context)))
return handlers.stream.refreshPage(target, this.bot, this.notifier.bot)
Expand Down
77 changes: 14 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"dotenv": "^16.4.5",
"ejs": "^3.1.10",
"express": "^4.19.2",
"mariadb": "^3.3.0",
"mathjs": "^12.4.1",
"moment": "^2.30.1",
"moment-precise-range-plugin": "^1.3.0",
Expand Down
14 changes: 0 additions & 14 deletions services/renfe.js

This file was deleted.

Loading

0 comments on commit 2fc15db

Please sign in to comment.