#get channel id (fixed)
1 messages · Page 1 of 1 (latest)
I believe you have the same problem as I do
what are giving when you console the result.id?
i think, you need make someone like this:
const something = await interaction.guild.channels.create ....
console.log(something.id or something.channel.id)
because
you need to fetch it?
wait
const channel = client.channels.cache.get('id');
i need to get it like this, or get channel id by its name
result.id works. but createdchannel doesnt
let me investigate
ok
i will create a command like your's on my bot to see
ok
i tryed this code https://stackoverflow.com/questions/62627099/discord-js-how-to-get-channel-id-using-its-name
and it didnt work
you will probably have to fetch the roles
why roles?
i will create a test role
role_mods_id
I don't know to what extent channels.create only accepts the role id
I'll see
I tell you something
its for support to see that channel and also for author
with this it says undefined
yes i know that
I was just wondering if he accepted just the id without fetch the roles first
I went to see the docs
and accepts
I'm going to create a test role and see if it works
I haven't tested the create channel part yet.
no no
it creates channel with perms fine
but i after channel is created, i need to get its id to send message
ye
i will test it now
@tardy patio
const { MessageEmbed } = require('discord.js');
const colors = require('colors/safe');
module.exports = {
name: 'test',
description: 'test!',
cooldown: 5,
args: false,
usage: '',
guildOnly: true,
aliases: ['test'],
// eslint-disable-next-line no-unused-vars
async execute(client, message, args) {
try {
const min = 0;
const max = 9999;
const count = Math.floor(Math.random() * (max - min + 1)) + min;
const author = message.author.username;
const createdChannel = await message.guild.channels.create(`${author}${count}`, {
type: 'GUILD_TEXT',
permissionOverwrites: [{
id: message.author.id,
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
},
{
id: message.guild.id,
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
},
{
id: '981650027879481434',
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
},
],
});
const channel = client.channels.cache.get(createdChannel.id);
channel.send({ content: 'test' });
}
catch (error) {
console.log(colors.brightRed(error));
}
},
};
just change the message to interaction
should work
ok ill try it
and also adapts the roles id
adapts?
oh
the roles id que vem do config.json
fuck corrector
the roles.id settings that come from config.json
const { role_stuff_id, role_mods_id, role_supports_id } = require("../../settings.json")
something just @neon wigeon
bruh
now it shows error in event handler
omg thanks
it works
get channel id (fixed)
¯_(ツ)_/¯
sure
on
can u send u code
again
not to be adapting again
np
i was working on this shit for like 2 days xd
ive created some bots but on latest node version im having problems with everything xd
im too old to relearn it xd