gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
discord.js exapmle
- User
discord.js exapmle
- Assistant
Sure! Here is a simple example of how to use Discord.js to create a bot that sends a message when a user joins a server:
const Discord = require('discord.js'); const client = new Discord.Client(); client.on('ready', () => { console.log(`Logged in as ${client.user.tag}`); }); client.on('guildMemberAdd', (member) => { const channel = member.guild.channels.cache.find(channel => channel.name === 'general'); if (!channel) return; channel.send(`Welcome to the server, ${member.user}!`); }); client.login('YOUR_DISCORD_BOT_TOKEN');Make sure to replace
'YOUR_DISCORD_BOT_TOKEN'with your actual bot token. You can obtain a bot token by creating a new bot in the Discord Developer Portal.This example uses the
guildMemberAddevent to detect when a user joins a server. It then sends a welcome message to thegeneralchannel of that server. You can modify this code to suit your needs or add more functionality to your bot.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.