Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Talbot committed Jun 14, 2018
1 parent 26a5ad4 commit 7b28c82
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion TODO.md
Expand Up @@ -100,4 +100,8 @@ Cache avec Redis ? (ex : liste des 1000 derniers utilisateurs)
* "!timer minactivity <nbmessages>" doit avoir au moins <nbmessages> entre deux timer messages d'affichés



1. User envoie une commande sur Twitch/Discord
(twitch : enregistrer userstate)
2. CommandHandle trouve la commande à "handle"
3. On demande au command.userProvider (TwitchUserProvider/DiscordUserProvider) de nous donner un DTOUser (avec rôle)
4. On donne le DTOUser+command au Voter et il nous dit si c'est ok ou non
1 change: 1 addition & 0 deletions lib/Connector/TwitchConnectorIO.js
Expand Up @@ -127,6 +127,7 @@ module.exports = class TwitchConnectorIO extends ConnectorIO {
return;
}
const commandParsed = TwitchConnectorIO.parseCommand(message);
console.log(userstate);

switch (userstate['message-type']) {
case 'action':
Expand Down
3 changes: 2 additions & 1 deletion lib/DTO/User.js
@@ -1,6 +1,7 @@
module.exports = class User {
constructor (id, username) {
constructor (id, username, roles = []) {
this.id = id;
this.username = username;
this.roles = roles;
}
};
5 changes: 4 additions & 1 deletion lib/Provider/TwitchUserProvider.js
Expand Up @@ -11,13 +11,16 @@ module.exports = class TwitchUserProvider extends AbstractUserProvider {
}

async retrieveUser (username) {
console.log(username);
const user = await this.twitchAPIHandler.getUserInfoByUsername(username).catch(err => {
this.logger.error(err);
});
if (user === null) {
return null;
}

return new UserDTO(user.id, user.display_name);
console.log(user);

return new UserDTO(user.id, user.display_name, []);
}
};

0 comments on commit 7b28c82

Please sign in to comment.