Skip to content

Commit

Permalink
Create welcome.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lasiyaWA authored Jun 28, 2021
1 parent be9e3ee commit 768067e
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions plugins/welcome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* # Exclusively from danuma project
# Do not use this fore any commercial thing
# If you abuse thais bot we wil kick you from bot
# Do not edit (Respect to the Devaoloper)
# All rights reserved ©Lasiya @lasiya99X t.me/lasiya99X
const Asena = require('../events');
const {MessageType} = require('@adiwajshing/baileys');
const sql = require('./sql/greetings');
const Language = require('../language');
const Lang = Language.getString('greetings');
Asena.addCommand({pattern: 'welcome$', fromMe: true, desc: Lang.WELCOME_DESC}, (async (message, match) => {
var hg = await sql.getMessage(message.jid);
if (hg === false) {
await message.client.sendMessage(message.jid,Lang.NOT_SET_WELCOME,MessageType.text);
} else {
await message.client.sendMessage(message.jid,Lang.WELCOME_ALREADY_SETTED + hg.message + '```',MessageType.text);
}
}));
Asena.addCommand({pattern: 'welcome (.*)', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (match[1] === '') {
return await message.client.sendMessage(message.jid,Lang.NEED_WELCOME_TEXT);
} else {
if (match[1] === 'delete') { await message.client.sendMessage(message.jid,Lang.WELCOME_DELETED,MessageType.text); return await sql.deleteMessage(message.jid, 'welcome'); }
await sql.setMessage(message.jid, 'welcome', match[1].replace(/#/g, '\n'));
return await message.client.sendMessage(message.jid,Lang.WELCOME_SETTED,MessageType.text)
}
}));
Asena.addCommand({pattern: 'goodbye$', fromMe: true, desc: Lang.GOODBYE_DESC}, (async (message, match) => {
var hg = await sql.getMessage(message.jid, 'goodbye');
if (hg === false) {
await message.client.sendMessage(message.jid,Lang.NOT_SET_GOODBYE,MessageType.text)
} else {
await message.client.sendMessage(message.jid,Lang.GOODBYE_ALREADY_SETTED + hg.message + '```',MessageType.text);
}
}));
Asena.addCommand({pattern: 'goodbye (.*)', fromMe: true, dontAddCommandList: true}, (async (message, match) => {
if (match[1] === '') {
return await message.client.sendMessage(message.jid,Lang.NEED_GOODBYE_TEXT,MessageType.text);
} else {
if (match[1] === 'delete') { await message.client.sendMessage(message.jid,Lang.GOODBYE_DELETED,MessageType.text); return await sql.deleteMessage(message.jid, 'goodbye'); }
await sql.setMessage(message.jid, 'goodbye', match[1].replace(/#/g, '\n'));
return await message.client.sendMessage(message.jid,Lang.GOODBYE_SETTED,MessageType.text)
}
}));
# Get more about devaoloper https://lasiya.ml
*/

0 comments on commit 768067e

Please sign in to comment.