Skip to content

Commit aaab1d7

Browse files
authored
DARKWORLD MD
1 parent 8f35297 commit aaab1d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3339
-0
lines changed

assets/images/404.png

6.47 MB
Loading

assets/images/whatsapp-bot.png

182 KB
Loading

public/bgimg.jpg

228 KB
Loading

public/favicon.ico

14.7 KB
Binary file not shown.

public/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="icon" href="favicon.ico" />
8+
<link rel="stylesheet" href="style.css">
9+
<link rel="preconnect" href="https://fonts.googleapis.com">
10+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11+
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;700&display=swap" rel="stylesheet">
12+
<title>WhatsApp-bot</title>
13+
</head>
14+
<body>
15+
16+
17+
<section class="main-container">
18+
<div class="outer-form">
19+
<div class="greets">
20+
<div>
21+
22+
<h1>Hellow There!</h1>
23+
<p>Please Enter Your Session ID to Authenticate</p>
24+
</div>
25+
</div>
26+
27+
<div class="form">
28+
<form action="/wa/qr" method="get" target="_blank">
29+
<h1>Authenticate</h1>
30+
<input type="password" placeholder="Session" id="session" name="session"/>
31+
<button>Login</button>
32+
</form>
33+
</div>
34+
35+
</div>
36+
</section>
37+
38+
<style>
39+
40+
</style>
41+
42+
</body>
43+
</html>

public/style.css

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
}
5+
form {
6+
display: flex;
7+
align-items: center;
8+
justify-self: center;
9+
flex-direction: column;
10+
}
11+
form > input {
12+
padding: 10px;
13+
border: none;
14+
margin: 8px 0;
15+
width: 100%;
16+
border-radius: 3px;
17+
background: rgba( 255, 255, 255, 0.45 );
18+
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 );
19+
backdrop-filter: blur( 4.5px );
20+
-webkit-backdrop-filter: blur( 4.5px );
21+
border-radius: 10px;
22+
border: 1px none rgba( 255, 255, 255, 0.18 );
23+
}
24+
25+
button {
26+
color: aliceblue;
27+
padding: 13px;
28+
margin-top: 5px;
29+
text-transform: uppercase;
30+
background: rgba( 246, 197, 92, 0.45 );;
31+
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 );
32+
backdrop-filter: blur( 17px );
33+
-webkit-backdrop-filter: blur( 17px );
34+
border-radius: 10px;
35+
border: 1px none rgba( 255, 255, 255, 0.18 );
36+
}
37+
.greets {
38+
background-color: #f6c55c;
39+
height: inherit;
40+
width: inherit;
41+
text-align: center;
42+
display: flex;
43+
align-items: center;
44+
justify-self: center;
45+
background: rgba( 246, 197, 92, 0.45 );
46+
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.37);
47+
border-radius: 10px;
48+
border: 1px solid rgba( 255, 255, 255, 0.18 );
49+
}
50+
.outer-form {
51+
height: 480px;
52+
width: 550px;
53+
display: flex;
54+
flex-direction: row;
55+
background: rgba( 255, 255, 255, 0.2 );
56+
box-shadow: 0 0 32px 0 rgba(2, 2, 2, 0.37);
57+
border-radius: 10px;
58+
border: 1px solid rgba( 255, 255, 255, 0.18 );
59+
}
60+
.form {
61+
display: flex;
62+
align-items: center;
63+
justify-content: center;
64+
width: inherit;
65+
}
66+
section {
67+
height: 100vh;
68+
width: auto;
69+
display: flex;
70+
background-image: url('bgimg.jpg');
71+
background-size: cover;
72+
align-items: center;
73+
justify-content: center;
74+
}
75+
p {
76+
font-family: 'Ubuntu','Courier New', Courier, monospace;
77+
font-weight: 400;
78+
}
79+
h1 {
80+
font-family: 'Ubuntu','Courier New', Courier, monospace;
81+
font-weight: 700;
82+
text-align: center;
83+
}
84+
@media screen and (max-width:524px) {
85+
h1 {
86+
font-size: x-large;
87+
}
88+
.outer-form {
89+
height: 300px;
90+
width: 450px;
91+
}
92+
}

