Skip to content

Instantly share code, notes, and snippets.

@dz4k
Last active August 24, 2021 10:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dz4k/dc9ec680b1cd874ac1daac2d209ca26d to your computer and use it in GitHub Desktop.
Save dz4k/dc9ec680b1cd874ac1daac2d209ca26d to your computer and use it in GitHub Desktop.
Discord bot in _hyperscript
require discord.js as Discord
init immediately
make a Discord.Client from {
intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES]
}
set module discord to it
login(process.env.TOKEN) to discord
end
on ready from discord
log 'LOGIN', discord.user.tag
end
on messageCreate(content, author) from discord
log 'MESSAGE', content
if content is '!ping' then
reply(`pong <@${author.id}>`) to event
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment