SuperPEKKA336
SuperPEKKA336
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 11/30/2023 in #djs-questions
Roles not being changed
else if(interaction.isStringSelectMenu()) // String Select Menu Interactions
{
try
{
let roles = interaction.member.roles.cache;
const value = interaction.values;
const COUNTERSTRIKE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_COUNTERSTRIKE);
const FORTNITE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_FORTNITE);
const LEAGUEOFLEGENDS = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_LEAGUEOFLEGENDS);
const MINECRAFT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_MINECRAFT);
const OVERWATCH = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_OVERWATCH);
const RAINBOWSIX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_RAINBOWSIX);
const ROBLOX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROBLOX);
const ROCKETLEAGUE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROCKETLEAGUE);
const VALORANT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_VALORANT);

var isCounterstrike = false;
var isFortnite = false;
var isLeagueoflegends = false;
var isMinecraft = false;
var isOverwatch = false;
var isRainbowsix = false;
var isRoblox = false;
var isRocketleague = false;
var isValorant = false;

roles.map(COUNTERSTRIKE => COUNTERSTRIKE.id);
roles.map(FORTNITE => FORTNITE.id);
roles.map(LEAGUEOFLEGENDS => LEAGUEOFLEGENDS.id);
roles.map(MINECRAFT => MINECRAFT.id);
roles.map(OVERWATCH => OVERWATCH.id);
roles.map(RAINBOWSIX => RAINBOWSIX.id);
roles.map(ROBLOX => ROBLOX.id);
roles.map(ROCKETLEAGUE => ROCKETLEAGUE.id);
roles.map(VALORANT => VALORANT.id);

for(var i = 0; i < value.length; i++)
{
if(value[i] == 'games_counterstrike')
isCounterstrike = true;
else if(value[i] == 'games_fortnite')
isFortnite = true;
else if(value[i] == 'games_leagueoflegends')
isLeagueoflegends = true;
else if(value[i] == 'games_minecraft')
isMinecraft = true;
else if(value[i] == 'games_overwatch')
isOverwatch = true;
else if(value[i] == 'games_rainbowsix')
isRainbowsix = true;
else if(value[i] == 'games_roblox')
isRoblox = true;
else if(value[i] == 'games_rocketleague')
isRocketleague = true;
else if(value[i] == 'games_valorant')
isValorant = true;
}

if(!isCounterstrike)
roles.delete(ROLE_IDS.GAMES_COUNTERSTRIKE);
else if(!isFortnite)
roles.delete(ROLE_IDS.GAMES_FORTNITE);
else if(!isLeagueoflegends)
roles.delete(ROLE_IDS.GAMES_LEAGUEOFLEGENDS);
else if(!isMinecraft)
roles.delete(ROLE_IDS.GAMES_MINECRAFT);
else if(!isOverwatch)
roles.delete(ROLE_IDS.GAMES_OVERWATCH);
else if(!isRainbowsix)
roles.delete(ROLE_IDS.GAMES_RAINBOWSIX);
else if(!isRoblox)
roles.delete(ROLE_IDS.GAMES_ROBLOX);
else if(!isRocketleague)
roles.delete(ROLE_IDS.GAMES_ROCKETLEAGUE);
else if(!isValorant)
roles.delete(ROLE_IDS.GAMES_VALORANT);

return interaction.member.roles.set(roles)
.then((member) =>
interaction.reply(
{
embeds: [EMBEDS.ROLE_CHANGED],
ephemeral: true,
}))
}catch(err)
{
return interaction.reply(
{
embeds: [EMBEDS.ERROR],
ephemeral: true,
});
}
}
else if(interaction.isStringSelectMenu()) // String Select Menu Interactions
{
try
{
let roles = interaction.member.roles.cache;
const value = interaction.values;
const COUNTERSTRIKE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_COUNTERSTRIKE);
const FORTNITE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_FORTNITE);
const LEAGUEOFLEGENDS = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_LEAGUEOFLEGENDS);
const MINECRAFT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_MINECRAFT);
const OVERWATCH = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_OVERWATCH);
const RAINBOWSIX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_RAINBOWSIX);
const ROBLOX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROBLOX);
const ROCKETLEAGUE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROCKETLEAGUE);
const VALORANT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_VALORANT);

