#development
1 messages ยท Page 1634 of 1
there's no going around it
How do I add my bot here?
How?
read the faq
I did
you didn't
It tells me to go to development
read above that single section
K
if you genuinely don't believe me, here's me sniffing traffic from discord
a user can sniff traffic for anything
i can smell parm from here /s, im sorry ๐
aww poor Tim doesn't have blue name anymore 
sad
you spent time sniffing discord but u didnt do it with mine? thanks for telling me it aint possible but as u said i've been told countless times.. also yes it wasnt u who suggested that it HAS to load on network tab #development message
in terms of trying to hide the script, discord is basically example.com
You mean like reassigning console.log to a webhooks send function?
can you at least try ur sniffer.. me and feud were dealing with look, it specifically doesnt work like this, and look, it specifically is found like this
also if by some magic i could have code that could confuse a step by step debugger.. i think it'd be at least a bit difficult for a sniffer to understand as well
hey! So i am using discord.js audiostream (createstream) to record voicechats. However, it exports as a pcm file. How would i export it as mp3 instead?
anyone here for some JS help, its confusing the fuck out of me
i just realised i unintentionally advertised

posted code that had a discord invite in it, oops
const eles = document.getElementsByClassName('entity-sidebar__button no-link');
if (eles.length === 1) {
eles[0].setAttribute('href', 'mydiscordinvitehere')
} else {
eles[2].setAttribute('href', 'mydiscordinvitehere')
}
for some reason the if statement always returns false 
What am I doing wrong? Why is accounts.filter not a function?
https://i.callumdev.pw/i8gn5.png
why do you need to define it?
toLowerCase shouldnโt be defined, should work without error
it has to work on a string however
Letters ARE strings... right?
yes, but then they needed to be surrounded by quote marks
but what if its in vsd?
Like name of file?
cuz im trying to define command
and I got this:
const name = args[0].toLowerCase();
const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name));
ok, and you said toLowerCase is not defined?
well, it should work, unless args is not correct
args[0] is undefined
not toLowerCase
Cannot read property 'toLowerCase' of undefined
means
you cannot use .toLowerCase on something thats not defined, not toLowercase is undefined.
console.log(args);
in index, it defines like this: const args = message.content.slice(prefix.length).trim().split(/ +/);
?
log it in the command
Opinion: When searching for a guild member by name, should I consider their username & nickname or leave it out?
use ID.
This is for the user to search.
yeah, i almost always still search by username still
I fucked up, meant both their username and nickname
should do both
alright, I'll do both
soo
you logged this in the command right?
its kinda important the location you logged it at.
if you logged in index, and not in the command itself it wont mean anything.
what do u mean by, log it in command?
here, not in index https://woo.pics/images/3972b27471.png
discord?
please
thats weird ๐ ive never seen discord not embed images like that
o
๐
Gives me so many useless stuff and just fills my console..
your passing a message object where args goes
when you use execute in your index.js, the order of parameters needs to be the same in index.js and in your execute function
this is out of order
in your index, its something like
execute(something, message, something)
when args needs to be the second one
or the command needs to be changed, whichever is easier
yo cry.. your sniffer worked yet? u were always so eager to bad talk my idea so im surprised u didn't make the time to ridicule me again

args is empty

