Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 9cbb752

Browse files
authored
Merge pull request #51 from Rahuletto/dev
main <- dev
2 parents e00c6b7 + 5f8e25e commit 9cbb752

23 files changed

+1454
-2005
lines changed

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,27 @@ npm install simply-djs
2626
yarn add simply-djs
2727
```
2828

29+
## **Need Help ? Join the [Discord Server](https://discord.gg/3JzDV9T5Fn)**
30+
2931
<br>
3032

3133
# 🎉 [What's New](https://simplyd.js.org/docs/new) 🎉
32-
- ### Insane Big Bug Fixes
33-
- ### Removed `rankCard`
3434

35-
<br>
35+
## Note that this is just half of the update.
3636

37-
## **Need Help ? Join the [Discord Server](https://discord.gg/3JzDV9T5Fn)**
37+
- ### Beyond Customization !!!. Now Some functions return data [Refer docs], So you can use them.
38+
- ### Custom Errors !
39+
- ### Auto Slash Recognition ! No more slash options.
40+
- ### Code cleanup.
41+
- ### Re-did many functions.
42+
- ### 40% Promise Based !
43+
- ### Bug Fixes.
44+
45+
- ### [Docs Became open-src (kinda)](https://github.com/Rahuletto/simplydjs-docs)
3846

3947
<br>
4048

41-
# But Why ?
49+
# 🤔 But Why ?
4250

4351
- Simplifies things in discord.js
4452
- Fastest Support ever
@@ -51,7 +59,25 @@ yarn add simply-djs
5159
- Simple & Understandable **[Documentation](https://simplyd.js.org)**
5260

5361
<br>
54-
62+
63+
# 📄 [License](https://creativecommons.org/licenses/by-nc-nd/4.0/)
64+
65+
## You are free to:
66+
67+
- **Share:** Copy and redistribute the material in any medium or format
68+
69+
## Under the following terms:
70+
71+
- **Attribution:** You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
72+
73+
- **NonCommercial:** You may not use the material for commercial purposes.
74+
75+
- **NoDerivatives:** If you remix, transform, or build upon the material, you may not distribute the _modified_ material.
76+
77+
<img align="center" style="margin-bottom:-6px; width: 100px" src="https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png">
78+
79+
<br>
80+
5581
<h1>👥 Contact us | Support</h1>
5682
<p>
5783
<a href="https://discord.gg/3JzDV9T5Fn"><img src="https://media.discordapp.net/attachments/867344514943156254/891314222837936168/9sG4YFfuxxvPzCfcJO6XXnuAAAAAElFTkSuQmCC.png" /></a>

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ export type rpsOptions = {
284284
export declare function rps(
285285
message: Message,
286286
options?: rpsOptions
287-
): Promise<any>
287+
): Promise<User>
288+
288289
export declare function rps(
289290
interaction: CommandInteraction,
290291
options?: rpsOptions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simply-djs",
3-
"version": "2.2.2",
3+
"version": "2.5.2",
44
"description": "A Simple, Easy and Beginner friendly Discord.js Package for everyone. Uses Discord.js v13",
55
"main": "simplydjs.js",
66
"typings": "index.d.ts",

src/Error/Error.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class SimplyError extends Error {
2+
/**
3+
* SimplyError
4+
* @param {String} name
5+
* @param {String} tip
6+
*/
7+
8+
constructor(name, tip) {
9+
tip = tip || 'Join the Support Server [https://discord.gg/3JzDV9T5Fn]'
10+
11+
const msg = '"' + name + '"' + '\n' + 'Tip: ' + tip + '\n'
12+
super(msg)
13+
}
14+
}
15+
16+
Object.defineProperty(SimplyError.prototype, 'name', {
17+
value: 'SimplyError'
18+
})
19+
20+
module.exports = SimplyError

src/automeme.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const Discord = require('discord.js')
22
const fetch = require('node-fetch')
3+
let SimplyError = require('./Error/Error.js')
34

45
/**
56
* @param {Discord.Client} client
@@ -43,7 +44,10 @@ async function automeme(client, options = []) {
4344
let interv
4445
if (options.interval) {
4546
if (options.interval <= 60000)
46-
throw new Error(`Interval Time should be above 60000 (1 minute).`)
47+
throw new SimplyError(
48+
`Interval Time should be above 60000 (1 minute).`,
49+
'Interval should not be less than 60000'
50+
)
4751
interv = options.interval
4852
} else {
4953
interv = 120000
@@ -52,17 +56,19 @@ async function automeme(client, options = []) {
5256
setInterval(() => {
5357
const channel = client.channels.cache.get(ch)
5458
if (!channel)
55-
throw new Error(
56-
"Invalid channel id has been provided (OR) I don't have permissions to View the Channel"
59+
throw new SimplyError(
60+
"Invalid channel id has been provided (OR) I don't have permissions to View the Channel",
61+
'Check my permissions (or) Try using other Channel ID'
5762
)
5863

5964
fetch(`https://www.reddit.com/r/${sub[random]}/random/.json`)
6065
.then((res) => res.json())
6166
.then((response) => {
67+
if (!response) return
68+
if (!response[0].data) return
69+
70+
if (response[0].data.children[0].data.over_18 === true) return
6271

63-
if(!response) return;
64-
if(!response[0].data) return;
65-
6672
let perma = response[0].data.children[0].data.permalink
6773
let url = `https://reddit.com${perma}`
6874
let memeImage =

src/btnrole.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const Discord = require('discord.js')
2+
let SimplyError = require('./Error/Error.js')
23

34
/**
45
* @param {Discord.Client} client
@@ -22,7 +23,7 @@ embed => Embed
2223
async function btnrole(client, message, options = []) {
2324
try {
2425
if (!options.data)
25-
throw new Error(
26+
throw new SimplyError(
2627
'NO_DATA_PROVIDED. You didnt specify any data to make buttons..'
2728
)
2829

@@ -52,7 +53,10 @@ async function btnrole(client, message, options = []) {
5253
button = new Array([], [], [], [], [])
5354
btnroleengin(data, button, row)
5455
} else if (data.length > 25) {
55-
throw new Error('Max 25 roles accepted.. Exceeding it will cause errors.')
56+
throw new SimplyError(
57+
'Max 25 roles accepted.. Exceeding it will cause errors.',
58+
'Discord allows only 25 buttons in a message. Send a new message with more buttons.'
59+
)
5660
}
5761
async function btnroleengin(data, button, row) {
5862
let current = 0
@@ -84,16 +88,24 @@ async function btnrole(client, message, options = []) {
8488
}
8589

8690
if (!options.embed)
87-
throw new Error(
88-
'NO_EMBED_SPECIFIED. You didnt specify any embed to me to send..'
91+
throw new SimplyError(
92+
'NO_EMBED_SPECIFIED. You didnt specify any embed to me to send..',
93+
'Create a new embed and specify.'
8994
)
9095

9196
let emb = options.embed
9297

93-
message.channel.send({
94-
embeds: [emb],
95-
components: row
96-
})
98+
if (message.commandId) {
99+
message.followUp({
100+
embeds: [emb],
101+
components: row
102+
})
103+
} else if (!message.commandId) {
104+
message.channel.send({
105+
embeds: [emb],
106+
components: row
107+
})
108+
}
97109

98110
function addRow(btns) {
99111
let row1 = new MessageActionRow()

src/bumpSys.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const Discord = require('discord.js')
2+
let SimplyError = require('./Error/Error.js')
23

34
/**
45
* @param {Discord.Client} client
@@ -77,7 +78,11 @@ async function bumpSys(client, db, options = []) {
7778
} else return
7879
}
7980
}, 5000)
80-
} else throw new Error('Unknown Event.. Please provide me a valid event..')
81+
} else
82+
throw new SimplyError(
83+
'Unknown Event.. Please provide me a valid event..',
84+
'Available Events: ready | messageCreate'
85+
)
8186
} catch (err) {
8287
console.log(`Error Occured. | bumpSystem | Error: ${err.stack}`)
8388
}

0 commit comments

Comments
 (0)