Skip to content

Commit

Permalink
fix notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kry9toN committed Jan 26, 2021
1 parent a25fdf9 commit 1adb1c5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/command/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ const { databaseView, databaseInput } = require('../utils/db')

module.exports = {
name: 'notes',
aliases: ['nt'],
cooldown: 15,
description: 'Untuk menyimpan note atau catatan di group\nPenggunaan: !notes <save/remove> <key> <value>',
async execute (client, chat, pesan, args) {
if (!client.isGroup) return client.reply(pesan.error.group)
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 key = args[1]
const res = args[2]
const arg = client.body.slice(6)
const key = arg.split('|')[1].trim()
const res = arg.split('|')[2].trim()
if (args == 0) {
await databaseView('SELECT * FROM notes')
.then((hasil) => {
Expand All @@ -29,10 +29,10 @@ module.exports = {
client.reply(text)
}
})
} else if (args > 0 && args[0] == 'save') {
} else if (args > 0 && arg.split('|')[0].trim() == 'save') {
databaseInput(`INSERT INTO notes(gid, key, res) VALUES ('${client.groupId}', '#${key}', '${res}')`)
.then(() => client.reply('Berhasil menambahkan notes'))
} else if (args > 0 && args[0] == 'remove') {
} else if (args > 0 && arg.split('|')[0].trim() == 'remove') {
databaseInput(`DELETE FROM notes WHERE key = ${key} AND gid = ${client.groupId}`)
.then(() => client.reply(`Berhasil menghapus notes #${key}`))
}
Expand Down

0 comments on commit 1adb1c5

Please sign in to comment.