src/Commands/Dev/Ban.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { Command, BaseCommand, Message } from '../../Structures'
2+
import { IArgs } from '../../Types'
3+
4+
@Command('ban', {
5+
description: 'Bans/unban users',
6+
category: 'dev',
7+
cooldown: 5,
8+
usage: 'ban --action=[ban/unban] [tag/quote users]',
9+
exp: 15
10+
})
11+
export default class extends BaseCommand {
12+
public override execute = async (M: Message, { flags }: IArgs): Promise<void> => {
13+
const users = M.mentioned
14+
if (M.quoted && !users.includes(M.quoted.sender.jid)) users.push(M.quoted.sender.jid)
15+
if (users.length < 1) return void M.reply('Tag or quote a user to use this command')
16+
flags = flags.filter((flag) => flag.startsWith('--action='))
17+
if (flags.length < 1)
18+
return void M.reply(
19+
`Provide the action of the ban. Example: *${this.client.config.prefix}ban --action=ban*`
20+
)
21+
const actions = ['ban', 'unban']
22+
const action = flags[0].split('=')[1]
23+
if (action === '')
24+
return void M.reply(
25+
`Provide the action of the ban. Example: *${this.client.config.prefix}ban --action=ban*`
26+
)
27+
if (!actions.includes(action.toLowerCase())) return void M.reply('Invalid action')
28+
let text = `🚦 *State: ${action.toLowerCase() === 'ban' ? 'BANNED' : 'UNBANNED'}*\n⚗ *Users:*\n`
29+
let Text = '🚦 *State: SKIPPED*\n⚗ *Users:*\n\n'
30+
let resultText = ''
31+
let skippedFlag = false
32+
for (const user of users) {
33+
const info = await this.client.DB.getUser(user)
34+
if (
35+
((this.client.config.mods.includes(user) || info.banned) && action.toLowerCase() === 'ban') ||
36+
(!info.banned && action.toLowerCase() === 'unban')
37+
) {
38+
skippedFlag = true
39+
Text += `*@${user.split('@')[0]}* (Skipped as this user is ${
40+
this.client.config.mods.includes(user)
41+
? 'a moderator'
42+
: action.toLowerCase() === 'ban'
43+
? 'already banned'
44+
: 'already unbanned'
45+
})\n`
46+
continue
47+
}
48+
text += `\n*@${user.split('@')[0]}*`
49+
await this.client.DB.updateBanStatus(user, action.toLowerCase() as 'ban' | 'unban')
50+
}
51+
if (skippedFlag) resultText += `${Text}\n`
52+
resultText += text
53+
return void (await M.reply(resultText, 'text', undefined, undefined, undefined, users))
54+
}
55+
}

src/Commands/Dev/Eval.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Command, Message, BaseCommand } from '../../Structures'
2+
import { IArgs } from '../../Types'
3+
4+
@Command('eval', {
5+
description: 'Evaluates JavaScript',
6+
category: 'dev',
7+
usage: 'eval [JavaScript code]',
8+
dm: true
9+
})
10+
export default class extends BaseCommand {
11+
public override execute = async (M: Message, { context }: IArgs): Promise<void> => {
12+
let out!: string
13+
try {
14+
const result = eval(context)
15+
out = JSON.stringify(result, null, '\t') || 'Evaluated JavaScript'
16+
} catch (error) {
17+
out = (error as any).message
18+
}
19+
return void M.reply(out)
20+
}
21+
}

