-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from lluisd/bans
Bans
- Loading branch information
Showing
9 changed files
with
180 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const config = require("../config") | ||
const TwitchService = require('../services/twitch') | ||
|
||
class Ban { | ||
async getUnbanRequests(target, bot) { | ||
const result = await TwitchService.getUnbanRequests() | ||
if (result !== null) { | ||
const text = result.length > 0 ? `Hay ${result.length} solicitudes de desbaneo pendientes de revisar (${this._getUserNames(result)})` : 'No hay solicitudes de desbaneo pendientes de revisar.' | ||
await bot.say(target, text) | ||
} | ||
} | ||
|
||
async ban(target, username, bot, duration) { | ||
const user = await TwitchService.getUser(username) | ||
|
||
let durationNumber = parseInt(duration) | ||
if (typeof durationNumber !== 'number') { | ||
durationNumber = null | ||
} | ||
|
||
if (user) { | ||
await TwitchService.banUser(user.id, duration) | ||
} | ||
} | ||
|
||
async unban(target, username, bot) { | ||
const user = await TwitchService.getUser(username) | ||
if (user) { | ||
await TwitchService.unBanUser(user.id) | ||
} | ||
} | ||
} | ||
|
||
|
||
module.exports = Ban |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters