Skip to content

Commit

Permalink
Platform.populateUserList use Channel as param
Browse files Browse the repository at this point in the history
  • Loading branch information
Supinic committed Oct 15, 2024
1 parent 47f186c commit 440909b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions platforms/cytube.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,10 @@ module.exports = class CytubePlatform extends require("./template.js") {

/**
* Fetches the userlist for a given cytube client.
* @param {string} channelIdentifier
* @param {Channel} channelData
* @returns {string[]}
*/
populateUserList (channelIdentifier) {
const channelData = sb.Channel.get(channelIdentifier, this.platform);
populateUserList (channelData) {
const client = this.clients.get(channelData.ID);
if (!client) {
throw new sb.Error({
Expand Down
4 changes: 2 additions & 2 deletions platforms/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ module.exports = class DiscordPlatform extends require("./template.js") {
);
}

async populateUserList (channelIdentifier) {
const channel = await this.client.channels.fetch(channelIdentifier);
async populateUserList (channelData) {
const channel = await this.client.channels.fetch(channelData.Name);
const guild = await channel.guild.fetch();

await Promise.all([
Expand Down
3 changes: 2 additions & 1 deletion platforms/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ class Platform {
return cacheData;
}

const userList = await this.populateUserList(channelData.Name);
const userList = await this.populateUserList(channelData);

await sb.Cache.setByPrefix(key, userList, {
expiry: 300_000 // 5 minutes
});
Expand Down
3 changes: 1 addition & 2 deletions platforms/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1248,8 +1248,7 @@ module.exports = class TwitchPlatform extends require("./template.js") {
];
}

async populateUserList (channelIdentifier) {
const channelData = sb.Channel.get(channelIdentifier, this);
async populateUserList (channelData) {
return await getActiveUsernamesInChannel(channelData);
}

Expand Down

0 comments on commit 440909b

Please sign in to comment.