Skip to content

Commit

Permalink
fix notes amd add dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
Kry9toN committed Jan 27, 2021
1 parent 8bca045 commit 057e1b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"chalk": "^4.1.0",
"child_process": "^1.0.2",
"discord.js": "^12.5.1",
"dotenv": "^8.2.0",
"ejs": "^3.1.5",
"express": "^4.17.1",
"fluent-ffmpeg": "^2.1.2",
Expand Down
11 changes: 6 additions & 5 deletions src/command/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ module.exports = {
if (!client.isGmium) return client.reply(pesan.hanya.premium)
if (!client.isGroupAdmins) return client.reply(pesan.hanya.admin)
if (!client.isBotGroupAdmins) return client.reply(pesan.hanya.botAdmin)
const arg = client.body.slice(6)
const key = arg.split('|')[1].trim()
const res = arg.split('|')[2].trim()
const arg = client.body.slice(7)
if (args == 0) {
await databaseView('SELECT * FROM notes')
.then((hasil: any) => {
Expand All @@ -29,10 +27,13 @@ module.exports = {
client.reply(text)
}
})
} else if (args > 0 && arg.split('|')[0].trim() == 'save') {
} else if (arg.split('|')[0].trim() == 'save') {
const key = arg.split('|')[1]
const res = arg.split('|')[2]
databaseInput(`INSERT INTO notes(gid, key, res) VALUES ('${client.groupId}', '#${key}', '${res}')`)
.then(() => client.reply('Berhasil menambahkan notes'))
} else if (args > 0 && arg.split('|')[0].trim() == 'remove') {
} else if (arg.split('|')[0].trim() == 'remove') {
const key = arg.split('|')[1].trim()
databaseInput(`DELETE FROM notes WHERE key = ${key} AND gid = ${client.groupId}`)
.then(() => client.reply(`Berhasil menghapus notes #${key}`))
}
Expand Down
1 change: 1 addition & 0 deletions src/krypton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const moment = require('moment-timezone')
const { welcome, goodbye } = require('./utils/greeting')
const { databaseView, databaseInput } = require('./utils/db')
const { web, loging } = require('./utils/web')
require('dotenv').config()

async function krypton () {
const client = new WAConnection()
Expand Down

0 comments on commit 057e1b7

Please sign in to comment.