gpt-3.5-turbo-0613· OpenAI WildChat-4.8M (AI2)
discord.js exapmle
- User
discord.js exapmle
- Assistant
Sure! Here's a simple example of a Discord bot using the discord.js library:
const Discord = require('discord.js'); const client = new Discord.Client(); const prefix = '!'; // Prefix for bot commands client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }); client.on('message', (message) => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).trim().split(' '); const command = args.shift().toLowerCase(); // Command examples: if (command === 'ping') { message.channel.send('Pong!'); } else if (command === 'say') { const text = args.join(' '); message.channel.send(text); } else if (command === 'avatar') { if (!message.mentions.users.size) { return message.channel.send(`Your avatar: ${message.author.displayAvatarURL({ format: 'png', dynamic: true })}`); } const avatarList = message.mentions.users.map(user => { return `${user.username}'s avatar: ${user.displayAvatarURL({ format: 'png', dynamic: true })}`; }); message.channel.send(avatarList); } }); client.login('your-discord-token');This code sets up a basic Discord bot that listens for messages and responds to certain commands. It includes three example commands:
ping,say, andavatar. When the bot receives a message starting with the prefix, it checks the command and executes the corresponding code.Make sure to replace
'your-discord-token'with your Discord bot token, which you can get by creating a bot on the Discord Developer Portal (https://discord.com/developers/applications).Feel free to customize and expand this code to fit your needs!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.