mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-10 17:15:43 +02:00
Add a way of retrieving channel and user names from renderer state object
This commit is contained in:
parent
b97c483be9
commit
a42a7b6913
src/renderer
@ -20,13 +20,21 @@ SAVEFILE.prototype.getServer = function(index){
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getChannels = function(){
|
||||
return this.meta.channels || {};
|
||||
return this.meta.channels;
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getChannelById = function(channel){
|
||||
return this.meta.channels[channel] || { id: channel, name: channel };
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getUser = function(index){
|
||||
return this.meta.users[this.meta.userindex[index]] || { name: "<unknown>" };
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getUserById = function(user){
|
||||
return this.meta.users[user] || { name: user };
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.getMessageCount = function(channel){
|
||||
return Object.keys(this.data[channel]).length || 0;
|
||||
};
|
||||
|
@ -21,6 +21,14 @@ var STATE = (function(){
|
||||
}));
|
||||
},
|
||||
|
||||
getChannelName: function(channel){
|
||||
return FILE.getChannelById(channel).name;
|
||||
},
|
||||
|
||||
getUserName: function(user){
|
||||
return FILE.getUserById(user).name;
|
||||
},
|
||||
|
||||
selectChannel: function(channel){
|
||||
selectedChannel = channel;
|
||||
MSGS = Object.keys(FILE.getMessages(channel)).sort();
|
||||
|
Loading…
Reference in New Issue
Block a user