var isCounterstrike = false;
var isFortnite = false;
var isLeagueoflegends = false;
var isMinecraft = false;
var isOverwatch = false;
var isRainbowsix = false;
var isRoblox = false;
var isRocketleague = false;
var isValorant = false;

roles.map(COUNTERSTRIKE => COUNTERSTRIKE.id);
roles.map(FORTNITE => FORTNITE.id);
roles.map(LEAGUEOFLEGENDS => LEAGUEOFLEGENDS.id);
roles.map(MINECRAFT => MINECRAFT.id);
roles.map(OVERWATCH => OVERWATCH.id);
roles.map(RAINBOWSIX => RAINBOWSIX.id);
roles.map(ROBLOX => ROBLOX.id);
roles.map(ROCKETLEAGUE => ROCKETLEAGUE.id);
roles.map(VALORANT => VALORANT.id);

for(var i = 0; i < value.length; i++)
{
if(value[i] == 'games_counterstrike')
isCounterstrike = true;
else if(value[i] == 'games_fortnite')
isFortnite = true;
else if(value[i] == 'games_leagueoflegends')
isLeagueoflegends = true;
else if(value[i] == 'games_minecraft')
isMinecraft = true;
else if(value[i] == 'games_overwatch')
isOverwatch = true;
else if(value[i] == 'games_rainbowsix')
isRainbowsix = true;
else if(value[i] == 'games_roblox')
isRoblox = true;
else if(value[i] == 'games_rocketleague')
isRocketleague = true;
else if(value[i] == 'games_valorant')
isValorant = true;
}

if(!isCounterstrike)
roles.delete(ROLE_IDS.GAMES_COUNTERSTRIKE);
else if(!isFortnite)
roles.delete(ROLE_IDS.GAMES_FORTNITE);
else if(!isLeagueoflegends)
roles.delete(ROLE_IDS.GAMES_LEAGUEOFLEGENDS);
else if(!isMinecraft)
roles.delete(ROLE_IDS.GAMES_MINECRAFT);
else if(!isOverwatch)
roles.delete(ROLE_IDS.GAMES_OVERWATCH);
else if(!isRainbowsix)
roles.delete(ROLE_IDS.GAMES_RAINBOWSIX);
else if(!isRoblox)
roles.delete(ROLE_IDS.GAMES_ROBLOX);
else if(!isRocketleague)
roles.delete(ROLE_IDS.GAMES_ROCKETLEAGUE);
else if(!isValorant)
roles.delete(ROLE_IDS.GAMES_VALORANT);

return interaction.member.roles.set(roles)
.then((member) =>
interaction.reply(
{
embeds: [EMBEDS.ROLE_CHANGED],
ephemeral: true,
}))
}catch(err)
{
return interaction.reply(
{
embeds: [EMBEDS.ERROR],
ephemeral: true,
});
}
}
29 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 11/29/2023 in #djs-questions
roles not being added
else if(interaction.isStringSelectMenu()) // String Select Menu Interactions
{
let roles = interaction.member.roles.cache;
const value = interaction.values;
const COUNTERSTRIKE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_COUNTERSTRIKE);
const FORTNITE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_FORTNITE);
const LEAGUEOFLEGENDS = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_LEAGUEOFLEGENDS);
const MINECRAFT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_MINECRAFT);
const OVERWATCH = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_OVERWATCH);
const RAINBOWSIX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_RAINBOWSIX);
const ROBLOX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROBLOX);
const ROCKETLEAGUE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROCKETLEAGUE);
const VALORANT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_VALORANT);

roles.delete(COUNTERSTRIKE.ID);
roles.delete(FORTNITE.ID);
roles.delete(LEAGUEOFLEGENDS.ID);
roles.delete(MINECRAFT.ID);
roles.delete(OVERWATCH.ID);
roles.delete(RAINBOWSIX.ID);
roles.delete(ROBLOX.ID);
roles.delete(ROCKETLEAGUE.ID);
roles.delete(VALORANT.ID);

