Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Rewrite #20

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@
"node": "6"
}
}]
],
"plugins": [
["@babel/plugin-proposal-decorators", {
"legacy": true
}]
]
}
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
lib
dev
package-lock.json
/lib
/dev

# Logs
logs
Expand Down
60 changes: 1 addition & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,4 @@ Our right hand to write Discord bots

## Examples

### With decorators (Need babel)

```javascript
import Migi, { command, on } from '@popcorn.moe/migi'

class Ping {
@command(/^ping(?: (.*))?$/)
ping({ channel }, arg) {
channel.send(`Ping ${arg}!`)
}

@on('ready')
onReady() {
console.log('Ready')
}
}

const migi = new Migi({
root: __dirname
})

migi.loadModule(Ping)

migi.on('ready', () => console.log(`Ready @${migi.user.tag}`))

migi.login(process.env.DISCORD_TOKEN)
```

### Without decorators

```javascript
const { Migi } = require('@popcorn.moe/migi')

class Ping {
constructor(migi) {
migi.command(/^ping(?: (.*))?$/, this, 'ping')
migi.listen('ready', this, 'onReady')
}

ping({ channel }, arg) {
channel.send(`Ping ${arg}!`)
}

onReady() {
console.log('Ready')
}
}

const migi = new Migi({
root: __dirname,
messagesUpdate: true
})

migi.loadModule(Ping)

migi.on('ready', () => console.log(`Ready @${migi.user.tag}`))

migi.login(process.env.DISCORD_TOKEN)
```
we need to rewrite this
9 changes: 9 additions & 0 deletions dev/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets" : [
["@babel/preset-env", {
"targets": {
"node": "6"
}
}]
]
}
Loading