#development
1 messages · Page 892 of 1
Why?
good idea for me because my computer isnt work properly
small screen and keyboard
not matter for me
shit keyboard and no access to proper developer tools which will bite you in the ass as a beginner
nope
His name is termux
@languid heart refer to this message https://canary.discordapp.com/channels/264445053596991498/272764566411149314/703691789890093086
yes it beats süper computer
@languid heart refer to this message https://canary.discordapp.com/channels/264445053596991498/272764566411149314/703691789890093086
you dont seem to understand it tho
didnt i need to help
please
- dont code on mobile
- learn the language you want to use
- LEARN THE BASICS OF HOW BOTS WORK
@mossy vine i read this
Ik computer is better but mobile works
didnt i need to help can you stop saying taht
English
where is your bot's files?
what proggaimg lang
I can send u my code on termux
THEY LITERALLY DONT KNOW WHAT PROGRAMMING LANGUAGE THEY WANT TO USE AND YALL ARE ASKING FOR GH AND FILES LMAOOO
can you stop @mossy vine
sorry for trying to give actual helpful advice 
STOP @mossy vine pls
and starting with bot development on a phone with an ssh app is not the way to start
at least do research before starting kek
calm down
Ok can u help me i copy the start my bot on mybot guide and put my token and my commands
And it works
But i dont know how to put mod commands
you put mod commands by learning the fucking language and library you are using
@woven sundial i cant i dont have any
oof didnt i need to help
For me works only say me how
what is your bots proggaming lang
oh god this is only getting worse
@languid heart which language do you use for coding
agreed but not for fucking phone development
does anyone here actually want to give helpful advice 🙃
if by mobile friendly you mean fucked up ui yes
in here everyone and my keyboard hettin worse
My lang is english
I mean programming language
@languid heart what programming language
i am asking proggramin lang not your lang
im not saying that, im saying to take a big fucking step back and learn the basics
Javascript, Python etc.
yes
Say language not lang and is english
JavaScript, just saying 😏
THEY DONT KNOWW HAT A PROGRAMMING LANGUAGE IS HOW ARE YOU GOING TO ASK
^
@mossy vine calm down
Ok i am new at this so help me
are you using dbscript
Termux with node
ok here is help
take a huge step back
learn programming
learn a language
PROPERLY
then make a bot
and DONT COPY PASTE CODE, you wont learn anything from it
can you send photo of your code
Ok
outdated
outdated and only teaches how to ctrl c ctrl v
oh sorry not even that cuz they are on mobile 
@woven sundial lmao, that's where I started, yeeaarrsss ago aha
can you send photo of code @languid heart
i started by copying the docs example and learn from there lol
2012 gang trying to make minecraft plugins with the horrendous bukkit api
javascript
Ok
what the fuck are you doing
javascript you are using
^^
Ok
anyone wanna suggest more great ideas that will result in this but 10x worse?
no
Javascript ok hoe i put mod commands
🤦♂️
no it's not
big ooooooooooooooofffffff
learning bad concepts and continuing with them is not helpful in any way what the fuck are you saying
he literally created an event for every command
Emmmmmmmmm how i put mod commands
oh ye cutting a finger off every time you cut tomatoes is ok cuz after doing it for years and having -7213648128 fingers you will learn :)
@languid heart you need to first learn basics of javascript. Copy&Paste is so so bad idea
learn English first because the docs is in English
Ok
and stop saying "how i put mod commands" please
we need to help not argue
I can talk on english
well your code says different
you're really bullying this man lol
@languid heart my advice is try to understand code i dont say dont copy paste try to understand copy pasted code
my advice is to refer the library docs before asking anything rarted
yo does anyone know how to make your bot connect to voice and play an audio file?
what lib
the docs dont show that great of description...
in which lib
they do though
mabie to you, but for starter programmers they arent that great
uhh like audio library i guess?
oh god
yeah i would give up
discord library
discord.js? discord.py? eris? something else?
what js
discord.js ?
or eris
discord.js
the docs basically explained everything
and its actually good documentation
ill try these, if they dont work ill try something else
@lucid pasture what is your discord.js version
or even better: https://discord.js.org/#/docs/main/stable/general/welcome
I still haven't decided to go to discord.js v12
you shouldn't go into voice without even knowing fundamentals of the programming language you're working with lol
Yeah its just im lazy to rewrite
you'll have to anyway
yeah
You probably right
so why not now? :)
i wonder when they'll kill gateway v6
Yeah will get on that
v7 is basically v6 with more words in the error messages and nothing else lol
probably because the changes with intents and stuff
why isnt v7 even documented anywhere
yet every single library uses v7
they should at least mention it in the docs since everyone is using it anyway
wait what v7 is a thing wtf
should i switch to it
or can i like not get support for it
How do I remove an embed from a message using JDA? I have a message (from the bot) that has a message and an embed, and I want to edit the message and remove the embed.
you can switch to v7 whenever you want
is there a list of changes anywhere
any dev i can bully with questions about it 
arent intents also required
all libraries are using it, so it wont be anything new anyway
they are not required
discord.js has been using v7 for years afaik
well i mean i can read js so i could just steal the code no? 
thats what im doing
for light?
is it open sauce yet
tim's lib?
did tim give up on light
not yet, its in early alpha, working on websocket compression and shit
light its mostly finished, ill keep maintaining it while djs v12 runs its course
maybe add support for more of djs's features if needed
not yet
you can steal from djs and eris tho
i know, ive been stealing way too much from eris
but i cant find a non-bloated voice implementation anywhere :(
my next lib wont be worth stealing anyway
its actually a replacement for stealing from other libs
oh boy
so instead of stealing, you can just use it directly and build on top of it
is it a light lib?
I need to learn websockets lol
im aiming to fill a nieche market that i havent seen on npm yet
a core rest/websocket manager with 0 caching and 0 managing
thats what i wanted to do with mine but then i was like "lmao no fuck this" and i want to make it like serenity where you can completely customize what features you use
for people to build their own libs on top of it
i also found a way to use zlib without zlib-sync
will when i put it on github
ye but you can tell me how you implemented that 
i stole from a package called minizlib
its a weird ass way to do it tho
but it works lmao
i still need to benchmark it, but performance should be close to zlib-sync
maybe a tiny bit slower, dont know yet
Hey guys, why I'm getting map error?
winners.map
+ CODE:
const winners = await client.roll(giveaway.ServerID, giveaway.ChannelID, giveaway.MessageID, giveaway.WinnerCount)
const formattedwinners = winners.map(w => `<@${w.id}>`).join(', ');
+ ROLL FUNCTION:
client.roll = async (serverid, channelid, messageid, winner) => {
const server = client.guilds.get(serverid);
const channel = server.channels.get(channelid);
const msg = channel.fetchMessage(messageid).then(message => {
const reaction = message.reactions.find(r => r.emoji.name === "🎉");
if (!reaction) return new Discord.Collection();
//map hatası var la burayı elleme
let users = message.reactions.get('🎉').users
.filter(u => u.bot === true)
.filter(u => u.id !== message.author.id)
.filter(u => server.members.get(u.id))
.random(winner || "1")
.filter(u => u);
return users;
})
}```
show error
at C:\Users\sedat\Desktop\Projeler\GiveawaySystem\modules\functions.js:98:40
(node:6464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 72)```
Here.
winners is undefined
I am trying to use chrome devtools for debugging my bot (node.js) and i cannot get it to work properly. i am at chrome://inspect, and i added the hostname and port to the network targets, but it isnt seeing my node process. i can go to the port in browser and it will say "websockets request was expected", but the devtools doesnt seem to see it. anyone have experience with this?
i did it with an ssh tunnel
i temporarily have the port open so that i can test before adding authentication, but i cant get it to work at all
but i found it much better and easier to use something else
im running with node . --inspect=0.0.0.0:9229 and i have my.domain:9229 as the target discovery thing in chrome
ssh tunneling is easier and safer than any auth
but what i do is to simply run a test version of my bot in nwjs, and use the dev tools there
i am unable to run my bot locally without a whole bunch of work, so accesing it remotely is the only feasable option
idc whether i end up using ssh tunneling or something else for auth, rn im trying to figure out how to connect at all
try ssh tunneling, its easier to set up
Is there an avaibility to get the avatarURL of an User by ID if User and bot doesn't Share a Guild?
you create a tunnel connection to your host via ssh, then you connect to it the same way as if it were in localhost
LP you'd need to fetch the user by ID.
can i use the chrome devtools ui through that? or is it all CLI
it will also get autodiscovered in dev tools
aka users.fetch on the client users manager/collection.
Ok I'll try
once you setup the ssh tunnel, the dev tools will autodiscover it as if it were in localhost
@lime jewel yes you can fetch any user if you have their id and get their avatar hash
ok
oh your question was answered lol
ok ive never used ssh tunnel before, is this right? cuz i still dont see the process
ssh -L 9221:localhost:9229 user@my.domain -i my_key
ah it showed up finally, nvm
thanks tim
my bot is being a fool and wont turn on. (Moderators don't delete my screenshot I'll regen my token art software is broken)
ive waited ages and my bot wont turn on
where is client.login()?
oops-
lmfao

you could just copy the text 👀
My bot had wrong prefix the whole time
also, its funny to see the token variable being grayed
signing that its not even being used
anyone who has a more elegant TS solution? 😅
handleCommand = (message: Discord.Message): void => {
if (message.guild?.id === this.config.DISCORD.GUILD_ID) {
if (message.channel.type === "text") {
if (message.content.startsWith(this.config.DISCORD.CMD_PREFIX)) {
let cmd = message.content.substr(
this.config.DISCORD.CMD_PREFIX.length,
);
if (cmd.indexOf(" ") !== -1) {
cmd = cmd.split(" ")[0];
}
if ((commands as never)[cmd]) {
const cmds: Command[] = (commands as unknown) as Command[];
cmds[cmd](message, this.config);
}
}
}
}
};
or just use if (condition && condition2 && condition3) {...}
Well, I'm talking more about this part.
if ((commands as never)[cmd]) {
const cmds: Command[] = (commands as unknown) as Command[];
cmds[cmd](message, this.config);
}
but that'll become messy if you have a lot
I'm loading commands from separate files and I don't like the idea of casting them as never and unknown to satisfy typescript
EDIT: and then invoking them.
import * as commands from "./commands";
/* src/modules/CommandHandler/commands/index.ts */
export * from "./embed";
export * from "./rank";
export * from "./leaderboards";
const embed = async (
message: Discord.Message,
config?: Config,
): Promise<void> => {};
export { embed }
I lost so much time trying to come up with something more elegant 
Also, the last time I tried using less ifs it ended up like this 😅
return uA.level > uB.level
? -1
: uB.level > uA.level
? 1
: uA.level === uB.level
? uA.xp > uB.xp
? -1
: uB.xp > uA.xp
? 1
: 0
: 0;
I'm reading a file and storing the contents in a variable. Should I make that variable public so that any file can read/write to it or should I make it read only and add helper functions for it
that depends on how the rest of your project is structured ig
most functions depend on that config file
then i guess helper functions would be good
this is going to be comment hell
any suggestions on a command handler? 
@nimble escarp lol, never said use less if's, just make the if's structured.
lol just make 10k well structured if statements instead of an efficient structure
How can I get my bot to delete messages if the messages are older than 7 hours, regardless if the bot restarts?
in which library
discord.js
^like discord.js or discord.py
In a certain channel only
you shouldn't do that
it's possible, but it can take over a day to complete depending on how many messages there are
you'll constantly get ratelimited
and possibly api banned for api spam
It's a channel where I have been deleting messages older than 48 hours
why not just delete and recreate the channel
so that wouldn't be a big deal to implement for that channel, right? but how
There is just 8 messages or something now
But we're getting tired removing them constantly
Nope
Yeah
this is an http://xyproblem.info/
Asking about your attempted solution rather than your actual problem
I'd do something like "if the last message is older than eight hours then delete the channel and recreate it" 
u can store the time when u want to delete the msg
and then execute the message.delete at that time
It would keep the channel clean once activity goes down.
so if u save the time it will delete it regardless if the bot gets reseted
or make an interval, fetch the messages and filter them by time and delete them
ok
@nimble escarp ```js
if(uA.level == uB.level) return uA.xp > uB.xp;
if(uA.level > uB.level) return -1;
if(uB.level < uA.level) return 1;
return 0;
looks much better than this mess
return uA.level > uB.level
? -1
: uB.level > uA.level
? 1
: uA.level === uB.level
? uA.xp > uB.xp
? -1
: uB.xp > uA.xp
? 1
: 0
: 0;```
oh wait, im missing one xp part
I agree. I scrapped that code some time ago though.
This wouldn't work tho
since uA.xp > uB.xp needs to return either -1 or 1
false doesn't resolve to -1
yes, but false was meant to go to 0
0 shouldn't really happen though
True
It's basically for the sort function.
I was sorting people by their level and xp.
this was my first version
ok that make it much more readable
I used the shorthand operator basically for fun afterwards.
It was never supposed to be production code.
bubble sorts exist
i made it even smaller
if(uA.level == uB.level){
if(uA.xp == uB.xp) return 0;
if(uA.xp > uB.xp) return -1;
else return 1;
}
if(uA.level > uB.level) return -1;
else return 1;```
just removed brackets 
nvm, here is the smaller one
if(uA.level == uB.level){
if(uA.xp == uB.xp) return 0;
return uA.xp > uB.xp ? -1 : 1;
}
return uA.level > uB.level ? -1 : 1;```
it'd need to be switched around (-1 and 1s) but it looks good
ah right yea.
also cause there is no need to double check if their ex/level is higher or lower. if you check if they are the same or not first
so the if(uB.level > uA.level) would replaced with just an else if you move the last non-nested if function to the top
Guys i have to catch DiscordApi Missing Permission Error in discord.js how can i do that?
by catching
@earnest phoenix yes but in this case i have to use a lot of try catch statements
:d
that is if you're using async/await
if you're doing promise pattern then there's no way to make it pretty, use async/await
I'm not sure, but I've heard that large try catch statements aren't working right?
Why wouldn't they work?
I don't know i only see this in site
try catch is expensive on memory so instead of putting a band aid on it, a proper solution would be to check if you have the sufficient perms to execute the action before actually executing it
thanks guys
hey im looking for some node help
don't ask to ask
-ask2ask
mods only oof
my bot runs off an api, and i wanted to know if anyone could help me make my bot filter spaces into dashes so that users dont have to query with dashes
our asian friend is back to being an asian again?
code is there
Someone removed my nickname yesterday 
lmao
is it tho
okay vsauce
I temporarily gained autism
whistles in #memes-and-media topics
@valid gyro wdym filter spaces into dashes?
don't bully
replace them maybe
so you want to replace spaces with dashes?
so your url looks like this: website.com/my-arg-here
and you want people do to mycommand my arg here
yeah
you can just join the args with -
so split the message on spaces and join them by dashes?
.split(" ").join("-")
k one sec ill try that
you can also use regex for whitespace characters
you may need to remove the initial command from it: .split(" ").slice(1).join("-")
depending on how your command works
so .split(/\s+/)
Now I'm curious as to why not use .replace.
That would be the best course of action if he already had arguments split from the command.
replace is also an option yes
there is no specific reason to go with one over another, it just depends on how much control over it you want, and what you want to accomplish
there's a million ways to manipulate strings
join throws an unterminated string constant
wat
Well, I'd personally create a copy instead of mutating first.
like .split(" ").map().join("-")
ok so my code looks like this now
const args = msg.content.split(" ").slice(prefix.length).join("-");
const command = args.shift().toLowerCase();
and with the new join im getting args shift is not a function
o
else you will remove as many args as your prefix length
I'm doing it like this personally
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
same here
but if you're not using the command itself in the query, you can skip that part
and do .split().slice(1) instead, to remove the entire first word, prefix included
that time i got msg.slice is not a function, let me try some things and see if i can fix it
try catch is expensive on memory so instead of putting a band aid on it, a proper solution would be to check if you have the sufficient perms to execute the action before actually executing it
@earnest phoenix i did a permission check once, and somehow it still managed to execute it and discord gave me a 403 error
and its cause i didnt check for channel overrides
but to check for channel overrides, you would need to check for your role
oh, nvm found it
Hello, I'm looking for a free hosting for my bot, do you have any suggestions ?
I use glitch.com
Heroku or glitch
The best I can think of is the free tier for Heroku.
30 mins + you get limited monthly hours
I used to use it and it worked fine as long as it’s optimised
I had mine running for around 25 days before it shut off
Personal accounts are given a base of 550 free dyno hours each month. In addition to these base hours, accounts which verify with a credit card will receive an additional 450 hours added to the monthly free dyno quota. This means you can receive a total of 1000 free dyno hours per month, if you verify your account with a credit card.
1000 hours is around 40 days
const args = msg.content.slice(prefix.length).split(/\s+/);
const command = args.shift().toLowerCase();
this seems to split my args with a ,
This splits the args into an array, you can join them afterwards.
o
args.join("-")
Thanks for your suggestions ^^
still gives me commas
i think that needs to happen before it joins them with commas is the ting @nimble escarp
That code doesn't really join them with commas though.
I read somewhere that node does it by default
o wait
no, its still sending an array
when its sends an array it seperates with,
You have to join it while you're sending it.
it joins with commas if you dont join it yourself
i have a constant set up that joins it
comma is the default join when you convert it to a string
Show us the code.
const badargs = msg.content.slice(prefix.length).split(/\s+/);
const args = badargs.join("-")
const command = args.shift().toLowerCase();
what
so shift needs to go first?
use toLowerCase before splitting or after joining. use shift after splitting and before joining
.shift() returns the first element in the array
while removing it from the original array
ooooooohhh
@valid gyro
const badargs = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
const args = badargs.join("-");
Oh you probably shouldn't mutate the args, my bad.
@valid gyro is Glitch up 24h/7 for a small app ? 😮
with some extra scripts and uptime robot yes
cause glitch is designed for websites
so it will fall asleeo unless you html ping it every 5 mins
damn still getting commas even after shifting things around
show the rest of the code
although rn i just have it set up to send the args constant as a message for testing
all of the code
at least the current version that im tinkering with
its a little messy
const badargs = msg.content.slice(prefix.length).split(/ +/);
- const command = args.shift().toLowerCase();
+ const command = badargs.shift().toLowerCase();
const args = badargs.join("-");
your code should be throwing an error, not showing args with commas
it would throw an error, but i disable the api commands with // and replaced it with a command that sends the args constant to discord
it wasn't
it was defined after being used
i mean before you made the changes ovxr showed you
o, yeah idk then
const badargs = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
const args = badargs.join("-");
this is from your code, here on L2 args is being used before it's been defined
anyways it should work now
maybe glitch was doing something funky
yeah it works now]
thanks so much for your guys help!!
You're welcome!
Ok so, is it possible to pass a bot a link to a message and have it retrieve the message object?
if the message is accessible yes
i have a bot that does exactly this (its his entire purpose lol)
you need to process the IDs from the link
the guild id, the channel id and the message id
my bot throws back a sentence 2 times
check if your bot is in the guild (guilds.get or guild.cache.get)
check if your bot can see the channel (guild.channels.get or guild.channels.cache.get)
then try fetching the message (channel.messages.fetch)
aha
assuming you're using discord.js
ah then idk the functions
hmm
aight, guess I'll dig through the api for that for nw :9
anyone know how good idea it is a good idea to publish a release to the server on a release?
https://github.com/ThomasAunvik/AnimeListBot/blob/github-actions-scp/.github/workflows/dotnetcore-publish.yml
or if nobody is able to get trough it
how would i change my bots status in node? client.user.setActivity isnt working, im thinking maybe i put it on the wrong line, if so what is the intended line
If someone are already use the Shards in Discord.py mention me please x)
you're returning in a .then
resolve promise
your function doesn't actually have a return value
^
I would await the fetchMessage instead of using .then
ok woah, anyone else just get a random lagspike on their bot
@summer torrent can you look dm?
not just a lag spike anymore, didnt even mod the code, and now im getting no response at all
Sedat, you should be returning msg (https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/703710316202164265)
Just curious, is there anything wrong with sharding a bot under 1,000 discord servers?
there is nothing wrong
it just might not be ideal for performance reasons
but definitely nothing wrong
Yeah, that's what I was thinking. I saw it wasn't recommended, just wondering why. I added it, but commented it out until then. Thank you
yo, does anyone know a fix for the voiceChannel/textChannel lines, cause it keeps saying channel is undefined
what code?
js
but nvm im gonna use a different thing
yo does anyone know how to make your bot actually play audio instead of joining and having a green ring but no audio
channel is undefined
You should probably debug your code then and look at the d.js docs on how to connect properly
Hi guys
kk
anyone know what FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory error means??
to much storage taken up mabie??? idk
Lol oom
First time I see that in js
Try to optimize your var/const/let usage
And have only one listener for each type
Dang you running your bot on a toaster
lol
@prime cliff now its saying that server.dispatcher.on the on is undefined, anything i should use as a fix?
on is undefined
ye
server.dispatcher.on is not a valid function
Also what is server? a guild object?
the server is a variable and yea a guild object
Guilds don't have a disptach property though? https://discord.js.org/#/docs/main/v12/class/Guild
Also Here's part where error appeared ```js
function timer(arguments, receivedMessage){
var cnt = 0
arguments.forEach((value) => {
while(1 == 1) {
delay(1000);
cnt = cnt + 1}
if (arguments == "start") {
timer = parseFloat(value)
receivedMessage.channel.send(":clock8:Timer Started for"+timer+ " minutes:clock8:")
}
if (cnt == value) {
receivedMessage.channel.send("Beep beep beep timer for "+ timer+"has ended!")
}
})
}```
delay is a lib
@prime cliff can i dm you and show you the code that i have?
You could just post the code here
kk how do i put it in a box
```js
Code here
```
bot.on('message' , msg=>{
let args = msg.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case 'play':
function play(connection, msg){
var server = servers[msg.guild.id];
server.dispatcher = connection.play(ytdl(server.queue[0], {filter: 'audioonly'}))
server.queue.shift();
server.dispacher.on("end", function(){
if(server.queue[0]){
play(connection, msg);
}else {
connection.disconnect();
}
});
}
if(!args[1]){
msg.channel.send("You need to provide a music link!");
return;
}
if(!msg.member.voice.channel){
msg.channel.send("Please join a channel and try again!");
return;
}
if(!servers[msg.guild.id]) servers[msg.guild.id] = {
queue: []
}
var server = servers[msg.guild.id];
server.queue.push(args[1]);
if(!msg.guild.voiceConnection) msg.member.voice.channel.join().then(function(connection){
play(connection, msg);
})
break;
}
})
its a mess
At least you have some kind of prefix and command checking though
lol
And switch statement
I cant access projects on glitch
guys please help
What does FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory error mean?
Also Here's part where error appeared ```js
function timer(arguments, receivedMessage){
var cnt = 0
arguments.forEach((value) => {
while(1 == 1) {
delay(1000);
cnt = cnt + 1}
if (arguments == "start") {
timer = parseFloat(value)
receivedMessage.channel.send(":clock8:Timer Started for"+timer+ " minutes:clock8:")
}
if (cnt == value) {
receivedMessage.channel.send("Beep beep beep timer for "+ timer+"has ended!")
}
})
}```
delay is a lib
@earnest phoenix javascript already has a built-in timed delay features that you can use like so https://www.freecodecamp.org/news/javascript-timers-everything-you-need-to-know-5f31eaa37162/
ok thx
@prime cliff do you have any tips for the code im writing
Not sure what ytdl lib you are using
opusscript
You need to use the correct one for your lib version also you are not awaiting them?
i dont think so
Hello, i was wondering if someone could help me
with what
anyone know of a bot that can log time from when someone says !onduty till !offduty then have it outputed to a say Google doc for a log?
you programming, or you looking for one?
cause i could find a way to implement it to my bot if you cant find one
Im looking for one
ive been looking for an hour or sooo but nothing came close
What kind of coding is it java> or C++
i could put it in my bot, and then just have accsess to the doc and record the time there
that would be cool
ok dm me and lets set something up
Giphies and memes are to be posted in #memes-and-media. Don't forget that.
playBack = `${passedTimeFormatted} ${playBack} ${totalDurationFormatted}`;
```my passedTimeFormatted and totalDurationFormatted comes as `[object Promise]`
sorry im rust when it comes to coding i havent done it in 6 years
const passedTimeFormatted = formatDuration(
passedTimeInMSObj
);
const totalDurationObj = video.duration;
const totalDurationFormatted = formatDuration(
totalDurationObj
);```
yeah sorry @white shadow my fault 
i use discord js 11.3.x
Hi
Hi
@prime cliff I did do that
I guess you are here because of your latest problem with the max heap size
Your javascript sandbox is just out of ram to use
so it panicked and yeeted himself
i dont personally know how to let nodejs access more memory but there are docs online ig
How can I change the widget style
Because I want to put this: &style=for-the-badge
Pls, I want help with that
how do i send back a message attachment as an attachment
you read out message.attachments and send them back, reformatted
no you cant
thats the thing
is there a way
ok see
apparently attachments only support buffer resolvables or streams,
and all message attachments return are strings and width/height
you can send attachments as urls too
.send({attachments: [url1,url2...]})
i think
dont bully me if its not working
apparenly not
huh
E
oh okay that works thanks
sucks that embeds are below message attachments but
sigh
How can I add a bot in discord server list
Yall know when the verification will be done?
verification as in what. Discord bot verification (with the check mark)?
verification: probably 1-2 weeks.
for dbl verification: probably 1-2 weeks
both depends on how many requests they are getting
took mine three weeks
Does anyone have any like proxy setup for lavalink?
this code isnt returning anything
not errors not messages not nothing
i didnt change anything as far as I know, but it doesnt work
fixed it
is that possible count user votes ?
Few things wrong there at first glance Ragnarok
1.) startsWith needs an inverse if operator
2.) are you even logging in
kk i fixed this with using database 👍
How do I shard with Eris?
alr thanks
well, if you only want to use eris
Client initialization supports it with using options
firstShardID lastShardID maxShards
hello, trying to make a setwb command where when you do 'setwb #general" it'll welcome people at that server
so this is the command its self also it dosent work but this is where it should be defined properly
but that dosent even work
so heres this all in https://pastebin.com/Ng4Y0WAY because if I put everything in it it would count as flood but yeah i need someones help
please dm me if you gonna help cause i aint gonna focus on this chat
@turbid bough which is better? eris sharder or just plain eris?
i dont use eris so idk
ok then im using eris sharder
im guessing clustering requires making your own database/connecton. or making very strict configuration
what
idk.
do you know what clustering is
yeah, multiple shards in different servers
different processes
oh ok
so if you have 4 cores for example, having one cluster per core is the most optimal?
ive tried sharding, but idk it does not work sometimes when trying to use different processes
or its just my library isnt up for it
just searching up "discord bot cluster" will come up eris sharder as the top search result
oo i think i found it
because.. thats its main selling point..
is glitch.com a good host for bots even tho it is not made for that?
Lavalink4NET
@earnest phoenix if the bot is in like 5 servers yes
how about 1 server only?
if you can deal with its limitiations then go for it
alr then cuz i just need a temp host to test Eris at while having my old d.js bot still running properly
@fair shoal
or maby you cant communicate between discord clusters directly with eachother
with discord.net
You would need some sort of IPC/RPC layer for that
ok, but i dont technically need any direct communication for them to work?
but, i noticed if you dont launch the shards in order, it wont connect or something
order shouldnt matter afaik? maybe it does and its just not mentioned in docs
You have to specify the first and last shard ID
im not using eris btw.
I saw.
ah right i did tell that
what about totalshards?
is that total shard as in total with all the clusters?
or in total in just that one cluster?
jeez, i cant test my bot lol, i dont have access to my database
Hey, how long does it take to approve a bot?
1-2 weeks
oh okay
@turbid bough total with all clusters
ah cool 👍
can you for example use id 100-199 for cluster 1 and 0-99 for cluster 0 but with only initializing 2 shards per cluster?
so you can expand them later easily
.size to get the member count
script?
setInterval for the status
or?
use memberCount
this my script
i want to make interval
and member count
bot.on('ready', () =>{
console.log('this bot is online');
bot.user.setActivity('idk')
})
bot.on('ready', () =>{
console.log('this bot is online');
bot.user.setActivity('idk')
})```
setPresence
@scenic nest are you trying to show the bot's status and member count of it's users in it's custom status or something?
yes
@scenic nest example of setinterval
let p = 0;
setInterval(() => {
p++;
bot.user.setActivity(p.toString())
}, 12000) // 12 secs is minium to change the presence```
so every 12 secs it makes the number higher on status, so i think thats enough explaining to you.
Right so I've queried a mysql table, mapped the result, sorted it by one of the columns and now I want to display the top 10 values (for a leaderboard) although when it comes to iterate through that array or map or whatever it's called it's out of order
I have a second leaderboard and I use identical code for it but that one works perfectly
I've console logged the sorted array and it's in the right order
Any things I should be looking for?
ok thx
Ignore the above spiel I worked it out ^
@fair gust
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
O
How would I write a function to check if args[0] is larger than 100 because args is a string so I’m not sure how to sort of convert it into an integer
@fair gust https://youtu.be/J4VBkQTN9Fc
My OLD Server Got Banned This Is New Server Link : https://discord.gg/KhFq3Hr
Hello Gyz,
.................Today I am Going To Show You How To Add Welcomer Bot In Discord In Just 2 Mins Very Easy Tutorial So Watch Til End
And Enjoy...
Please Subscribe My Channel And Press The ...
@sacred mountain parseInt(args[0]) to convert it into an integer
Would that be just for that function or does that permanently change it?
what the fuck no thats not how you compare a number
and i just told you it doesnt affect the original variable
>=
Can i use Anime Gif API to my bot and add my bot to top?
if(args[0] >=100)?
If it might contain loli/shouta then no.
@sacred mountain you want to parseInt args[0] tho
no
then how
if (parseInt(args[0]) >= 100)```
Guys i want to reduce my memory usage , do you have any advise for that ?
use lighter libraries and packages
Can i use open API to my scripts?
What happens if you use parseInt instead of Number?
Makes me think it's either, not a number,
or undefined when passed.
That's the result.
That doesn't show us what arg[0] is.
If arg[0] exist.
Log args[0] to console
No, 5 is **5**
Right.
I recommend separating command from args.
const [command, ...args] = message.content.substring(length + 1).match(/\S+/g) || [];```
Example how I do it. (My bot uses mentions instead of prefix)
can some1 tell me why this counter dont work in c#?
int counter = 0;
foreach (var guild in Client.Guilds)
{
counter++;
}
Console.WriteLine(counter);
i get 0 all the time
i did a command with the same code and i am getting a normal output but not when i do it like this
i want to take orders of gfx from my bot how to code it like that like someone order r!order logo then its info. will came to me
setInterval()
Number(args[1])
if(Number(args[1]) !== NaN)
How to get my bot change status after 15minutes?
I'm use discord.js v12
Number.isNaN(args[1])```
Please help me
frequent status change is probably a tos violation
15 minutes?
15minutes isn't a TOS violation.
@wispy bough google how to work with setInterval with javascript.
frequent change of status within 24 hours is very illegal /s
ok buddy
12 secs = minium, even tho its little api abusing.
You can check the ratelimits by making a request to that endpoint. whatever the x-ratelimit says, that's what it is. if it says 12 seconds, then waiting 12 seconds to do it again is not API abuse, not even a little bit
let activities = [ `${bot.guilds.size} servers!`, `${bot.channels.size} channels!`, `${bot.users.size} users!` ], i = 0; setInterval(() => bot.user.setActivity(`${bot.prefix}help | ${activities[i++ % activities.length]}`, { type: "PLAYING" }), 15000)
I'm use this command to get autochange status to my bot and get this bug
(node:3600) UnhandledPromiseRejectionWarning: ReferenceError: bot is not defined
Note : 15000 is not real number, I'm just use that to test my commands will work right.
bot is not defined
const (the name you put) = new discord.client()
you need to put the name you put instead of bot
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Clients are allowed 120 events every 60 seconds, meaning you can send on average at a rate of up to 2 events per second. Clients who surpass this limit are immediately disconnected from the Gateway, and similarly to the HTTP API, repeat offenders will have their API access revoked. Clients are also limited to one gateway connection per 5 seconds. If you hit this limit, the Gateway will respond with an Opcode 9 Invalid Session.
If a guild is deleted - the guild ID can be given to someone else?
Or it's gone forever?
gone forever
@obsidian sky
Why is ctx.guild.owner returning None in this server?
If a guild is deleted - the guild ID can be given to someone else?
@cinder dove ids are time based, once it is used it will never be used again
Why is
ctx.guild.ownerreturning None in this server?
@sullen yacht The owner isn't cached
Oh right
Thanks @blissful scaffold
@slender thistle is there much i can do to fix it? i was told its likely just a discord issue as discord.py caches everything but im not sure
fetch_guild? 
ahhhhhhhh i did not think of this thank you
you need it?
@pale vessel be quiet
i thought you're fine with ffmpeg
i am asking for help
i thought you're fine with ffmpeg
@pale vessel if there was a better option than the ytdl then yes i would be
it's simple, download the server, copy the application.yml, and start the jar file
Nooo
and use a wrapper
It's not the node stuff I am confused with]
I will take any help I can get
@pale vessel coding it, I am tryna use a tutorial, I have a node
And it doesn't work
Nothing works
what do you mean by "nothing works"?
how did you code it?
there's an example in the readme
@pale vessel I tried lavacord
didn't work
Tried my friend's wrapper
Didn't work
Morning, would some be willing to help me fix my eclipse, im trying to get back into java joding and ive download eclipse and the lastest JDK and im trying to learn how to code a discord bot
"didn't work"
dude, come on
!p blinding lights
@pale vessel kept giving errors like 401
@pale vessel yes
client.channels.get(`${captchaChannel}`).send("📌 | <@"+member.id+">, vous avez 15 secondes afin d´acceder au reste du serveur, veuillez envoyer ce code (`"+password+"`) dans ce salon.").then(m => m.delete(15000)).then((m) => { m.channel.awaitMessages({ maxMatches: 1, time: 15000, errors: ['time'] })
This is in guildMemberAdd event
v11.5.1
but don’t worked
did a member join the server? Are you sure the event is firing? What are you getting?
and are you sure captchaChannel is a channel ID.
Yes it triggers but it tells me that it cannot read the awaitMessage property
yes.
oof
so
m.channel.awaitMessages don’t work :/ 
but idk why
What is the exact error message?
Now there is no more error but the awaitMessages does not work, when the user sends the message that the awaitMessage waits, the bot does not react. And the message deletes well after 15 seconds
@hasty sparrow
shouldn't the first argument of awaitMessages be a filter.
What do I use as a filter?
There's an example in the docs: https://discord.js.org/#/docs/main/11.5.1/class/TextChannel?scrollTo=awaitMessages
tjx
read the docs next time
I have a a question that if a add a command call !invite it will give the bot invite link so that was against discord tos?
length: "9",
numbers: "5",
symboles: "4"
});
const filter = m => m.content === password
console.log(password)
client.channels.get(`${captchaChannel}`).send("📌 | <@"+member.id+">, vous avez 15 secondes afin d´acceder au reste du serveur, veuillez envoyer ce code (`"+password+"`) dans ce salon.").then(m => m.delete(15000)).then((m) => {
m.channel.awaitMessages(filter, {
maxMatches: 1,
time: 15000,
errors: ['time']
}).then((collected) => {
member.send("✅ | Vous êtes maintenant vérifié dans le serveur **"+member.guild.name+"** !\n\n`Si vous ne voyez pas les salons, contacter l'administrateur du serveur.`")
member.addRole(captchaRole).catch(err => {
console.log("Impossible de donner le rôle.")
})
}).catch(collected => {
collected.delete()
member.send("❎ | Vous avez saisi le mauvais code de vérification : vous avez donc été kick (si ce n'est pas le cas, quittez et revenez dans le serveur).")
member.kick()
})
})```
Hi guys, I've used this code to post my bot stats, but the number of servers on the page still shows up N/A:
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
Full ready event:
client.once('ready', async () => {
console.log('Ready!');
client.user.setActivity('$help');
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
Have you waited 30 minutes?
@opaque seal what version of Discord.js are you using.
or in fact what library as well
v12
Have you waited 30 minutes?
@split hazel I had this code for a while but my bot didn't have any shardssetInterval(() => { dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total); }, 1800000);
So I changed it to this
client.once('ready', async () => {
console.log('Ready!');
client.user.setActivity('$help');
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
});
collections were moved to managers (e.g., guilds.size is now guilds.cache.size)
Something errored this, and I cannot find the issue, I've let it run into a onlince character count and its not at the max a .json file can fit
what was the error?
Thats the issue, it says it doesn't have a correct end of line thing like } or )
While it definitely has
Cogs or one single file
cogs if doing a lot
This issue appeared in 2 different .json files for economy and warning system
I don't know if a json file can really have a max. If you're using JSON as a database, that may be your issue, but try putting it in a JSON beautifier and see if you can spot the issue.
i use this a lot
So I'm trying to replace an eval sequence since everyone tells me its the devil
yeah you have to be some witchcraft user to ever hit that character limit I never know about
m.embedH0 (page 0) m.embedH4 (page 4)
m.embedR0 ...
etc
Would the next easiest option be finding objects by something in the datablock?
Ie, I can pull the footers as a string off whatever current one is displayed
I'm struggling with an updating message.
Here is the current behavior:
First user calls the !join command and everything runs as intended.
Second user calls the !join command and is added to queue. The database shows that both users are in queue, with the correct user IDs as well. However, for some reason that I cannot figure out the async function's variables are overwritten so it starts checking only for the second user twice.
Here are the console logs showing that there is an actual overwrite:
[16:17:35][Console/Log] start: 313367547028176898
[16:17:35][Console/Log] justBefore: 313367547028176898 313367547028176898
[16:17:40][Console/Log] checkPosition: 313367547028176898 313367547028176898
[16:17:45][Console/Log] checkPosition: 313367547028176898 313367547028176898
[16:17:49][Console/Log] start: 503649108163035158
[16:17:50][Console/Log] justBefore: 503649108163035158 503649108163035158
[16:17:50][Console/Log] checkPosition: 503649108163035158 503649108163035158
[16:17:55][Console/Log] checkPosition: 503649108163035158 503649108163035158
[16:17:55][Console/Log] checkPosition: 503649108163035158 503649108163035158
The logs at 16:17:50, and one from 16:17:55 should be the first user.
Here is the part that logs these values, and where the checkPosition function is being called.
Here is the IntervalTimer class that's being called
@maiden mauve Why not use deeper nesting (m.embed.H[0], m.embed.R[4], etc.)?
I think that's the answer I'm looking for
get the identifier for menu
and then ++ or -- the array
just a bit rusty on the syntax
I saw your eval sourcery yesterday, forgot to comment on it
lol
it was a fun solution to the problem
but not a release to the public solution
As long as it works ¯_(ツ)_/¯
so instead of that
it would be more like
embedH:
... array element 0
... array element 1
Yep
So... my bot was just declined again. Who can I talk to to appeal that decision?
@fresh kernel Could you go into more detail?
Your bot was likely declined because it broke one of the "bot rules" listed in #rules-and-info.
To find out why your bot was declined and by who, use the search feature in #mod-logs:
Oh. So if I message the bot, someone will read it?
Sure, what do you need to know more @hasty sparrow ?
the moderator
How do i fix this
Oh wait... yeah I don't know who that is. I just got something from Luca.
-declinedbot
Your bot was likely declined because it broke one of the "bot rules" listed in #rules-and-info.
To find out why your bot was declined and by who, use the search feature in #mod-logs:
tells you how to find out who denied your bot
Cool thanks
@hasty sparrow btw Duke, is that name from the Henry VIII show?
No
@fresh kernel You are creating a new timer whenever the command is run
Yes, my I want a separate timer for every person that runs the command
I'm trying to use heroku with cogs but it aint working
https://github.com/mohgram/DRIPBOT
Here's the code
(TOKEN'S RESET)
Unless there's important code missing I don't see the issue
exactly
Ohh wait, now I get it
what is it
Talking to DrCas
???
Oh, do tell me?