for(let i; i < value.length; i++)
{
value[i] = value[i].toUpperCase();
}

roles.add(value);

interaction.member.roles.set(roles);
}
else if(interaction.isStringSelectMenu()) // String Select Menu Interactions
{
let roles = interaction.member.roles.cache;
const value = interaction.values;
const COUNTERSTRIKE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_COUNTERSTRIKE);
const FORTNITE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_FORTNITE);
const LEAGUEOFLEGENDS = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_LEAGUEOFLEGENDS);
const MINECRAFT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_MINECRAFT);
const OVERWATCH = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_OVERWATCH);
const RAINBOWSIX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_RAINBOWSIX);
const ROBLOX = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROBLOX);
const ROCKETLEAGUE = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_ROCKETLEAGUE);
const VALORANT = interaction.guild.roles.cache.get(ROLE_IDS.GAMES_VALORANT);

roles.delete(COUNTERSTRIKE.ID);
roles.delete(FORTNITE.ID);
roles.delete(LEAGUEOFLEGENDS.ID);
roles.delete(MINECRAFT.ID);
roles.delete(OVERWATCH.ID);
roles.delete(RAINBOWSIX.ID);
roles.delete(ROBLOX.ID);
roles.delete(ROCKETLEAGUE.ID);
roles.delete(VALORANT.ID);

for(let i; i < value.length; i++)
{
value[i] = value[i].toUpperCase();
}

roles.add(value);