so args[0] is empty
there are a handful of free sniffers online if you need one
uh.. ok lemme explain the context
if you dont need tolowercase you can remove it, if you do, keep it, but check if theres something there before doing so.
basically for fun im trying to make something that can return script to the client without the user being able to see or manipulate the script.. it sounds impossible but im actually making progress.. if u wanna try.. try sniffing https://hidejs-example.paultaylor2.repl.co/ you're looking for a script that looks like
try{alert('HIDDEN SCRIPT >:D\nAt...\n/')}catch(err){}
you can use any means to try to find this script.. you probably can still find it but it wont be AS EASY as you think
feels bad wook
you dont have to tag me unless i dont respond ๐
if its not an array
what do you mean array?
[0] is accessing the first thing in an array
if your not doing that, you dont need it
that is similar to the requeest?
i am switching from discordjs to discordjs-light and this is now returning false. the bot does have manage roles permissions.
msg.guild.me.hasPermission("MANAGE_ROLES")
hmm?
its .js file
never mind.. I didnt had }
do i really need torestart my WHOLE bot everytime to just update a command code?
nope
you can have a reload command
or if using pm2 you can tell it to auto restart when you change files
I heard of those.. alr. Thanks
is this the pop up your talking about? https://woo.pics/images/1c99f425e9.png
the alert*
Whats scandir?
any why is it not a directory?
@solemn latch #development message
whats the code look like?
avatar.js is a file not a directory
const fs = require('fs')
const commandFolders = fs.readdirSync('./commands');
const folderName = commandFolders.find(folder => fs.readdirSync(`./commands/${folder}`).includes(`${commandName}.js`));
module.exports = {
name: 'reload',
execute: async (client, message, args) => {
if (!args.length) return message.channel.send(`You didn't pass any command to reload, ${message.author}!`);
const commandName = args[0].toLowerCase();
const command = message.client.commands.get(commandName)
|| message.client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return message.channel.send(`There is no command with name or alias \`${commandName}\`, ${message.author}!`);
delete require.cache[require.resolve(`../${folderName}/${command.name}.js`)];
try {
const newCommand = require(`../${folderName}/${command.name}.js`);
message.client.commands.set(newCommand.name, newCommand);
} catch (error) {
console.error(error);
message.channel.send(`There was an error while reloading a command \`${command.name}\`:\n\`${error.message}\``);
}
message.channel.send(`Command \`${command.name}\` was reloaded!`);
}
}```
readdirSync wants a directory not a file
that whole thing is from here
oh
I got it!
on line const folderName = commandFolders.find(folder => fs.readdirSync(./commands/${folder}).includes(${commandName}.js));
I should remove .commands/${folderr}
and just put ./${folder}
nope..
still same error..
anyone knows how to ix this?
fix
guys
so
I changed my cmds a littile
Now idk how to make my index listen to files in folders...
my index: https://pastebin.com/TyxN4xiC
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
do readDir for all the directories
that have commands
basically@copy and paste and change the path
o
done..
Now..
I made smth new..
And it worked PERFECTLY...
and just out of NO where..
this error came up:
error: ```TypeError: event.bind is not a function
code:
```js
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});```
How to fix a biggest weeb?
dont fix what aint broke
sry for late reply but ye u gotta allow the popup else it'll catch the error and block the page from loading
ah
?
literally half of that is prone to errors
im not surprised whatsoever that's generating errors, theres not a single error handler there
They probably forgot to export a function
not only that, the way that's done is also stupid
im bored enough, fuck it, i'll spoonfeed it for one
everything else is primitive but works

