mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
added message sending and PM channel resolving
This commit is contained in:
@@ -1,6 +1,25 @@
|
||||
var User = require("./user.js").User;
|
||||
|
||||
exports.PMChannel = function(user, id){
|
||||
this.user = new User(user);
|
||||
this.id = id;
|
||||
class PMChannel {
|
||||
constructor(data, client) {
|
||||
this.user = client.getUser("id", data.recipient.id);
|
||||
this.id = data.id;
|
||||
this.messages = [];
|
||||
}
|
||||
|
||||
addMessage(data){
|
||||
if(!this.getMessage("id", data.id)){
|
||||
this.messages.push(data);
|
||||
}
|
||||
return this.getMessage("id", data.id);
|
||||
}
|
||||
|
||||
getMessage(key, value){
|
||||
for(var message of this.messages){
|
||||
if(message[key] === value){
|
||||
return message;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PMChannel;
|
||||
Reference in New Issue
Block a user