回答編集履歴
2
コードの改善
test
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
```js
|
2
|
-
const {Client,Collection,GatewayIntentBits,Partials} = require('discord.js');
|
2
|
+
const {Client,Collection,GatewayIntentBits,Partials,ApplicationCommandType, ApplicationCommandOptionType} = require('discord.js');
|
3
3
|
const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages], partials: [Partials.Channel]});
|
4
|
-
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');
|
5
4
|
module.exports = {
|
6
5
|
data: {
|
7
6
|
name: 'test',
|
1
コードの改善
test
CHANGED
@@ -10,8 +10,8 @@
|
|
10
10
|
},
|
11
11
|
async execute(interaction) {
|
12
12
|
await interaction.reply({content: "hello", ephemeral: true});
|
13
|
-
channel = interaction.channel;
|
13
|
+
var channel = interaction.guild.channels.cache.find((channel) => channel.name === "チャンネル名").id;
|
14
|
-
await interaction.channel.send("hello");
|
14
|
+
await interaction.guild.channels.cache.get(channel).send("hello");
|
15
15
|
},
|
16
16
|
};
|
17
17
|
|