Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@harmonyland/harmony
Advanced tools
Readme
An easy to use Discord API Library for Deno and Node.js
@decorators
supportedYou can import the package from https://deno.land/x/harmony/mod.ts (with latest version) or can add a version too, and raw GitHub URL (latest unpublished version) https://raw.githubusercontent.com/harmonyland/harmony/main/mod.ts too.
We also have a (fancy) custom registry for importing Harmony! It's at code.harmony.rocks, example import URL: https://code.harmony.rocks/v2.6.1
.
You can install and use the NPM package published under @harmonyland/harmony
.
Documentation is available main branch or latest stable version (v2.6.1). You can also check out the guide.
For a quick example, run this:
deno run --allow-net https://deno.land/x/harmony@v2.6.1/examples/ping.ts
And input your bot's token.
Here is a small example of how to use harmony,
import {
Client,
Message,
GatewayIntents
} from 'https://deno.land/x/harmony@v2.6.1/mod.ts'
const client = new Client({
intents: [
'GUILDS',
'DIRECT_MESSAGES',
'GUILD_MESSAGES'
],
// token: optionally specify, otherwise DISCORD_TOKEN from env is used
})
// Listen for event when client is ready (Identified through gateway / Resumed)
client.on('ready', () => {
console.log(`Ready! User: ${client.user?.tag}`)
})
// Listen for event whenever a Message is sent
client.on('messageCreate', (msg: Message): void => {
if (msg.content === '!ping') {
msg.channel.send(`Pong! WS Ping: ${client.gateway.ping}`)
}
})
// Connect to gateway
client.connect()
Or with CommandClient!
import {
CommandClient,
Command,
CommandContext,
GatewayIntents
} from 'https://deno.land/x/harmony@v2.6.1/mod.ts'
const client = new CommandClient({
prefix: '!',
intents: [
'GUILDS',
'DIRECT_MESSAGES',
'GUILD_MESSAGES'
],
// token: optionally specify, otherwise DISCORD_TOKEN from env is used
})
// Listen for event when client is ready (Identified through gateway / Resumed)
client.on('ready', () => {
console.log(`Ready! User: ${client.user?.tag}`)
})
// Create a new Command
class PingCommand extends Command {
name = 'ping'
execute(ctx: CommandContext) {
ctx.message.reply(`pong! Ping: ${ctx.client.gateway.ping}ms`)
}
}
client.commands.add(PingCommand)
// Connect to gateway
client.connect()
Or with Decorators!
import {
event,
CommandClient,
command,
CommandContext,
GatewayIntents
} from 'https://deno.land/x/harmony@v2.6.1/mod.ts'
class MyClient extends CommandClient {
constructor() {
super({
prefix: ['!', '!!'],
caseSensitive: false,
intents: [
'GUILDS',
'DIRECT_MESSAGES',
'GUILD_MESSAGES'
],
// token: optionally specify, otherwise DISCORD_TOKEN from env is used
})
}
@event()
ready(): void {
console.log(`Logged in as ${this.user?.tag}!`)
}
@command({ aliases: 'pong' })
Ping(ctx: CommandContext): void {
ctx.message.reply('Pong!')
}
}
new MyClient().connect()
Need support? Join our Discord Server!
Pull requests are welcome!
Small note: If editing the README, please conform to the standard-readme specification.
FAQs
An easy to use and advanced Discord API Library for Deno and Node.js
The npm package @harmonyland/harmony receives a total of 26 weekly downloads. As such, @harmonyland/harmony popularity was classified as not popular.
We found that @harmonyland/harmony demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.