interaction.member.roles.set(roles);
}
79 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 11/28/2023 in #djs-questions
StringSelectMenu interaction isnt working
else if(interaction.isStringSelectMenu()) // String Select Menu Interactions
{
const role = interaction.guild.roles.cache.get(ROLE_IDS[interaction.customId.toUpperCase()]);

if(role)
{
const hasRole = interaction.member.roles.cache.has(role.id);

if(hasRole)
return interaction.member.roles
.remove(role)
.then((member) =>
interaction.reply(
{
embeds: [EMBEDS.ROLE_REMOVED],
ephemeral: true,
})
)
.catch((err) =>
{
console.log(err);
return interaction.reply(
{
embeds: [EMBEDS.ERROR],
ephemeral: true,
});
});
else
return interaction.member.roles
.add(role)
.then((member) =>
interaction.reply(
{
embeds: [EMBEDS.ROLE_ADDED],
ephemeral: true,
})
)
.catch((err) =>
{
console.log(err);
return interaction.reply(
{
embeds: [EMBEDS.ERROR],
ephemeral: true,
});
});
}
}
else if(interaction.isStringSelectMenu()) // String Select Menu Interactions
{
const role = interaction.guild.roles.cache.get(ROLE_IDS[interaction.customId.toUpperCase()]);

if(role)
{
const hasRole = interaction.member.roles.cache.has(role.id);

if(hasRole)
return interaction.member.roles
.remove(role)
.then((member) =>
interaction.reply(
{
embeds: [EMBEDS.ROLE_REMOVED],
ephemeral: true,
})
)
.catch((err) =>
{
console.log(err);
return interaction.reply(
{
embeds: [EMBEDS.ERROR],
ephemeral: true,
});
});
else
return interaction.member.roles
.add(role)
.then((member) =>
interaction.reply(
{
embeds: [EMBEDS.ROLE_ADDED],
ephemeral: true,
})
)
.catch((err) =>
{
console.log(err);
return interaction.reply(
{
embeds: [EMBEDS.ERROR],
ephemeral: true,
});
});
}
}
51 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 9/14/2023 in #djs-questions
Getting an error when deploying commands
Error Message:
Started refreshing 13 application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
10[APPLICATION_COMMANDS_DUPLICATE_NAME]: Application command names must be unique
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1072:23)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:913:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1218:22)
at async /home/container/deploy-commands.js:38:16 {
requestBody: {
files: undefined,
json: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object]
]
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { '10': [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1099029046265909321/guilds/699776656889479299/commands'
}
Started refreshing 13 application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
10[APPLICATION_COMMANDS_DUPLICATE_NAME]: Application command names must be unique
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1072:23)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:913:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1218:22)
at async /home/container/deploy-commands.js:38:16 {
requestBody: {
files: undefined,
json: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object]
]
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { '10': [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1099029046265909321/guilds/699776656889479299/commands'
}
My host runs deploy-commands.js then index.js
16 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 9/13/2023 in #djs-questions
Cannot read properties of undefined "options"
/home/container/events/join.js:13
const role = member.interaction.options.getRole('905893175774822441');
^
TypeError: Cannot read properties of undefined (reading 'options')
at Object.execute (/home/container/events/join.js:13:37)
at Client.<anonymous> (/home/container/index.js:47:44)
at Client.emit (node:events:513:28)
at module.exports [as GUILD_MEMBER_ADD] (/home/container/node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js:17:14)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
at WebSocketManager.emit (/home/container/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
at WebSocketShard.<anonymous> (/home/container/node_modules/@discordjs/ws/dist/index.js:1173:51)
at WebSocketShard.emit (/home/container/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
at WebSocketShard.onMessage (/home/container/node_modules/@discordjs/ws/dist/index.js:988:14)
/home/container/events/join.js:13
const role = member.interaction.options.getRole('905893175774822441');
^
TypeError: Cannot read properties of undefined (reading 'options')
at Object.execute (/home/container/events/join.js:13:37)
at Client.<anonymous> (/home/container/index.js:47:44)
at Client.emit (node:events:513:28)
at module.exports [as GUILD_MEMBER_ADD] (/home/container/node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js:17:14)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
at WebSocketManager.emit (/home/container/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
at WebSocketShard.<anonymous> (/home/container/node_modules/@discordjs/ws/dist/index.js:1173:51)
at WebSocketShard.emit (/home/container/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
at WebSocketShard.onMessage (/home/container/node_modules/@discordjs/ws/dist/index.js:988:14)
9 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/30/2023 in #djs-questions
Kicking a user
if(button === 'kick')
{
const member = interaction.options.getMember('');
member.kick();
}

if(button === 'kick')
{
const member = interaction.options.getMember('');
member.kick();
}

132 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/30/2023 in #djs-questions
Creating a join/leave message
How would I create one? I'm trying to use guildMemberAdd
126 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/29/2023 in #djs-questions
Editing embeds
23 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/29/2023 in #djs-questions
Embeds being sent twice
async execute(interaction)
{
const type = interaction.options.getString('type');
const channel = interaction.options.getChannel('channel');

if(type === 'embed_rules')
{
channel.send(
{
embeds: [EMBEDS.RULES]
});

await interaction.reply(
{
embeds: [EMBEDS.SUCCESS],
ephemeral: true
});
}
}
async execute(interaction)
{
const type = interaction.options.getString('type');
const channel = interaction.options.getChannel('channel');

if(type === 'embed_rules')
{
channel.send(
{
embeds: [EMBEDS.RULES]
});

await interaction.reply(
{
embeds: [EMBEDS.SUCCESS],
ephemeral: true
});
}
}
79 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/27/2023 in #djs-questions
What is returned when getting the value of a .addChannelOption subcommand?
^
50 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/24/2023 in #djs-questions
Message not being sent to a user's DMs
client.users.send(user,
{
embeds: [embed]
});
client.users.send(user,
{
embeds: [embed]
});
64 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 6/8/2023 in #djs-questions
How do I get a user's display name and avatar to use in .setAuthor?
^
33 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/25/2023 in #djs-questions
Embed not being sent
48 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/23/2023 in #djs-questions
Ping is not defined
6 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/23/2023 in #djs-questions
constants.json not found
11 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/22/2023 in #djs-questions
ROLE_ID from .json file is wrong
26 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/21/2023 in #djs-questions
Buttons not being added
19 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/20/2023 in #djs-questions
.getMember casuing an error
20 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/20/2023 in #djs-questions
Sending an array but read as an object
17 replies
DIAdiscord.js - Imagine an app
Created by SuperPEKKA336 on 5/14/2023 in #djs-questions
Buttons not adding roles
73 replies