gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
Can you write to me discordjs 14 version simple code
- User
Can you write to me discordjs 14 version simple code
- Assistant
Certainly! Here's a simple Discord.js version 14 script, that sets up a bot to reply to a "!ping" message with "Pong!".
Make sure you have Node.js, npm, and discord.js v14 installed on your system before running this script. Also, replace "YOUR_BOT_TOKEN" with your own bot's token from Discord Developer Portal.
- First, create a new folder for your project and navigate to it using the command prompt or terminal.
mkdir my-discord-bot cd my-discord-bot- Next, initialize the project using npm and install the discord.js library.
npm init -y npm install discord.js- Create an
index.jsfile in your project folder and copy-paste the following code:
// index.js const { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.Guilds, Intents.FLAGS.GuildMessages], }); client.once('ready', () => { console.log('Client is ready!'); }); client.on('messageCreate', (message) => { if (message.content === '!ping') { message.reply('Pong!'); } }); client.login('YOUR_BOT_TOKEN');
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.