No description
Find a file
Aki 3695b81de6
Merge pull request #66 from DjDeveloperr/slash
SlashClient & RESTManager can run alone and added APIMap
2020-12-20 21:01:39 +09:00
.github Add issue templates 2020-12-17 18:48:58 +09:00
examples Change names and format codes 2020-11-08 16:58:24 +09:00
src Merge pull request #66 from DjDeveloperr/slash 2020-12-20 21:01:39 +09:00
.eslintrc.js Now we can listen and send event 2020-10-26 02:03:53 +09:00
.gitignore export SlashModule 2020-12-15 11:08:37 +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
CONTRIBUTING.md Update CONTRIBUTING.md 2020-11-06 16:39:03 +09:00
LICENSE feat(LICENSE) 2020-12-02 10:42:42 +09:00
mod.ts Add edit channel feature 2020-12-20 18:11:37 +09:00
package.json We need Update 2020-12-16 23:08:42 +09:00
README.md Update README.md 2020-12-17 14:29:36 +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.
  • Built-in Command Framework,
    • Easily build Commands on the fly.
    • Completely Customizable.
    • Complete Object-Oriented approach.
  • 100% Discord API Coverage.
  • Customizable caching.
    • Built in support for Redis.
    • Write Custom Cache Adapters.
  • Complete TypeScript support.

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/harmony-org/harmony/main/mod.ts too.

For a quick example, run this:

deno run --allow-net https://deno.land/x/harmony/examples/ping.ts

And input your bot's token and Intents.

Here is a small example of how to use harmony,

import { Client, Message, Intents } 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.ping}`)
  }
})

// Connect to gateway
// Replace with your bot's token and intents (Intents.All, Intents.None, Intents.Presence, Intents.GuildMembers)
client.connect('super secret token comes here', Intents.All)

Or with CommandClient!

import {
  CommandClient,
  Command,
  CommandContext,
  Message,
  Intents
} 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.ping}ms`)
  }
}

client.commands.add(PingCommand)

// Connect to gateway
// Replace with your bot's token and intents (Intents.All, Intents.None, Intents.Presence, Intents.GuildMembers)
client.connect('super secret token comes here', Intents.All)

Or with Decorators!

import {
  Client,
  event,
  Intents,
  command,
  CommandContext,
} 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!')
  }
}

// Connect to gateway
// Replace with your bot's token and intents (Intents.All, Intents.None, Intents.Presence, Intents.GuildMembers)
new MyClient().connect('super secret token comes here', Intents.All)

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 Harmony Org

Made with ❤ by Harmony-org