-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
38 lines (32 loc) · 1.12 KB
/
Copy pathutils.js
File metadata and controls
38 lines (32 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const { guildId, logChannelId } = require('./config.json');
module.exports = {
getOnlineUsersByRoleId: getOnlineUsersByRoleId,
initDevChannel: initDevChannel,
log: log
}
function getOnlineUsersByRoleId(interaction, roleId) {
const role = interaction.guild.roles.cache.find(role => role.id === roleId); // Replace with the exact name of the role
if (!role) {
log('Tried to find users by role, but role with specified ID was not found')
}
const membersWithRole = role.members.filter(member => member.presence && member.presence.status && member.presence.status !== 'offline');
return membersWithRole;
}
let channel;
function initDevChannel(client) {
const server = client.guilds.cache.get(guildId);
if (server) {
channel = server.channels.cache.get(logChannelId);
if (channel) {
console.log(`Connected to dev channel: ${channel.name}`);
log(`Bot is up and running`);
} else {
console.log('Dev channel not found.');
}
} else {
console.log('Dev server not found.');
}
}
function log(text) {
channel.send(text);
}