try {
let events = fs.readdirSync("./events/").catch((...e) => {console.log(e); return} );
if(!events) return // or throw here to stop it from continuing, most likely folder is inexistent
for(let _event of events) {
try {
let binder = require(`./events/${_event}`);
//do whatever you want here
} catch(e) {console.log(`Command ${_event} failed`, e)}
}
} catch(e) {console.log("loader failed",e)}
too lazy to do indentation or the rest, figure that out
@quaint wasp
That looks less reliable
either throw or exit process if the readdir fails
why is there _?
cuz thats what i name my variables that are related to eachother but are nmamed similarly
events and event are too similar
so i tend to stack them with _ if they are related AND similarly named
What about evt
y its not woek ๐ฆ
so complicated
but does it run the files?
This is the key
so how to fix that?
for (let event of eventsArray) {
for(let event of eventsArray) {
for(smallerEvent of event) {}
}
}
i rather do
for (let event of events) {
for(let _event of event) {
for(__event of _event) {}
}
}
but thats purely personaly preference
once again, im fixing your code, im not spoonfeeding it
figure out the rest
if you're at the level of blindly copy pasting code, you shouldnt be coding a discord bot
things should be named properly unless they are temporary
shorttening stuff like that makes a hell to dig through code
you'll often see the usage of _ in a lot of more professional looking code
though a lot of times its used as a reference for internal stuff
I often use and see _ used as a prefix for a variable/name to indicate it's unused/private.
though i use in both cases
imagine being Erwin.. 
exactly what i said #development message
Yeah I said that like 1 second after :p
But there's nothing wrong with using evt imo
how to fix that?
for event of events
for evnt of event
for evn of evnt
for e of evn
if you go down that rabbit hole you'll find yourself choking at the hands of another dev
indeed, but standards are there to be followed
otherwise people would be coding in sPonGEBoBCasE
What standard says I shouldn't use evt as a name and instead _event, evnt, etc.? Even if that were a standard, that's such a petty thing
same as Pascal case for classes , or _ for private/internal stuff, theres a lot of minor stuff you SHOULD follow, not that its necessarily a requirement
variables should be named what they are for
evt says nothing
doesnt explain what the variable is about
I don't know since the error points to a permission denied issue from npm logs and opening the better-sqlite3's package file. Maybe try running it with higher permissions like it suggests
you go back to this in bigger cases
readability wise its better to use _ as a different way to name your variables
i dont know how to its linox vps and i kinda dont know how to use that
evt says nothing
doesnt explain what the variable is about
I'd sayevtis sufficient. If you seefor (const evt of events) {...}, you can infer whatevtis. Even then, I don't regularly try shortening a variable if it's close to another variable name (but keep aware of it). I'd rather usefor (const event of events) {...}. I understand the use of following standards.
If I wanted to argue, I could say _event is a bad practice since it indicates _event is either private or unused yet you're using it like a regular variable.
This isn't a matter of following standards. It's a matter of preference.
i disagree
most loops you would use internally
its very few exceptions where you would be exporting something for user consumption within a loop
and even if you would, those exported things would get renamed by the user/consumer
What kind of loop do you use publicly? It's a body of expressions. It's not as common to use _ for a variable name to indicate privacy in an expression, but rather as unused. I could write ```js
for (const _x of yz) {
console.log(_x)
}
because it's "internal" and not "exported" to the user, but that looks weird. Like I'm saying, use `_event` if you really want to. I'm not going to come to your house and hold a balloon next to your ear and pop it if you don't, but other names like `event`, `evt`, `evnt`, etc. are also acceptable. It's not a matter of following standards because it compiles down to preference.
i disagree still, the example you are showing starts with a _ right away,m impling its used internally, what im suggesting is maintaining code redability while implying scopes using the same variable.
event explains what it is
evt and evnt doesnt, while they are shorthand of event, it still doesnt describe what the variable is about, which kills its readability
I always add _ as a prefix to variables when using methods like .map() to prevent variable overlapping
let array = [[[1]],[[1]],[[1]],[[1]]];
for(let arr of array) {
for(let _arr of arr) {
for (let __arr of _arr) {
console.log(__arr); //1;
}
}
}
// is more readable than
let array = [[[1]],[[1]],[[1]],[[1]]];
for(let arr of array) {
for(let ar of arr) {
for (let a of ar) {
console.log(a); //1;
}
}
}
the former implicitly mentions the usage of the parent variable, while the latter is just mushing random variable names for random usage
what the fuck
what im suggesting is maintaining code redability while implying scopes using the same variable.
Again, that comes down to preference.evtandevntare understandable from my perspective because I know it's a value fromevents. If you're in a loop spanning a lot of lines, maybe it won't.
The former is cleaner and easier to read, but __arr can be seen as misleading since __arr can implicitly imply that __arr is an array when it's a number. Then again, a change in the name to num fixes this. The second disadvantage is you need to count how many underscores you have (and they're very close together), but a good font can solve this. You don't have to shorten your variables. In fact, I'd discourage shortening a shortened name. Instead, what could've happened in the latter could've been different names to represent the value, but since your example is very primitive ([[[T]]]), it's hard to think of what that could be.
what can i use to make an animated wave in html?
something like this
but it moves
๐ฆ
My bot isnt responding.
I think the cmd handler is trash.
the cmd handler is from here:https://anidiots.guide/first-bot/a-basic-command-handler
It probably works. You're just using it incorrectly.
๐
May I ask if you have a good understanding of JavaScript?
You may want to spend more time learning the language.
Here comes Not Erwin
Discord bots can be simple for some, but to a beginner, it's difficult.
nah
at some points yes
Farrr not all the time
You should still try some. Like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
The JavaScript Guide shows you how to use JavaScript and gives an overview of the language. If you need exhaustive information about a language feature, have a look at the JavaScript reference.
yeah my example was crude, by my point still stands
using the example preiovusly
let events= [[[event]],[[event]],[[event]],[[event]]];
for(let event of events) {
for(let _event of event) {
for (let __event of _event) {
console.log(__event); //event;
}
}
}
// is more readable than
let events= [[[event]],[[event]],[[event]],[[event]]];
for(let event of events) {
for(let evnt of event) {
for (let evn of evnt) {
console.log(evn); //event;
}
}
}
I prefer underscores since they're consistent
dotenv is still good though, smh erwin
fuck you too
mmlul
anyway can we just agree to disagree
indeed
fine, after I get my bot up so it could at least reply..
if someone who know how to use vps can come to my voice that will be lovely
ho i can screen sher ๐ฆ
on pc?
You need bot developer or nitro booster role
if your having problems with using your vps, you should contact your vps provider
yo when did you become a mod
@dark crest do you know how to use ssh and stuff?
ty
no ijust bughot it
Thats how you connect to your vps
i connect him
For file transfer its ftp/sftp
Oh
so van u help mreith that?
I dont think so-
oof
you copy pasted your node modules folder right?
no i installed new
hmm
did you install it than upgrade nodejs?
lol
I dont think thats vps?
yes yesterday i remove my node and install it from the start
okay, then delete node modules and do npm i in the proj root
^
what is it mean proj root
the root folder, the project folder
so put the bot in the root folder?
project folder aka folder with the package.json file
Delete node modules in the project folder and run npm i in the project folder
i shwold put the bot proj in the root folder?
No need to
ok
Im trying to get the locations bewteen 2 points on a x y grid I need help with the math or something
You mean distance?
[p1, p2] right?
Ah, nevermind, i dont understand, sorry.
1,1 to 1,5 right?
Ah i see
Can someone help me with guild.join scope? When someone logs into my web panel, I want it to have them join the Discord for the Bot in case of support.
I picked all the correct oauth stuff, just dont know how to make it add the user to my guild.id
i did it same porblem
๐ฆ
run this: npm install latest-version
Also, the npm your trying to install isn't comp with node 15
My bot logs all bans into concol but I want to execute a command if there is over 2 bans logged in a second. no clue how to do it.
so what to do?
i want to make the command if the consol logs something more than twice a second a will execute
When you are trying to check for multiple permissions, should I use logical and operators, or do I use an array?
if(!message.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
Is it possible to save int in .env
if you pass it as an array it will do a logical and. if any permissions are missing is will return false.
Thanks!
Is there a way I can check if if(this is true && this is false) {... executes ...}
this can never be true and false at the same time
If (this == true && that != true)
Yes. If you for example have an empty object or something like that it would be false
nonon
For example
let variable;
let variableTwo = "Hello!";
if(variableTwo && !variable) console.log("Ok");
yep, that works
It works same as ```js
if(!variable && variableTwo) console.log("Ok");
... right?
yep, if they are functions they could be different
you can iterate through every different x and y ex. P1 (1, 2) P2 (5, 4) loop 1 to 5 and for each of those, loop 2 to 4
Instead of checking things like
if(!variable && !variableTwo && ....)
// Does this work?
if(![variable, variableTwo, variableThree, ...]);
nope
if(!val || !acc) return false
return true;
}, true)```
```const allTrue = [variable, variableTwo, variableThree, ...].reduce((acc, val) => !(!val || !acc), true)```
Oh, thank you! ๐
@humble gyro hi
Since you used a logical or operator to check if two values are undefined or null, I guess it would work for logical and operators as well like mine.
Anyways, thanks! :)
it would be better to do js arr.some(e => !e)
can i pass an array of channel ids instead of just one?
client.channels.fetch('222109930545610754')
https://discord.js.org/#/docs/main/stable/class/ChannelManager?scrollTo=fetch
Just one
darn
What can i use to make a bot ๐
check the pins in this channel
๐ง
anyone here know ejs
lul
TypeError: C:\Users\Noah\Desktop\aqualix-dashboard\Build\pages\public\index.ejs:1
>> 1| <%- include("../partials/header", { bot, user, path, title: "Welcome" }) %>
2|
3| <div id="wrapper-main">
4| <script src="/socket.io/socket.io.js"></script>
include is not a function
at index (eval at compile (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\ejs\lib\ejs.js:662:12), <anonymous>:51:17)
at tryHandleCache (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\ejs\lib\ejs.js:272:36)
at View.exports.renderFile [as engine] (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\ejs\lib\ejs.js:489:10)
at View.render (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\express\lib\view.js:135:8)
at tryRender (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\express\lib\application.js:640:10)
at Function.render (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\express\lib\application.js:592:3)
at ServerResponse.render (C:\Users\Noah\Desktop\aqualix-dashboard\node_modules\express\lib\response.js:1012:7)
at module.exports (C:\Users\Noah\Desktop\aqualix-dashboard\Build\functions\renderPage.js:8:9)
at C:\Users\Noah\Desktop\aqualix-dashboard\Build\routes\index.js:8:5
at processTicksAndRejections (internal/process/task_queues.js:93:5)
include is not a thing in ejs iirc
are you sure you are using ejs ?
sadly
cause include should work if you are using ejs
How can i round image corners in canvas? I'm trying to round the corners of my background image.
Someone knows Status can add more๏ผ
I made the set edit logs cmd
but it logs in the same channel the message is edited not in the logs channel
https://media.discordapp.net/attachments/272764566411149314/817806870356951050/unknown.png?width=559&height=427
https://media.discordapp.net/attachments/272764566411149314/817806956043305030/unknown.png
https://sourceb.in/437SJ3EmcM
https://sourceb.in/ESFjGOQIKs
const { Schema, model } = require("mongoose");
module.exports = model(
"logging",
new Schema({
req: {
required: true,
type: Boolean,
default: false
},
channelID: {
type: Number
},
guildID: {
type: Number
},
MessageUpdate: {
required: true,
type: Boolean,
default: false
},
MessageDelete: {
required: true,
type: Boolean,
default: false
}
})
);```
I made the set edit logs cmd
but it logs in the same channel the message is edited not in the logs channel for some reason it getting the id and logging it but not sending it pls help
how i do black white in canvas
like this
in js
pls help
@earnest phoenix
u will help me?
Canvas.JS,
const canvas = require('canvas')```
i know
Set the background to a black and white background if you want
i have the code
Then why not use it? Lol
but i dont know how to do black white picture like the background
Hmmm
This is an example of what I did with my bot for the canvas.js whois command
TopGGAPIError [Top.GG API Error]: 401 Unauthorized (You need a token for this endpoint)
i know to do it but i want the avatar be black and white
what to do
that's unreadable
i know do that
const background = await Canvas.loadImage('IMAGE_LINK_HERE');
// This uses the canvas dimensions to stretch the image onto the entire canvas
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);```
That's how to do it
they want to make the user's avatar black and white
this is the code
if (message.content.startsWith('!wasted')) {
if (!message.mentions.users.first()) {
user = message.author
} else {
user = message.mentions.users.first()
}
const canvas = Canvas.createCanvas(512, 512);
const ctx = canvas.getContext('2d');
const avatar = await Canvas.loadImage(user.displayAvatarURL({ format: 'jpg' }));
const background = await Canvas.loadImage(avatar);
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
ctx.strokeStyle = '#74037b';
ctx.strokeRect(0, 0, canvas.width, canvas.height);
const wasted = Canvas.loadImage(`./wasted.png`);
ctx.drawImage(wasted, 0, 0, canvas.width, canvas.height);
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'shot-image.png');
message.channel.send(attachment);
}
i want the avatar be black and whute
@robust moth I'll go ahead and try to add a black and white filter for you. Give me one second to do so
Np
import java.util.*;
class Test
{
public static void main (String[] args)
{
Scanner op = new Scanner(System.in);
System.out.println("Enter number");
int num = op.nextInt();
System.out.println("Factors are-");
for(int i = 1 ; i <= num; i++)
{
if(num%i == 0){
System.out.println(i);
}
}
}
}
Type of programs coming in my tomorrow's java exam
that's ez
...
I tried testing the command on a test bot of mine and it doesn't seem to be sending the image
uhh i really need help with this
Hey
I have a problem to my messageupdate.js
const Discord = require('discord.js');
const db = require('quick.db')
const { defaultPrefix, deletionTimeout, reactionError, suggestionPending, suggestionApprove, suggestionDecline } = require('../../config.json');
module.exports = async (client, message) => {
client.on('messageUpdate', (oldMessage, newMessage) => {
const logsmessageupdate = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`Un message a รฉtรฉ modifiรฉ !`)
.addFields(
{ name: `Membre :`, value: `<@${message.user}>` },
{ name: `Ancien message :`, value: `${oldMessage}` },
{ name: `Nouveau message :`, value: `${newMessage}` }
)
.setTimestamp()
logsmessageupdate.send(embed)
})
}
why undefined :/
make message.user to oldMessage.user
thx and just, can I add the channel who the message was edited?
Here is my code:
const canvas = createCanvas(1100, 370);
const ctx = canvas.getContext('2d');
const backgroundImg = await loadImage('https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg');
ctx.globalAlpha = 0.8;
let h = 370;
let w = 1100;
let x = 0;
let y = 0;
let r = 80;
if (w < 2 * r) r = w / 2;
if (h < 2 * r) r = h / 2
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.lineTo(x + w - r, y);
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
ctx.lineTo(x + w, y + h - r);
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
ctx.lineTo(x + r, y + h);
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
ctx.lineTo(x, y + r);
ctx.quadraticCurveTo(x, y, x + r, y);
ctx.closePath();
ctx.drawImage(backgroundImg, 0, 0, canvas.width, canvas.height);
How can i remove the gray in the background?
Img:
Can't you just draw the background image a little bigger so it fits the whole thing without those gray areas?
@earnest phoenix I'm pretty sure it has to do with the globalAlpha or the size
Hmm? I'm trying to round the corners of it...
Hmmm
Let me try and remove the global alpha.
Mk
Nope still same ๐
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
const Discord = require('discord.js');
const db = require('quick.db')
const { defaultPrefix, deletionTimeout, reactionError, suggestionPending, suggestionApprove, suggestionDecline } = require('../../config.json');
module.exports = async (client, message) => {
client.on('messageUpdate', (oldMessage, newMessage) => {
const logsmessageupdate = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`Un message a รฉtรฉ modifiรฉ !`)
.addField(`Membre :`, `<@${oldMessage.user}>`)
.addField(`Ancien message :`, `${oldMessage}`)
.addField(`Nouveau message :`, `${newMessage}`)
.setTimestamp();
logsmessageupdate.send(embed)
})
}
where is the error coming from?
wait
<Message>.user is not a thing, change it to <Message>.author
line 12
@earnest phoenix I will go ahead and test the command. I'll let you know if I can fix it
well it wasn't the full command
it was just my attempt to round image's corners
now its "null"
before it was undefined
and I have a error with this too:
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
if (message.partial) await message.fetch();
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
let logs = await message.guild.fetchAuditLogs({type: 72});
let entry = logs.entries.first();
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${entry.executor.id}>`)
logsmessagedelete.send(embed)
}
line 8
if (message.partial) await message.fetch();
the error: unknown message
You can't fetch a deleted message @earnest phoenix
oh
so I delete this
@earnest phoenix can you send full command so I may test to fix?
wtf
I have a error to the line 12 but its the oldMessage.author who have a error
๐ฆ
And what's the error exactly
.addField(`Membre :`, `${oldMessage.user}`)
oldMessage.author.tag
You didn't even change oldMessage.user to oldMessage.author as i told you
yes but
if I do this
I will show u
/app/node_modules/discord.js/src/structures/MessageEmbed.js:432
if (!value) throw new RangeError('EMBED_FIELD_VALUE');
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
at Function.normalizeField (/app/node_modules/discord.js/src/structures/MessageEmbed.js:432:23)
at /app/node_modules/discord.js/src/structures/MessageEmbed.js:452:14
at Array.map (<anonymous>)
at Function.normalizeFields (/app/node_modules/discord.js/src/structures/MessageEmbed.js:451:8)
at MessageEmbed.addFields (/app/node_modules/discord.js/src/structures/MessageEmbed.js:266:42)
at MessageEmbed.addField (/app/node_modules/discord.js/src/structures/MessageEmbed.js:257:17)
at Client.<anonymous> (/app/Events/Messages/messageUpdate.js
10)
at Client.emit (events.js:327:22)
at Object.module.exports [as MESSAGE_UPDATE] (/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js
12)
at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}
Are you using the messageUpdate event?
const Discord = require('discord.js');
const db = require('quick.db')
const { defaultPrefix, deletionTimeout, reactionError, suggestionPending, suggestionApprove, suggestionDecline } = require('../../config.json');
module.exports = async (client, message) => {
client.on('messageUpdate', (oldMessage, newMessage) => {
const logsmessageupdate = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`Un message a รฉtรฉ modifiรฉ !`)
.addField(`Membre :`, `${oldMessage.author}`)
.addField(`Ancien message :`, `${oldMessage}`)
.addField(`Nouveau message :`, `${newMessage}`)
.setTimestamp();
logsmessageupdate.send(embed)
})
}
here
hei
Have you tried to log what oldMessage even returns
yes
works
but
not the "Member"
You clearly haven't, log it and show us what it returns
wtf
i have a lot of thing
@earnest phoenix
I do console.log(oldMessage)
To: console.log(oldMessage.content)
Log the oldMessage object
Before creating the embed
its before
yes
@earnest phoenix I don't found the author of oldMessage
The object, not the content
console.log(oldMessage)
@earnest phoenix I have this: https://hatebin.com/lyywjrwffz
Do you have partials enabled?
In my index.js: const client = new Discord.Client({ partials: ['MESSAGE', 'REACTION'] });
Then the message could be partial
I delete partials?
Add this at the start of the event listener
if (!oldMessage.deleted && oldMessage.partial) await oldMessage.fetch();
if (!newMessage.deleted && newMessage.partial) await newMessage.fetch();```
at client.on?
You cant fetch old message
hey sir, big fan, i managed to post attachments :)
With a file upload?
Ah
Nice
Soonโข๏ธ
If I can't fetch, I do what?
Well as you're accessing the author of the updated message, access the author from the newMessage instead of oldMessage since both message's authors can't be different
when I console log newMessage
I have this: https://hatebin.com/rkrmwktnks
There are 2 messages in that log
yes
Did you log both old and new?
The author of the new message is available so access that
the author is my bot
not the user who updated the message
Then you logged the wrong message
Bots can update their messages too
I do: console.log(newMessage)
It says send is undefined but there is another one exactly like this but it just says decreased and it works
oh another error :/
wtf
he worked before
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
let logs = await message.guild.fetchAuditLogs({type: 72});
let entry = logs.entries.first();
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${entry.executor.id}>`)
logsmessagedelete.send(embed)
}
(node:19025) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
at module.exports (/app/Events/Messages/messageDelete.js:\25:59)
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}>
you didn't
um
i forgot
const user = foundn't
you didn't declare a user
The provided ID is not valid, the client does not have that Channel/Guild/whatever in the cache, or the code is run outside of an event listener, so the client is not logged in and the data is not populated.
so how am i supposed to stop it
it will scan every message
You can't stop an Array.prototype.forEach() loop
Only a for loop
^
js moment
can u maybe help me do it with for loop
nvm google fixed it
@river panther the problem, works, the embed dosen't have a problem, but I have a error in the logs
owo
fuck
make it a string
wsp[i]
"????????????????????????????????"
wait, so the command runs?
๐
the message delete
when I delete my own message
nothing
but when other admin delete a message
its not the user.id in my database
ah
I test a way
try try, i go eat something
oki
hey
Hey
does the checkmark next to my dc bot mean that it's verified?
removed the name as i don't want to get kicked for promoting or something.
just a real question
d.js so suck
you are not using a proper token
show how your setup looks like
in the json file + how you use client.login
@river panther if you are here, I found the problem and I need your help oof
well let me have a look
you are probably accessing it wrong
remove the real token and just put a few cahracters that are totally distant from your real token
and then show me
otherwise i can't help
how did you pass the token? ive had some issues with dotenv loading the token properly, but got it fixed
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const entry = await message.guild.fetchAuditLogs({type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first())
const userembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${user.id}>`);
const anotheruserembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${entry.executor.id}>`);
if (user == entry.executor) logsmessagedelete.send(userembed)
if (!user == entry.executor) logsmessagedelete.send(anotheruserembed)
}
the bot dosen't send embeds
message.channel.send(embed neme)
yes I do this
logsmessagedelete is a channel
look
djs so suck
yes but name is better
but I don't have errors in console :/
does anybody know a way I can securely accept automated payments, bearing in mind that the only way to see that the payment was processed is through either webhooks (optionally) or through a javascript event which you can enter your own code to execute stuff, im reluctant to use the js event as people could just edit the code but im not exactly sure how else to go about it because you cant enter custom data with the webhook for like identifying users etc
(this is for using paypal buttons)
not what I needed
can anyone help me out? I am using audiostream with discor.js to actually record audio chats.
however, it exports as pcm? How would i export it as mp3
Does --max-old-space-size affect any performance for discord bot?
use ffmpeg to convert it
you can also convert in realtime
that's what i want. How would i do that?
it can affect the memory usage
and eventually slow down your pc
on vps wtih 2gb ram, and for now discord bot is the only thing that run on it
the bookmark doesn't work properly ok
@eternal osprey
it shouldn't be such a big issue
i would just allocate it to 1536
okay great!
nvm figured it out
ping
pong
ping
Does anyone have a theme suggestion
yeah DARK
i would suggest chargebee, but idk if you can use it plain js
Hey
i entered my token to process.env file but i got this error in terminal
PS C:\Users\justi\Downloads\discord-modmail-master\discord-modmail-master> node bot.js
(node:29552) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\justi\Downloads\discord-modmail-master\node_modules\discord.js\src\client\Client.js:206:52)
at Object.<anonymous> (C:\Users\justi\Downloads\discord-modmail-master\discord-modmail-master\bot.js:215:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
can somebody help me?
How do you define it? Token=TheToken or Token="TheToken"
Token=TheToken
i need to type Token="TheToken" ?
it still gives me the same error with these variants
because the first is correct for .env fime
i tired all 2 but it still gaved me the same errors
Can't really help if no code either.
i can send the code
Here
i downloaded it from github
to my server
TOKEN=Mytoken.smtng.smthng
i entered real token
i just gaved you the fake one
to don't steal my bot
oh god
in this place right?
i dont really see whats wrong with it
Hi
yes
How can i make bots?
yeah replace that part
what coding language?
np
havent heard of it tbh
never heard about it
me neither but looks easy to me https://pebblehost.com/bot-hosting
What?
Ahem
See
I want u to suggest a language and tell me how to make a bot with it
its another pterodactyl host
just buy a VPS for that price
they dont give you full ssh access, they jsut give you the control panel
if you have never coded before in your life, try starting with an easier language such as javascript or python
hm
but learn the language itself first
fuck it
dont jump straight into bots
ecks dee
that dude whose token was invalid
can i ask him to give his token to me?
i can fix it x)
what
I want to make a bot in a month
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const entry = await message.guild.fetchAuditLogs({limit: 1, type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first())
const userembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${user.id}>`);
const anotheruserembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${entry.executor.id}>`);
if (user.id === entry.executor.id) {
logsmessagedelete.send(userembed)
} else {
logsmessagedelete.send(anotheruserembed)
}
}
I have a problem, when I delete my own message, the bot say its another user who deleted my message ๐ฆ
its my messagedelete.js event
bruh, if you want to make a bot either learn the language or https://botghost.gg
or whatever i
Bro see
do you know how to save emojis in a db? I can save them but when I try a select mysql (mariadb) returns everything and does not care of the exact emoji type
I want u to recommend a language
nodejs
i already did
And i will learnit
javascript or python
js
K
I will see it now
exdi
why is it in french?
that makes it difficult for me to understand
oof
you don't need to read french words
deleting your own message does not create an audit log
so you are getting someone else's audit log
how to fix this so?
if (user.id === entry.executor.id) {
logsmessagedelete.send(userembed)
} else {
logsmessagedelete.send(anotheruserembed)
}
}
I made this, so if the user is not same at the logs, send another embed
you will need to check if the message in the audit log has the same id as the deleted message
whats ur code
how to do so? XD
show bot.js where is the error
if (user.id === entry.executor.id) { is not possible?
can u click the error
wirus
lol
what line is the error on
show bot.js
at Client.<anonymous> (/app/bot.js:18:30)
not scam
it will take u to the error i think
the bot js file
do
```js
code
```
ok
let guild = client.guilds.cache.get(config.guild);
i think the error is on that line
exdi
fuck
hahahaha
ok
well, i have logged into your account already
xDDD
why do you have so many anime friends?
How can I do this??
oh no, why am i replying to myself from your account
if (user.id === entry.executor.id) { is the same
@quartz kindle can you help me?
yes
so you want it like, if you delete the message then the bot shouldn't log it
right?
he can log
then what do you want it to do?
just use patreon
so what do you want your bot to do?
explain your error nicel y
do you want it to show the log or not?
thatโs not how that works
payment should be processed on the server side, not client side
when I delete a user's message / a user delete my message, log it
oh, ok, then tim shall solve your problem
I can accept webhooks but the webhooks donโt have any data to pin point the transaction to a single user
so, you want it to
if the user deleted someone's message = log it
if the user deleted him/her/itself' message = log it
if you delete someone's message = log it
if you delete your own message = don't log
right?
if the user deleted someone's message = log it
if the user deleted him/her/itself' message = log it
if you delete someone's message = log it
if you delete your own message = log it
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const entry = await message.guild.fetchAuditLogs({limit: 1, type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first())
const userembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${user.id}>`);
const anotheruserembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimรฉ a รฉtรฉ retrouvรฉ !")
.setDescription(`J'ai retrouvรฉ un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimรฉ par : <@${entry.executor.id}>`);
if (user.id === entry.executor.id) {
logsmessagedelete.send(userembed)
} else {
logsmessagedelete.send(anotheruserembed)
}
}
is the button not generating a transaction id?
there should be a transaction it at the moment you begin one, and then you should receive a webhook with the same id when its finished
eyo during the time where i was at 2500 servers without sharding would there of been a chance it kicked the bot from a bunch of servers
or, you send some user identifying data to paypal when they press the button
and the webhook should return the same data
edit the embed part and write that in english please
They do but the transaction id would still have to be processed client side, and you also canโt send custom data to PayPal or through the webhook
the patreon API is no longer maintained btw
idk, i don't use it, a few people use it so...
My only idea is to have the client send their transaction id through an ajax query and then send the same through through the api but then there could still be a chance that someone tries to abuse it and change their transaction id
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const entry = await message.guild.fetchAuditLogs({limit: 1, type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first())
const userembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("A message has been deleted!")
.setDescription(`I found a message from <@${user.id}> in the channel <#${channel}> !\n\n${content}\n\Deleted by: <@${user.id}>`);
const anotheruserembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("A message has been deleted!")
.setDescription(`I found a message from <@${user.id}> in the channel <#${channel}> !\n\n${content}\n\nDeleted by: <@${entry.executor.id}>`);
if (user.id === entry.executor.id) {
logsmessagedelete.send(userembed)
} else {
logsmessagedelete.send(anotheruserembed)
}
}
@river panther here
oh no
you can add custom fields to payment buttons
the user fills a form, then clicks the button, the button should contain some of the form data
But the issue with this method is if the PayPal webhooks are being slow of the clients are being slow then there would be issues of their ids not being processed fast enough
did you gave something like chargebee a shot? they manage most stuff that is used for the payments, from your side you just need to redirect some requests
the method Iโm using doesnโt accept custom fields
also its free until you reach a certain volume of transactions
Iโve tried them in the past and I found it very hard to setup
I might try it if I canโt get PayPal to work
its a bit annoying but it works
also you can accept more stuff than just paypal with them
why doesnt the button support sending data
Iโm using "Smart Buttonsโข๏ธ"
i guess, what you should do is
checks the snipes
and then the bot checks if the message is deleted by the same user or someone else
and then it makes an embed
that will make the code neater
It doesnโt accept custom fields as far as Iโm aware
how to check if the message is deleted by the same user? XD
umm, just do
if ((the person who deleted the message).id === message.author.id){
//code
}else{
//code
}
wot?
oh, nothing, I go test
yes
so
When I delete my own message
works
but When I delete another user's message / a user delete my message: not works
screenshare
so, explain to me what happened, it was all in french
so
I deleted my own message
the bot says a message by chadoxi has been deleted by chadoxi
works
yey
when a user delete his message
the bot says "the user" messages has been deleted by himself
but
when I delete a message by another user
but says the message has been deleted by the user
actually it was me who has deleted the message
๐ฎ
const userembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("A message has been deleted!")
.setDescription(`I found a message from <@${user.id}> in the channel <#${channel}> !\n\n${content}\n\Deleted by: <@${user.id}>`);
const anotheruserembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("A message has been deleted!")
.setDescription(`I found a message from <@${user.id}> in the channel <#${channel}> !\n\n${content}\n\nDeleted by: <@${entry.executor.id}>`);
are you sure you have written these correctly?
which embed is for this?^ anotheruseembed or userembed
the embed to when the user delete his message is userembed
and the anotheruserambed is when user1 delete user2's message / or user2 delete user1's message etc...
oki
@strange pike hello
I wanted to ask something
Where can we code a bot like are there any special apps
@earnest phoenix

like special apps, like what? O_O
heiroku
owo

i self host my bot




