No description
Find a file
mierenmanz bffead6680 fmt
2021-04-28 20:29:27 +02:00
.github Update deno.yml 2021-04-11 21:10:14 +09:00
examples remove opine and oak deps and start adding tests 2021-02-01 14:07:54 +05:30
src fmt 2021-04-28 20:29:27 +02:00
test formatting 2021-04-28 20:28:19 +02:00
.eggignore Ready to publish on nest.land 2021-02-25 13:23:01 +09:00
.eslintrc.js 🔧 Edit linter config (disable no-non-null-assertion) 2021-03-26 21:54:15 +09:00
.gitignore move out src/test to test 2021-04-04 11:22:47 +05:30
.prettierrc format files and ready for v0.9.0 2020-12-02 21:29:52 +09:00
banner.png update banner 2020-12-02 16:21:05 +05:30
CODE_OF_CONDUCT.md Add Code of Conduct 2021-01-21 21:58:16 +05:30
CONTRIBUTING.md Update CONTRIBUTING.md 2020-11-06 16:39:03 +09:00
deploy.ts x 2021-04-15 18:23:26 +05:30
deps.ts x 2021-04-04 10:13:26 +05:30
egg.json Add "easy to use" Overwrite type, Make GuildChannel(for base), Separate GuildTextChannel from textChannel.ts 2021-03-20 00:39:14 +09:00
LICENSE bonk part 2 2021-01-21 23:55:05 +09:00
mod.ts export utils/command.ts 2021-04-28 12:43:01 +02:00
package.json Update package.json 2020-12-30 08:58:45 +09:00
README.md client.ping -> client.gateway.ping 2021-04-17 13:47:46 +05:30
tsconfig.json format files and ready for v0.9.0 2020-12-02 21:29:52 +09:00

banner

An easy to use Discord API Library for Deno

Support


  • Lightweight and easy to use.
  • Complete Object-Oriented approach.
  • Slash Commands supported.
  • Built-in Commands framework.
  • Customizable Caching, with Redis support.
  • Use @decorators to easily make things!
  • Made with ❤️ TypeScript.

Table of Contents

Usage

You 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.

You can also check(not import) the module in https://nest.land/package/harmony (link for importing is in the site).

For a quick example, run this:

deno run --allow-net https://deno.land/x/harmony/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/mod.ts'

const client = new Client()

// 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('super secret token comes here', [
  GatewayIntents.DIRECT_MESSAGES,
  GatewayIntents.GUILDS,
  GatewayIntents.GUILD_MESSAGES
])

Or with CommandClient!

import {
  CommandClient,
  Command,
  CommandContext,
  GatewayIntents
} from 'https://deno.land/x/harmony/mod.ts'

const client = new CommandClient({
  prefix: '!'
})

// 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('super secret token comes here', [
  GatewayIntents.DIRECT_MESSAGES,
  GatewayIntents.GUILDS,
  GatewayIntents.GUILD_MESSAGES
])

Or with Decorators!

import {
  event,
  CommandClient,
  command,
  CommandContext,
  GatewayIntents
} from 'https://deno.land/x/harmony/mod.ts'

class MyClient extends CommandClient {
  constructor() {
    super({
      prefix: ['!', '!!'],
      caseSensitive: false
    })
  }

  @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('super secret token comes here', [
  GatewayIntents.DIRECT_MESSAGES,
  GatewayIntents.GUILDS,
  GatewayIntents.GUILD_MESSAGES
])

Docs

Documentation is available for main (branch) and stable (release).

Found a bug or want support? Join our discord server!

Widget for the Discord Server

Maintainer

@Helloyunho

Contributing

See the contributing file!

Pull Requests are accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2020-2021 Harmonyland

Made with ❤ by Harmonyland