src/Commands/Dev/Toggle.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import moment from 'moment-timezone'
2+
import { BaseCommand, Command, Message } from '../../Structures'
3+
import { IArgs } from '../../Types'
4+
5+
@Command('toggle', {
6+
description: 'Toggles a command state',
7+
usage: 'toggle --command=[command_name] --state=[disable/enable] | <reason_for_disabling_the_command>',
8+
exp: 10,
9+
category: 'dev',
10+
cooldown: 10
11+
})
12+
export default class extends BaseCommand {
13+
public override execute = async (M: Message, { flags, context }: IArgs): Promise<void> => {
14+
flags.forEach((flag) => (context = context.replace(flag, '')))
15+
const commandFlag = flags.filter((flag) => flag.startsWith('--command='))
16+
const stateFlag = flags.filter((flag) => flag.startsWith('--state='))
17+
if (commandFlag.length < 1 || stateFlag.length < 1)
18+
return void M.reply(
19+
`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...*`
20+
)
21+
const cmd = commandFlag[0].toLowerCase().split('=')
22+
const state = stateFlag[0].toLowerCase().split('=')
23+
if (state[1] === '' || cmd[1] === '')
24+
return void M.reply(
25+
`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...*`
26+
)
27+
const command = this.handler.commands.get(cmd[1].trim()) || this.handler.aliases.get(cmd[1].trim())
28+
if (!command) return void M.reply(`No command found | *"${this.client.utils.capitalize(cmd[1])}"*`)
29+
const actions = ['disable', 'enable']
30+
if (!actions.includes(state[1])) return void M.reply('Invalid command state')
31+
const disabledCommands = await this.client.DB.getDisabledCommands()
32+
const index = disabledCommands.findIndex((cmd) => cmd.command === command.name)
33+
let text = ''
34+
if (state[1] === 'disable') {
35+
if (index >= 0)
36+
return void M.reply(
37+
`🟨 *${this.client.utils.capitalize(cmd[1])}* is already disabled by *${
38+
disabledCommands[index].disabledBy
39+
}* in *${disabledCommands[index].time} (GMT)*. ❓ *Reason:* ${disabledCommands[index].reason}`
40+
)
41+
if (!context || !context.split('|')[1])
42+
return void M.reply(
43+
`Provide the reason for disabling this command. Example: *${
44+
this.client.config.prefix
45+
}toggle --command=${this.client.utils.capitalize(cmd[1])} --state=disable | Well...*`
46+
)
47+
disabledCommands.push({
48+
command: command.name,
49+
disabledBy: M.sender.username,
50+
reason: context.split('|')[1].trim(),
51+
time: moment.tz('Etc/GMT').format('MMM D, YYYY HH:mm:ss')
52+
})
53+
text += `*${this.client.utils.capitalize(cmd[1])}* has been disabled. ❓ *Reason:* ${context
54+
.split('|')[1]
55+
.trim()}`
56+
} else {
57+
if (index < 0) return void M.reply(`🟨 *${this.client.utils.capitalize(cmd[1])}* is already enabled`)
58+
disabledCommands.splice(index, 1)
59+
text += `*${this.client.utils.capitalize(cmd[1])}* has been enabled.`
60+
}
61+
await this.client.DB.updateDisabledCommands(disabledCommands)
62+
return void M.reply(text)
63+
}
64+
}

