-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f35297
commit aaab1d7
Showing
74 changed files
with
3,339 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="icon" href="favicon.ico" /> | ||
<link rel="stylesheet" href="style.css"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;700&display=swap" rel="stylesheet"> | ||
<title>WhatsApp-bot</title> | ||
</head> | ||
<body> | ||
|
||
|
||
<section class="main-container"> | ||
<div class="outer-form"> | ||
<div class="greets"> | ||
<div> | ||
|
||
<h1>Hellow There!</h1> | ||
<p>Please Enter Your Session ID to Authenticate</p> | ||
</div> | ||
</div> | ||
|
||
<div class="form"> | ||
<form action="/wa/qr" method="get" target="_blank"> | ||
<h1>Authenticate</h1> | ||
<input type="password" placeholder="Session" id="session" name="session"/> | ||
<button>Login</button> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
<style> | ||
|
||
</style> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
form { | ||
display: flex; | ||
align-items: center; | ||
justify-self: center; | ||
flex-direction: column; | ||
} | ||
form > input { | ||
padding: 10px; | ||
border: none; | ||
margin: 8px 0; | ||
width: 100%; | ||
border-radius: 3px; | ||
background: rgba( 255, 255, 255, 0.45 ); | ||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 ); | ||
backdrop-filter: blur( 4.5px ); | ||
-webkit-backdrop-filter: blur( 4.5px ); | ||
border-radius: 10px; | ||
border: 1px none rgba( 255, 255, 255, 0.18 ); | ||
} | ||
|
||
button { | ||
color: aliceblue; | ||
padding: 13px; | ||
margin-top: 5px; | ||
text-transform: uppercase; | ||
background: rgba( 246, 197, 92, 0.45 );; | ||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 ); | ||
backdrop-filter: blur( 17px ); | ||
-webkit-backdrop-filter: blur( 17px ); | ||
border-radius: 10px; | ||
border: 1px none rgba( 255, 255, 255, 0.18 ); | ||
} | ||
.greets { | ||
background-color: #f6c55c; | ||
height: inherit; | ||
width: inherit; | ||
text-align: center; | ||
display: flex; | ||
align-items: center; | ||
justify-self: center; | ||
background: rgba( 246, 197, 92, 0.45 ); | ||
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.37); | ||
border-radius: 10px; | ||
border: 1px solid rgba( 255, 255, 255, 0.18 ); | ||
} | ||
.outer-form { | ||
height: 480px; | ||
width: 550px; | ||
display: flex; | ||
flex-direction: row; | ||
background: rgba( 255, 255, 255, 0.2 ); | ||
box-shadow: 0 0 32px 0 rgba(2, 2, 2, 0.37); | ||
border-radius: 10px; | ||
border: 1px solid rgba( 255, 255, 255, 0.18 ); | ||
} | ||
.form { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: inherit; | ||
} | ||
section { | ||
height: 100vh; | ||
width: auto; | ||
display: flex; | ||
background-image: url('bgimg.jpg'); | ||
background-size: cover; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
p { | ||
font-family: 'Ubuntu','Courier New', Courier, monospace; | ||
font-weight: 400; | ||
} | ||
h1 { | ||
font-family: 'Ubuntu','Courier New', Courier, monospace; | ||
font-weight: 700; | ||
text-align: center; | ||
} | ||
@media screen and (max-width:524px) { | ||
h1 { | ||
font-size: x-large; | ||
} | ||
.outer-form { | ||
height: 300px; | ||
width: 450px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Command, BaseCommand, Message } from '../../Structures' | ||
import { IArgs } from '../../Types' | ||
|
||
@Command('ban', { | ||
description: 'Bans/unban users', | ||
category: 'dev', | ||
cooldown: 5, | ||
usage: 'ban --action=[ban/unban] [tag/quote users]', | ||
exp: 15 | ||
}) | ||
export default class extends BaseCommand { | ||
public override execute = async (M: Message, { flags }: IArgs): Promise<void> => { | ||
const users = M.mentioned | ||
if (M.quoted && !users.includes(M.quoted.sender.jid)) users.push(M.quoted.sender.jid) | ||
if (users.length < 1) return void M.reply('Tag or quote a user to use this command') | ||
flags = flags.filter((flag) => flag.startsWith('--action=')) | ||
if (flags.length < 1) | ||
return void M.reply( | ||
`Provide the action of the ban. Example: *${this.client.config.prefix}ban --action=ban*` | ||
) | ||
const actions = ['ban', 'unban'] | ||
const action = flags[0].split('=')[1] | ||
if (action === '') | ||
return void M.reply( | ||
`Provide the action of the ban. Example: *${this.client.config.prefix}ban --action=ban*` | ||
) | ||
if (!actions.includes(action.toLowerCase())) return void M.reply('Invalid action') | ||
let text = `🚦 *State: ${action.toLowerCase() === 'ban' ? 'BANNED' : 'UNBANNED'}*\n⚗ *Users:*\n` | ||
let Text = '🚦 *State: SKIPPED*\n⚗ *Users:*\n\n' | ||
let resultText = '' | ||
let skippedFlag = false | ||
for (const user of users) { | ||
const info = await this.client.DB.getUser(user) | ||
if ( | ||
((this.client.config.mods.includes(user) || info.banned) && action.toLowerCase() === 'ban') || | ||
(!info.banned && action.toLowerCase() === 'unban') | ||
) { | ||
skippedFlag = true | ||
Text += `*@${user.split('@')[0]}* (Skipped as this user is ${ | ||
this.client.config.mods.includes(user) | ||
? 'a moderator' | ||
: action.toLowerCase() === 'ban' | ||
? 'already banned' | ||
: 'already unbanned' | ||
})\n` | ||
continue | ||
} | ||
text += `\n*@${user.split('@')[0]}*` | ||
await this.client.DB.updateBanStatus(user, action.toLowerCase() as 'ban' | 'unban') | ||
} | ||
if (skippedFlag) resultText += `${Text}\n` | ||
resultText += text | ||
return void (await M.reply(resultText, 'text', undefined, undefined, undefined, users)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Command, Message, BaseCommand } from '../../Structures' | ||
import { IArgs } from '../../Types' | ||
|
||
@Command('eval', { | ||
description: 'Evaluates JavaScript', | ||
category: 'dev', | ||
usage: 'eval [JavaScript code]', | ||
dm: true | ||
}) | ||
export default class extends BaseCommand { | ||
public override execute = async (M: Message, { context }: IArgs): Promise<void> => { | ||
let out!: string | ||
try { | ||
const result = eval(context) | ||
out = JSON.stringify(result, null, '\t') || 'Evaluated JavaScript' | ||
} catch (error) { | ||
out = (error as any).message | ||
} | ||
return void M.reply(out) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import moment from 'moment-timezone' | ||
import { BaseCommand, Command, Message } from '../../Structures' | ||
import { IArgs } from '../../Types' | ||
|
||
@Command('toggle', { | ||
description: 'Toggles a command state', | ||
usage: 'toggle --command=[command_name] --state=[disable/enable] | <reason_for_disabling_the_command>', | ||
exp: 10, | ||
category: 'dev', | ||
cooldown: 10 | ||
}) | ||
export default class extends BaseCommand { | ||
public override execute = async (M: Message, { flags, context }: IArgs): Promise<void> => { | ||
flags.forEach((flag) => (context = context.replace(flag, ''))) | ||
const commandFlag = flags.filter((flag) => flag.startsWith('--command=')) | ||
const stateFlag = flags.filter((flag) => flag.startsWith('--state=')) | ||
if (commandFlag.length < 1 || stateFlag.length < 1) | ||
return void M.reply( | ||
`Provide the command and the state (disable/enable) of the command that you wanna to. Example: *${this.client.config.prefix}toggle --command=hi --state=disable | Well...*` | ||
) | ||
const cmd = commandFlag[0].toLowerCase().split('=') | ||
const state = stateFlag[0].toLowerCase().split('=') | ||
if (state[1] === '' || cmd[1] === '') | ||
return void M.reply( | ||
`Provide the command and the state (disable/enable) of the command that you wanna to. Example: *${this.client.config.prefix}toggle --command=hi --state=disable | Well...*` | ||
) | ||
const command = this.handler.commands.get(cmd[1].trim()) || this.handler.aliases.get(cmd[1].trim()) | ||
if (!command) return void M.reply(`No command found | *"${this.client.utils.capitalize(cmd[1])}"*`) | ||
const actions = ['disable', 'enable'] | ||
if (!actions.includes(state[1])) return void M.reply('Invalid command state') | ||
const disabledCommands = await this.client.DB.getDisabledCommands() | ||
const index = disabledCommands.findIndex((cmd) => cmd.command === command.name) | ||
let text = '' | ||
if (state[1] === 'disable') { | ||
if (index >= 0) | ||
return void M.reply( | ||
`🟨 *${this.client.utils.capitalize(cmd[1])}* is already disabled by *${ | ||
disabledCommands[index].disabledBy | ||
}* in *${disabledCommands[index].time} (GMT)*. ❓ *Reason:* ${disabledCommands[index].reason}` | ||
) | ||
if (!context || !context.split('|')[1]) | ||
return void M.reply( | ||
`Provide the reason for disabling this command. Example: *${ | ||
this.client.config.prefix | ||
}toggle --command=${this.client.utils.capitalize(cmd[1])} --state=disable | Well...*` | ||
) | ||
disabledCommands.push({ | ||
command: command.name, | ||
disabledBy: M.sender.username, | ||
reason: context.split('|')[1].trim(), | ||
time: moment.tz('Etc/GMT').format('MMM D, YYYY HH:mm:ss') | ||
}) | ||
text += `*${this.client.utils.capitalize(cmd[1])}* has been disabled. ❓ *Reason:* ${context | ||
.split('|')[1] | ||
.trim()}` | ||
} else { | ||
if (index < 0) return void M.reply(`🟨 *${this.client.utils.capitalize(cmd[1])}* is already enabled`) | ||
disabledCommands.splice(index, 1) | ||
text += `*${this.client.utils.capitalize(cmd[1])}* has been enabled.` | ||
} | ||
await this.client.DB.updateDisabledCommands(disabledCommands) | ||
return void M.reply(text) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Friendship, IFriendShip } from '@shineiichijo/canvas-chan' | ||
import { Command, Message, BaseCommand } from '../../Structures' | ||
|
||
@Command('friendship', { | ||
description: 'Calculates the level of a friendship', | ||
usage: 'friendship [tag/quote users]', | ||
cooldown: 10, | ||
exp: 50, | ||
category: 'fun' | ||
}) | ||
export default class extends BaseCommand { | ||
public override execute = async (M: Message): Promise<void> => { | ||
const friendshipArray: IFriendShip[] = [] | ||
let users = M.mentioned | ||
if (M.quoted && !users.includes(M.quoted.sender.jid)) users.push(M.quoted.sender.jid) | ||
while (users.length < 2) users.push(M.sender.jid) | ||
if (users.includes(M.sender.jid)) users = users.reverse() | ||
for (const user of users) { | ||
const name = this.client.contact.getContact(user).username | ||
let image!: string | ||
try { | ||
image = | ||
(await this.client.profilePictureUrl(user, 'image')) || | ||
'https://upload.wikimedia.org/wikipedia/commons/a/ac/Default_pfp.jpg' | ||
} catch (error) { | ||
image = 'https://upload.wikimedia.org/wikipedia/commons/a/ac/Default_pfp.jpg' | ||
} | ||
friendshipArray.push({ name, image }) | ||
} | ||
const percentage = Math.floor(Math.random() * 101) | ||
let text = '' | ||
if (percentage >= 0 && percentage < 10) text = 'Fake friends' | ||
else if (percentage >= 10 && percentage < 25) text = 'Awful' | ||
else if (percentage >= 25 && percentage < 40) text = 'Very Bad' | ||
else if (percentage >= 40 && percentage < 50) text = 'Average' | ||
else if (percentage >= 50 && percentage < 75) text = 'Nice' | ||
else if (percentage >= 75 && percentage < 90) text = 'Besties' | ||
else if (percentage >= 90) text = 'Soulmates' | ||
const image = new Friendship(friendshipArray, percentage, text) | ||
let caption = `\t🍁 *Calculating...* 🍁 \n` | ||
caption += `\t\t---------------------------------\n` | ||
caption += `@${users[0].split('@')[0]} & @${users[1].split('@')[0]}\n` | ||
caption += `\t\t---------------------------------\n` | ||
caption += `\t\t\t\t\t${percentage < 40 ? '📉' : percentage < 75 ? '📈' : '💫'} *Percentage: ${percentage}%*\n` | ||
caption += text | ||
return void (await M.reply(await image.build(), 'image', undefined, undefined, caption, [users[0], users[1]])) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Command, BaseCommand, Message } from '../../Structures' | ||
import { IArgs } from '../../Types' | ||
import { Reaction, Reactions, reaction } from '../../lib' | ||
|
||
const reactions = Object.keys(Reactions) | ||
|
||
@Command('reaction', { | ||
description: 'React via anime gifs with the tagged or quoted user', | ||
category: 'fun', | ||
cooldown: 10, | ||
exp: 20, | ||
usage: 'reaction (reaction) [tag/quote user] || (reaction) [tag/quote user]', | ||
aliases: ['r', ...reactions] | ||
}) | ||
export default class extends BaseCommand { | ||
public override execute = async (M: Message, { context }: IArgs): Promise<void> => { | ||
const command = M.content.split(' ')[0].toLowerCase().slice(this.client.config.prefix.length).trim() | ||
let flag = true | ||
if (command === 'r' || command === 'reaction') flag = false | ||
if (!flag && !context) | ||
return void M.reply( | ||
`💫 *Available Reactions:*\n\n- ${reactions | ||
.sort((x, y) => (x < y ? -1 : x > y ? 1 : 0)) | ||
.map((reaction) => this.client.utils.capitalize(reaction)) | ||
.join('\n- ')}\n\n🔗 *Usage:* ${this.client.config.prefix}reaction (reaction) [tag/quote user] | ${ | ||
this.client.config.prefix | ||
}(reaction) [tag/quote user]\nExample: ${this.client.config.prefix}pat` | ||
) | ||
const reaction = (flag ? command : context.split(' ')[0].trim().toLowerCase()) as reaction | ||
if (!flag && !reactions.includes(reaction)) | ||
return void M.reply( | ||
`Invalid reaction. Use *${this.client.config.prefix}react* to see all of the available reactions` | ||
) | ||
const users = M.mentioned | ||
if (M.quoted && !users.includes(M.quoted.sender.jid)) users.push(M.quoted.sender.jid) | ||
while (users.length < 1) users.push(M.sender.jid) | ||
const reactant = users[0] | ||
const single = reactant === M.sender.jid | ||
const { url, words } = await new Reaction().getReaction(reaction, single) | ||
return void (await M.reply( | ||
await this.client.utils.gifToMp4(await this.client.utils.getBuffer(url)), | ||
'video', | ||
true, | ||
undefined, | ||
`*@${M.sender.jid.split('@')[0]} ${words} ${single ? 'Themselves' : `@${reactant.split('@')[0]}`}*`, | ||
[M.sender.jid, reactant] | ||
)) | ||
} | ||
} |
Oops, something went wrong.