src/Commands/Fun/Friendship.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Friendship, IFriendShip } from '@shineiichijo/canvas-chan'
2+
import { Command, Message, BaseCommand } from '../../Structures'
3+
4+
@Command('friendship', {
5+
description: 'Calculates the level of a friendship',
6+
usage: 'friendship [tag/quote users]',
7+
cooldown: 10,
8+
exp: 50,
9+
category: 'fun'
10+
})
11+
export default class extends BaseCommand {
12+
public override execute = async (M: Message): Promise<void> => {
13+
const friendshipArray: IFriendShip[] = []
14+
let users = M.mentioned
15+
if (M.quoted && !users.includes(M.quoted.sender.jid)) users.push(M.quoted.sender.jid)
16+
while (users.length < 2) users.push(M.sender.jid)
17+
if (users.includes(M.sender.jid)) users = users.reverse()
18+
for (const user of users) {
19+
const name = this.client.contact.getContact(user).username
20+
let image!: string
21+
try {
22+
image =
23+
(await this.client.profilePictureUrl(user, 'image')) ||
24+
'https://upload.wikimedia.org/wikipedia/commons/a/ac/Default_pfp.jpg'
25+
} catch (error) {
26+
image = 'https://upload.wikimedia.org/wikipedia/commons/a/ac/Default_pfp.jpg'
27+
}
28+
friendshipArray.push({ name, image })
29+
}
30+
const percentage = Math.floor(Math.random() * 101)
31+
let text = ''
32+
if (percentage >= 0 && percentage < 10) text = 'Fake friends'
33+
else if (percentage >= 10 && percentage < 25) text = 'Awful'
34+
else if (percentage >= 25 && percentage < 40) text = 'Very Bad'
35+
else if (percentage >= 40 && percentage < 50) text = 'Average'
36+
else if (percentage >= 50 && percentage < 75) text = 'Nice'
37+
else if (percentage >= 75 && percentage < 90) text = 'Besties'
38+
else if (percentage >= 90) text = 'Soulmates'
39+
const image = new Friendship(friendshipArray, percentage, text)
40+
let caption = `\t🍁 *Calculating...* 🍁 \n`
41+
caption += `\t\t---------------------------------\n`
42+
caption += `@${users[0].split('@')[0]} & @${users[1].split('@')[0]}\n`
43+
caption += `\t\t---------------------------------\n`
44+
caption += `\t\t\t\t\t${percentage < 40 ? '📉' : percentage < 75 ? '📈' : '💫'} *Percentage: ${percentage}%*\n`
45+
caption += text
46+
return void (await M.reply(await image.build(), 'image', undefined, undefined, caption, [users[0], users[1]]))
47+
}
48+
}

src/Commands/Fun/Reaction.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Command, BaseCommand, Message } from '../../Structures'
2+
import { IArgs } from '../../Types'
3+
import { Reaction, Reactions, reaction } from '../../lib'
4+
5+
const reactions = Object.keys(Reactions)
6+
7+
@Command('reaction', {
8+
description: 'React via anime gifs with the tagged or quoted user',
9+
category: 'fun',
10+
cooldown: 10,
11+
exp: 20,
12+
usage: 'reaction (reaction) [tag/quote user] || (reaction) [tag/quote user]',
13+
aliases: ['r', ...reactions]
14+
})
15+
export default class extends BaseCommand {
16+
public override execute = async (M: Message, { context }: IArgs): Promise<void> => {
17+
const command = M.content.split(' ')[0].toLowerCase().slice(this.client.config.prefix.length).trim()
18+
let flag = true
19+
if (command === 'r' || command === 'reaction') flag = false
20+
if (!flag && !context)
21+
return void M.reply(
22+
`💫 *Available Reactions:*\n\n- ${reactions
23+
.sort((x, y) => (x < y ? -1 : x > y ? 1 : 0))
24+
.map((reaction) => this.client.utils.capitalize(reaction))
25+
.join('\n- ')}\n\n🔗 *Usage:* ${this.client.config.prefix}reaction (reaction) [tag/quote user] | ${
26+
this.client.config.prefix
27+
}(reaction) [tag/quote user]\nExample: ${this.client.config.prefix}pat`
28+
)
29+
const reaction = (flag ? command : context.split(' ')[0].trim().toLowerCase()) as reaction
30+
if (!flag && !reactions.includes(reaction))
31+
return void M.reply(
32+
`Invalid reaction. Use *${this.client.config.prefix}react* to see all of the available reactions`
33+
)
34+
const users = M.mentioned
35+
if (M.quoted && !users.includes(M.quoted.sender.jid)) users.push(M.quoted.sender.jid)
36+
while (users.length < 1) users.push(M.sender.jid)
37+
const reactant = users[0]
38+
const single = reactant === M.sender.jid
39+
const { url, words } = await new Reaction().getReaction(reaction, single)
40+
return void (await M.reply(
41+
await this.client.utils.gifToMp4(await this.client.utils.getBuffer(url)),
42+
'video',
43+
true,
44+
undefined,
45+
`*@${M.sender.jid.split('@')[0]} ${words} ${single ? 'Themselves' : `@${reactant.split('@')[0]}`}*`,
46+
[M.sender.jid, reactant]
47+
))
48+
}
49+
}

0 commit comments

Comments
 (0)