#development
1 messages · Page 909 of 1
message.channel.awaitMessages(() => true {max: 1, time: 5000}).then(collected => {```
comma after true
k
new problem
the message calling up the awaitMessage is counted as a response
message.channel.awaitMessages(() => true, {max: 1, time: 5000}).then(collected => {
console.log(message.content)
}).catch(err =>{
console.log("err")
})``` it instantly just logs the message that brought up the await message function
without waiting for a new message
.catch(console.error) 
oh
or .catch(console.log), doesn't matter
that's weird... well you can put msg => msg.id !== message.id that way it won't detect the message, though I don't think it should in the first place.
Or you can set max to 2 and get the collected message via collected.last()
Ohh
Umm
It now logs a TONNE of random stuff about the channel
message.channel.awaitMessages(() => true, {max: 2, time: 5000}).then(collected => {
console.log(collected.last())
}).catch(console.error)```
yes, collected is a collection of messages
oh
collected.last() gets the last message
yeah but last is a function, so last()
collected.last().content?
yup
you should always check if collected.last() actually exists, though. Afaik awaitMessages only throws errors when you tell it to
Oh
Is there a way to go around the 25 field limit of an embed?
no
rip
You can use a webhook to send multiple embeds also
Just use pagination
I have an help command which lists all my bot commands in different pages, using reactions to change pages. But On one page I use more than 25 fields for the commands so I guess I'll have to create a new page
Just use pagination
Yeah , my commands are divided by category, but one category has to many commands, so them don't fit all in one page
Each command uses a field? Why not just write the name of each to the description?
if(page === 2){
embed.fields = [
{ name: 'Means everyone in the server can use them', value: '\u200B' },
{ name: 'Prefix', value: `Remember, every command has to be preceded by the \`prefix\` \nThe prefix, in this server, is ${prefix}\nYou can always use commands by tagging <@${message.client.user.id}> \n(example: <@${message.client.user.id}> help )` },
{ name: '\u200B', value: ':small_red_triangle_down:Command', inline: true },
{ name: '\u200B', value: ':small_red_triangle_down:Description', inline: true },
{ name: '\u200B', value: 'Usage :arrow_heading_down:', inline: true },
]
for(i = 0; i<cMembers.length; i++){
embed.addFields(
{ name: '\u200B', value: ':small_orange_diamond: `'+cMembers[i].name+'`', inline: true },
{ name: '\u200B', value: `${cMembers[i].description}`, inline: true },
{ name: '\u200B', value: `${prefix}${cMembers[i].name} ${cMembers[i].usage}`, inline: true },
)
}
}
```It's pretty neat like that
@opaque seal you know that would look very bad on mobile
uh-oh!

So all in one field? that's what you are saying?
Or if your lib supports it just check for mobile status and do an embed that looks good for mobile

why not have a site with all the commands if you know html + css?
It doesn't have to be like a dashboard
I was planning to make a dashboard for managing the bot
But I don't think I have the knowledge to do that still
I'm learning
why not have a site with all the commands if you know html + css?
All of them are on the bot page of top.gg
The help command was just an additional thing
why not have a site with all the commands if you know html + css?
Also I would love to, but I don't wanna rush learning all that stuff
using your topgg bot page is good enough for now
Yeah think that too, I'm just gonna add another page to the help command. I'll think about the mobile stuff in the future
Whats the best way to send an Embed Message through BroadCastEval (using Shards)?
you shouldn't
What's the best approach?
Trying to invoke a function on a client/shard causes "Discord = undefined"
Omg I want to cry... my bot joined a fairly large server, which was Chinese. I have even tested my MySQL database on Chinese characters, nothing wrong. But why doesn't it accept them now? I was using utf8mb4_unicode_ci
now it left the server because of this
arnt chinese characters utf16?
but that's not an option in MySQL
oh wait utf16 is
but not mb4
utf16 and 32 not working 😦
Hi. How can I use an invite link in discord.js. Basically what I’m trying to say is that it creates an invite link but I then want it to log the link to the console. How would I do that?
Why
guys let's say i want my bot to do something every time someone votes for it on dbl. I'd call the dbl.on_dbl_vote(data) within the main.py of my bot?
because ToS exists and say invasion of privacy creating and logging invites to servers your bot is in
log the link to the console.
Omg I want to cry... my bot joined a fairly large server, which was Chinese. I have even tested my MySQL database on Chinese characters, nothing wrong. But why doesn't it accept them now? I was using utf8mb4_unicode_ci
^ confirmed idiot again
🙂
how do you delete duplicate entries in phpadmin
why is @ everyone a role
¯_(ツ)_/¯
yeah but now i need to check if they are trying to add @ everyone as rank 😐
yes
yah it is just one extra line of code
For some reason my database is adding duplicate rows when someone does a command when it's set to UPDATE not INSERT
strange
How i can check does user.id have been exist in database
@turbid bough me 2
Wait the website have been hacked ?
or ssl expired
ssl certificate expired
SSL cert expiring doesn't mean it got hacked
bruh just asking
they just forgot to renew the cert
If I'm using collector for emotes, how would I end it when the user just reacts with 1 emote.
collector.on("collect", async(reaction, user) => {
if(reaction._emoji === emote1){
return message.channel.send(...)
}
});
So I'm currently do something like this, should the return not end the collector??
@earnest phoenix Either select from database where user id, if a value is returned it exists or use an "on duplicate" query
Ahhh okay thx ❤️
@vague kite you can also just specify the amount of emotes you want to collect
max: 1 right?
yup! In the options parameter
how to fix 😐 https://img.thaun.dev/qzddj.png
is this coming from the web app discord?
from my website, but im using discord oauth
node
no idea then
asp.net recently added changes to support Chrome's enforcement of SameSite cookies
idk i guess ill just ignore it for now
it's just a warning
yea, but https://img.thaun.dev/hhyvr.png
feels much better
i dont really like to ignore warnings, and saying "its just a warning"
what exactly are warnings even for then
it's just a warning
Im traying to make a discord and when I do node . this happens ReferenceError: discord is not defined
Have you defined discord?
what do you mean
const discord = require('discord');
case matters
big D
const Discord = require('discord.js');
const bot = new Discord.Client();
const token = ' ';
bot.on('ready', () =>{
console.log('This bot is online');
})
bot.login(token);
thats what I put
idk where you got that error though
ok
wrong file?
if thats the code you have, then its correct
idk what i did wrong
you probably executed the wrong file
the error says that you have a discord somwehre when it should be Discord, so either you are showing the wrong file, or you didnt save the file
ok
ReferenceError: discord is not defined
at Object.<anonymous> (C:\Users(Classfied)\Desktop\Discord bpt\index.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
show your index.js file
you didnt save the file
you didnt save
wait it went on
also regen your token

you need to save for changes to take effect
i mean, is it your first time writing a document too?
it thought my bot was offline for a millisecond
yea
you need to save for every change to take place
have you ever written a word doc or an excel spreadsheet?
no
how come
press CTRL + S on every change
to save the file
and if you see a dot on the name of the file
then that means you haven't saved it
yea ok
you can also enable auto-saving
I like to use auto-save when focus on the window is escaped.
idk, would it work with when hitting F5
i dont use autosave lul
i do
how do you live without it?
Autosave + Pycharm's local histroy system is amazing
So many times I go to reload something but it does nothing because it wasn't saved
its my reflex on hitting ctrl+s
i don't have autosave but verbose backup so every time i save, it makes a backup of the previous version, in case of corruption
and i use Ctrl s every time i make a change lol
i use webstorm, and its automatically enabled that it autosaves...
sorry for trying to make my life easier jeez 😳
in one of my projects i have auto-upload on save and auto-restart on changes
imagine if i had autosave turned on
oof
that'd be gay
I'm so confused my bot keeps going off every now and then without any logs or anything
discord api disconnects
Is your bot just going offline, or is your app exiting?
Error: 503 Backend fetch failed
at IncomingMessage.<anonymous> (/rbd/pnpm-volume/ccfc9e2e-e1fa-4dd0-838d-c3b5bb122b10/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/index.js:118:25)```
never™️
For a good few months I never noticed any errors from here, so that's a positive
Or maybe I just wasn't looking hard enough
hmm
How can I make it a function
Because this part use in multiple command .
https://sourceb.in/07959913c9
ah yes
i'm getting this string from moment-timezone.js, how can i convert it to a UTC epoch? using Date() Tue May 05 2020 09:53:55 GMT-0700
seems like Date() want it's input in this format ```js
const javaScriptRelease = Date.parse('04 Dec 1995 00:12:00 GMT');
anyone know an easy way to convert my former string into the format of later? or know an Date method that accepts the first format?
kinda surprised moment-timezone doesnt return strings accepted by Date()
Loading the bot this way, It worked before, but now it hangs for some reason.. any idea why? it doesn't give me any events.
fs.readdir("./src/event", (err, files) => {
if(err) return console.log(err)
files.forEach(file => {
if(!file.endsWith('.js')) return;
const event = require(`./src/event/${file}`);
let eventName = file.split(".")[0];
Client.on(eventName, event.bind(null, Client));
})
})
fs.readdir("./src/", (err, srcs) => {
if (err) return console.error(err);
srcs.forEach(src => {
if(src.includes(".")) return;
Client[src] = new Discord.Collection()
fs.readdir(`./src/${src}`, (err, files) => {
files.forEach(file => {
if (!file.endsWith(".js")) return;
console.log(`Loading /${src}/${file}`)
properties = require(`./src/${src}/${file}`)
Client[src].set(properties.name, properties)
})
})
})
})```
sorry for wall of code
;-;
It does all the "loading" js Loading /event/message.js Loading /event/ready.js but then it doesn't fire the ready event
can you show ready.js
instead of js console.log(`Loading /${src}/${file}`); try doing ```js
console.log(eventNames)
like this? js let eventName = file.split(".")[0]; console.log(eventName) Client.on(eventName, event.bind(null, Client));
um
so it reaches it
i think
try removing the if(!file.endsWith('.js')) return;
i dont think that'd change anything but
¯_(ツ)_/¯
nope
:/
Ill just remove all commands
and events
and slowly add them back
see how that works
- vds in music cutting Is there a solution?
what
vds host my bot > music cutting interrupted
thats why its ytdl 😂
-_-
use lavalink or ffmpeg or something
they have steadier audio
ffmpeg is not ytdl btw
stabil?
yes
thanks
@sudden geyser> Is your bot just going offline, or is your app exiting?
Bot it just going off
Just shut off again and is back on
My vps doesn't say of anything shutting down or restarting
And it's off again
Do people think it's just the discord api I'm literally getting no errors or anything ?
uh what does this mean
429 hit on route /gateway/bot
it says ratelimit
but I just booted
for the first time
in days
lol
[WS => Manager] Manager was destroyed. Called by:
Error: MANAGER_DESTROYED
at WebSocketManager.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\websocket\WebSocketManager.js:335:54)
at Client.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:235:13)
at Client.login (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:224:12)```
im so confused
how can i check if a message sent is a gif
The url extension will be .gif. Same for checking for other types of files
Why do this not work? (JAVA), gets no Error just nothing is happening Tag me if you know why
@earnest phoenix If the url ends with .gif it's a gif. Otherwise you can send an http get request and check that the response mime type is image/gif
I need a new vps anyone know any good companies
Dont even bother saying glitch as a troll hahaha
I use galaxygate
same
Uptime fine
My bot kept going off
I'm self hosting now and it's not gone off once
ive heard good things about them too
and if u were in beta u get a percent off
I need something reliable
but i would still use galaxygate
Thanks guys appreciate it I'll check them out
how much ram do skysilk plans offer? they dont say lol
You think 4gb ram is enough
My current has 512mb which is doo doo
I dont mind investing the money :)
for a non-modified discord.js, 4gb will be enough for about 10k-20k servers
depending on what your bot does
ive had my bot on the 3 dollar tier up to 2000 guilds or so
It's a bump bot
mine is still on the $3 one, at 3000, but mine is modified
yea
that gets their default
in discord.js v12, all avatarURL properties are now functions
so you need to add ()
and you can use the function options to specify the format and size of the image
user.displayAvatarURL()
Out of stock apparently
ye galaxygate got discord famous because some big bot was hosted there
in discord.js v12, all avatarURL properties are now functions
oh weird, them are still into properties in the doc
All servers are out of stock
wasnt some of their ips banned though?
discord got a ton of spam from galaxygate I thought
@opaque seal https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=avatarURL
thanks, I was on the wrong one --> defaultAvatarURL
Been using it ever since their beta, no problem with their services
@slender thistle skysilk?
Yup
100% uptime or?
Hmm... maybe 98-99% of the time
Some maintenance here and there sometimes but usually that doesn't last long
I've been using resellers
That have "discord hosting service"
Not an actual vps
Anyone knows why this is not working? Tag me if you knows (JAVA)
I have a small OVH VPS that runs my bots pretty well
$2/mo isn't bad; but 10gb ssd feels tiny
depending on what your bot does, it doesnt even need 1gb
true lmao
npm packages alone can take a gig away lmao
@slender thistle how much ram does skysilk offer? their website doesnt say anything?
@quartz kindle http://i.michaelwflaherty.com/u/59XnBSpIe3.png
Hey tim, have you ever seen this error before? js [WS => Manager] Manager was destroyed. Called by: Error: MANAGER_DESTROYED at WebSocketManager.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\websocket\WebSocketManager.js:335:54) at Client.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:235:13) at Client.login (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:224:12) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:11096) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (C:\Users\jnsho\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26) at Client.login (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:221:21)
oh
did you call manager.destroy()? lmao
then what was it?
(node:11096) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
probably
ah yes
For free I can use my dedicated server 
heh; on your home network?
I'd rather keep my things not on my home network
Yeah static
a bot running on a home machine shouldnt cause your network to be susceptible to ddos attacks
assuming the bot is the only thing you're running and your ip isn't exposed elsewhere
have a separate machine running the bot
for bots ddos attacks aren't the worry, but internet/electric outages are a good enough reason
eh
UPS
keep you enough uptime probably for power to resume
unless you live in an area where outages are very frequent
my bot is running on my old pc build because I have absolutely no other use for it. well that and plex
well lavalink, best quality ; ytdl, fastest; andesite, never heard of
im conflicted now
im all abot quality/quantity
you can have high quality anywhere lol?
lavalink is bloated and java which means a memory hog
but it's an easy to use and easy to setup piece of software
btw could you (IF6) send me eg. github link of andesite, cause google doesnt seems to find it...
Hmm... maybe 98-99% of the time
@slender thistle does it come with mysql databases?
andesite is archived
oh fr
which means you get no support for it if you use it
so that made the choice 2x easier
no wonder the discord server no longer exists
with ytdl, if you want to accomplish the level of extensibility lavalink has, you need to be good good at whatever language you're working with
you need to learn concepts like real time buffering, rewinding streams etc
What is lavalink
@earnest phoenix If the url ends with .gif it's a gif. Otherwise you can send an http get request and check that the response mime type is
image/gif
@white gyro how to?
@earnest phoenix music plugin for discord.js
What is lavalink
@earnest phoenix just google
@earnest phoenix music plugin for discord.js
@earnest phoenix no, for any discord bots
?
oh
yea
how i edit the color of the role?(11v)
did you know why my bot is not working (the error is: invalid token (401 not authorized) but the token is good
how i edit the color of the role?(11v)
@earnest phoenix role.color
how i use role.color?
did you know why my bot is not working (the error is: invalid token (401 not authorized) but the token is good
@earnest phoenix regenerate token
let role = message.guild.roles.filter(x => x.name === 'Muted').sort((a, b) => a.position - b.position).first();
role.setColor('#FF0000')
¿?
yes
.size on Maps, .length on Arrays, but ^^
@restive furnace I have regenerate the token but the token are invalid 😦
then you're using the wrong token
Anyone use Java?
make sure it's actually the token and not the secret
is not the secret @earnest phoenix
are you reading the token from a file or something
token of my bot (discord dev portal)
what
how do you use the token in your code?
show the code that uses it
(without the token)
No one uses Java? 😦
@vestal sequoia https://dontasktoask.com
How can I check if a member == bot?
did you save the file after you copied the token from the dev portal?
@earnest phoenix is that the same token that shows in the dev portal?
I can't type today ffs
yes @copper cradle and @quartz kindle is save the file and i save with npm i --save discord.js
i mean save the file that is open in your code editor
??
ctrl+S
that's not what we mean by save tho
@quartz kindle i have save the file with ctrl + S
and still the same error? try running it again
I am trying to post a message on member bans using audit logs but something it doesnt post so I want it to search for more logs as bots do so many things
const fetchedLogs = await guild.fetchAuditLogs({
limit: 20,
type: 'MEMBER_BAN_ADD',
});
Will this work then?
@earnest phoenix is the token you have in your client.login() the same as you have in your developer portal?
just answer, yes or no
yes my token is good @copper cradle yes
what error are you getting
what's your native language?
if it's spanish I can help you in spanish
no french i use node , discord.js , my error is: (node:16704) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (C:\Users\KingCow\Desktop\bot spam\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26) at Client.login (C:\Users\KingCow\Desktop\bot spam\node_modules\discord.js\src\client\Client.js:221:21) (node:16704) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:16704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[TOKEN_INVALID]: An invalid token was provided.
^ read my friend
you're passing in an invalid token
go to the dev portal
copy the token
and paste it in your client.login()
May be your are using an invalid token some where else
yes @heavy marsh but is the good token
I'm going to guess you copied the client id or something
Are you using the client token, or the bot token?
bot token
May be your token has been regenerated
Did you click on the "Bot" tab and press "Copy Token"
how do i pass only one var to a function like f(a = 1, b = 2, c = 3) ??? something like f(b = 12)
then replace your old token with that token
I just regenerated the token i have past and stick it and always the same error
what lang zerp
node js, sorry
@earnest phoenix if you want, you can DM me your token, i can test it
#development message - Will this work?
@earnest phoenix do not do that
@earnest phoenix you just pass in the thing
do not message him your token
@late plank i've tested other people's tokens before here, people know me
he isn't a bad person
but how does it know if i want to pass a value into b and not a?
I still wouldn't
lol
nope
function params in js have to be passed in in the order you want them
for example
ok but my bot is on some server lol but no problem if you can save my prob
'send me your token, i wont do anything suspisicous with it ~ i promise, people in this internet chat room anyone can join know me!' 😄
classic
^^^^^^^^^
lmao
neither does she
Tim's trustworthy 
there's no work around? if i only want to pass one value and let the rest of them go to default???
you are right for being suspicious, but my reputation speaks for itself
if you dont trust, dont send
@earnest phoenix no
that's why optional values must be at the end
so that people can pass the required values first
is a certified
I will give him my confidence anyway the bot is down for the moment
or you can pass in an object
Lol
lool
and destructure it inside of the function
i need to go out more :(
nah, dont do it, the corona's out there!
does lavalink require shards?
something like
function a ({a, b}) {
return b;
}
a({a: 1});
👀 anyone #development message
lavalink isn't what people think it is
anyone got a better way to get a time based on players timezone?
(my players can set their timezone)
just use new Date() and then use the toLocaleTimeString() method or the toLocaleDateString()
but the problem is
it'
that's what I was gonna say lol
hmm
cant you pass in a epoch to date?
lemme check real quick
that strange moment code above is the only way i got it to work lol
material theme vs code?
Community Material Theme Darker High Contrast
🙂
all the other ways i tried wouldnt take DST into account and kept giving me time an hour off :/
whats synthwave for?
no we don't
omfg no
that theme needs to die asap
turn down your brightness
lmao
do it do it
install powermode
do i need to supply sounds or does it have a default bank?
idk if it has sounds, never used it because i use sublimetext
but it works best on Atom
all other code editors had trouble porting it lmao
oh, the only vs code thing is 'power mode sounds', which makes a sound each time you hit a key
lol
dekita enable the glow and your code can look like this https://raw.githubusercontent.com/robb0wen/synthwave-vscode/master/theme.jpg
oo glow is sexy
XD
tbh i kinda want to switch to Atom just because of powermode
then put on synthwave music
lol
yeah, Atom has more interface hooks

gives more control to extensions and addons
since were on the topic of things like this
thats way too vivid to be using regularly lol
@tardy estuary i wouldnt understand my code at all if i used that lmao
fonts should be designed with those unicode symbols in the future
excellent, just what i always wanted
haha yeah just disable it and it goes away
vscode does some integrity checks and I think it messes with a file. but disabling the glow takes it back to normal
lol, already completely uninstalled synthwave 😄
boooooo
anyone know how i could loop through this document and change all string "true" and "false"'s to boolean true and falses
using js
you asking me?
{
_id: 5e7af68a263b0f0004b491dc,
Type: 'Modules',
partys: 'True',
Bans: 'True',
Mutes: 'True',
Music: 'True',
XP: 'True',
Ai: 'false',
Msglogs: 'True',
Guilds: 'True',
Announce: 'True',
DevTracker: 'false',
Welcome: 'True',
GuildId: '584582283730747403',
ShadowandSummer: 'false',
Eclipse: 'false',
LevelMsgs: 'True',
__v: 0,
CleanerMusicMessages: true
}
Object.keys(theobjecthere).forEach(key => {
const value = theobjecthere[key];
if (['True', 'False'].indexOf(value)>=0){
theobjecthere[key] = Boolean(value);
}
});
regexp could probly do it too, always many ways to do a thing
yea, js objects are key value pairs
well I mean
just, the value is commonly another object
ok thanks ❤️
question, why are you storing them as strings anyway?
i can see some have camel case as well, which is inconsistent
probably best to do value.toLowerCase() when converting into boolean, idk how it would respond with camel case, probly fine, but idk
ahh yea, it works fine with camel case, no need for the toLowerCase() 🙂
it doesn't care about it
lol yea just checked in browser console 😄
it was a dumb thing that i done a while ago lmao
you cant use Boolean for that
also, it seems your using mondodb/mongoose? @earnest phoenix
because its a non-empty string, which is truthy
anything other than undefined, 0 would be true in js
truthy and falsy
yeah
fml learn something every day 😄
just replace them I mean

loop through them
or use a regexp
but that'd take extra work
bc you'd have to turn the obj into a string and then back into an obj
unless the obj is in another file
which I don't think so
/false|true/i.test("tRuE")
some regexp to check if its true then 😄
tbf, that also returns true if its 'false'
but can easily be altered
oohh, fancy
a quick .toLowerCase() will fix that
yeah
but its probably way more expensive than to simply do value.toLowerCase() === "true" ? true : false
theobjecthere[key] = /true/i.test(value);
// OR
theobjecthere[key] = JSON.parse(value.toLowerCase());
yeah
a quick ternary will do the job
but I don't think most people here care about performance tbf
how can i loop through every element in the doc and change the value then
bc ```js
Object.keys(Doc).forEach(key => {
const value = Doc[key];
if (['True', 'False'].indexOf(value)){
Doc[key] = Boolean(value);
}
});
That doesnt work lul
._:|
why dont you have mongoose using booleans by default?
dont even ask about it lmao
no, cause i edited after that to have >=0 in the if statement after indexOf
Object.keys(theobjecthere).forEach(key => {
const value = theobjecthere[key];
if (['True', 'False'].indexOf(value)>=0){
theobjecthere[key] = /true/i.test(value);
// OR
theobjecthere[key] = JSON.parse(value.toLowerCase());
}
});
Object.keys(theobjecthere).forEach(key => {
const value = theobjecthere[key];
theobjecthere[key] = value.toLowerCase() === 'true';
});
^ as suggested above for performance reasons
indexOf returns the position in the string, -1 if not found or 0+ if found (for example 5 if the result starts in the 6th character in the string)
so you need to check if the result of indexOf is not -1
^
Can I access the shard id from the inside the shard itself?
I want to only process some code on one instance
All shard objects should have a id prop
not on v12
wait
how do you even get the shard
because client.shard returns a shardclientutil
ah I see okay.
I'm new to bot development, I normally do applications and data analysis, so the discord design elements are new to me.
I'm wondering what I should research when it comes to the fancier boxes and such that display in response.
How does that work?
^ an embed
Yes those
Oh i see
the embeds have a specific format for how it shows the data, but creating them is fairly easy
I write mostly in python is it possible to do in python or do I need to switch to javascript?
^ discord.js guide for embeds
There's discord.py
I've been developing using it for a few days now
I have three bots running right now, but I didn't know what to search to figure out what I now know is called an embed
@humble vessel what kind of question is that
you just need a library to interact with the discord api
and that's it
it's up to the library to implement such thing tho
That was the question.
Does the .py library implement embeds
or would I need to switch to javascript
yes
I now know that thank you.
see the link above @humble vessel
you don't need to switch to another lang if a lib doesn't have something
you can implement it yourself
bruh
lower level implementation in python is awful. Cite tkinter. I was only writing these bots in python because it's quick.
If it didnt work in python, I was going to switch to JS because JS has an implementation.
you can send a raw object to the api and that's be an embed
ofc you need to know the keys they use
js doesn't
discord.js has one
discord.js is a library
the use of discord.js is implied.
nice
no
😄
Python can do anything... very slowly...
golang is way faster than python
languages are just tools
I actually havent looked much into golang
well
wonder if there is discord c lib, there must be right?
probably is if you scroll around github
yeah
Python is mostly used as a language for working with data
I'll check
Pretty much
meh
I personally use Python for working with my calculations because it's convenient 
Python machine learning can struggle a bit
try js ml...
I use python for my math class lmao
Same
a lot of numpy is precompiled C so its fast, but then look at matplotlib and its awful
i used brain.js to build a neural network that predicts where the ball will end up - for the ai in a dumb pong game i made a few years back
matplotlib is quite slow, I've noticed that 
I like how python has these pyc files
so a lot of the neural networks work well in python, but data output via matplotlib is awful
Took maybe 4-5 seconds to run a script that created about 8 subplots with 2 points in each
also python doesn't use programmer implemented pointers which makes things easier to implement in python because theres a standard behavior and not much pointer math.
Oh yeah now try saving them
@ imagemagick

lol ye
yeah
Who's the best point of contact for that
it's known
so there's no fix we can do
17000ms is not "a little slow"
that's more indicative of something being on fire back there lol
tbh its been slow for the past week or two
probably getting ddos'd by some bored nub kids
they definitely have ddos protection...
now...
considering they have cloudflare
up until a week or so ago i had never seen their ddos protection when loading the page
yeah
which suggests to me its a new addition
which suggests they have been under attack and needed the protection
sO yOu WeRe DdOsInG tHeM hUh
the thing you get from cloudflare is toggleable
The DDoS Production message has been here for a while (toggleable/not always here).
@digital ibex how did you get that value?
through a channel resolver
message.channel.guild.channels.find((e) => e.name === args[1]);
yeah, i done that but it still shows as [text channel...
oh, i forgot to refresh on mongo compass mb
lmao
dunno how I would use lavalink on heroku
bad though
don't use it for production
it's for testing
it'll sleep
don't 👏 use 👏 heroku
^
or glitch for discord bots
heroku can't even handle running a lavalink server and a bot concurrently
lol
if someone dies from childbirth can you press charges on the baby
neither can glitch
heroku is ok for websites that dont get much traffic, but thats about it imo
wrong way?
wtf discord
i press a space to find the up emoji and it instead acts as if i pressed enter?
what's a good way to return both hm and msg?
function parseTime(string){
let msg = ""
let hm = string.slice(0,5).split(':');
msg += string.slice(6)
console.log("formated time:", hm, "optional message:", msg)
}
you forgot the ending ```
return an object
yeah
if js was like go where you can return multiple values 😔
I'd love being able to do that
instead of using gay ass callbacks
if only js had tuples
it makes sense it doesn't though
it isn't typed
there's a prob a module for it
FUBUKI WE LOVE U!!!!!!!!!!!!!!!!!!!!!!!
Last night, saw her upload 15min after she did, immediately got to work without hesitation. I worked from 12am to 5am, exhausted but well worth it. Took more than 1h to render, so I couldn't upload it right after it's done. Hopefully th...
you're in the wrong channel
its important yall watch this
wrong channel tho
@earnest phoenix #memes-and-media
uber you're still in #development my man
nah this is development related i think
lol
now uber gets uncert
yes you two years ago
yea my keyboard was just fucking up
yo
@pale peak https://dontasktoask.com
help me please
ERROR: (node:124) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined
args[1] is undefined
//end of create role
let behle = args[1]
.replace(`sn`, `s`)
.replace(`dk`, `m`)
.replace(`sa`, `h`)
.replace(`g`, `d`)
if(!behle) return message.reply(`:warning: Lütfen bir zaman giriniz! \n**Doğru Kullanım;** \`!!pretestyap sn/dk/sa/g\``)
duh
your trying to replace a string, args[1], which hasnt been given.
console.log(args) to see what it actually contains
okay
I bet they think args[1] is the first element
i trying now
dude this isn't lua
heh
const db = require('quick.db')
//const ms = require('parse-ms')
const ms = require("ms");
const Discord = require('discord.js')
exports.run = async (client, message, args) => {
//let behle = await db.fetch(`presuresi_${message.guild.id}`) // 24 SAAT: 8.64e+7 / gibi.
//let behle =
// 900000000 9 saat
let user = message.author
let sure = await db.fetch(`prezaman12_${message.guild.id}`)
//end of create role
let behle = args[0]
.replace(`sn`, `s`)
.replace(`dk`, `m`)
.replace(`sa`, `h`)
.replace(`g`, `d`)
if(args[0]) return message.reply(`:warning: Lütfen bir zaman giriniz! \n**Doğru Kullanım;** \`!!pretestyap sn/dk/sa/g\``)
console.log(args)
//if (sure !== null && behle - (Date.now() - sure) > 0) {
let timeObj = ms(behle - (Date.now() - sure))
message.channel.send(`> Tebrikler Premium kazandın! \n > Şuan da **${timeObj.hours} saat ${timeObj.minutes} dakika** premiumun var!`)
db.set(`presuresi1_${message.guild.id}`, behle);
db.set(`prezaman12_${message.guild.id}`, Date.now());
// }
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};
exports.help = {
name: 'pretestyap',
description: "Sunucuya eklenen botu onaylar.",
usage: 'botonayla <bot ismi>'
};```
its my command.
I am trying to make a timed premium.
like i said, check your args
dude
console.log(args) before the line where the error happens
ffs
or else that code will never get executed
hmm
here
args is empty
I don't speak that language so I don't know if it worked or it didn't
wait i translate this command
const db = require('quick.db')
//const ms = require('parse-ms')
const ms = require("ms");
const Discord = require('discord.js')
exports.run = async (client, message, args) => {
let user = message.author
let time = await db.fetch(`pretimenow_${message.guild.id}`)
console.log(args)
let wait = args[0]
.replace(`sn`, `s`) // turkish time / sn / dk / sa / g . bla bla.
.replace(`dk`, `m`)
.replace(`sa`, `h`)
.replace(`g`, `d`)
if(!wait) return message.reply(`:warning: Please write time!\n**Its true;** \`!!pre-make-this-user sn/dk/sa/g\``)
//if (sure !== null && behle - (Date.now() - sure) > 0) {
let timeObj = ms(wait - (Date.now() - time))
message.channel.send(`> You wounded premium! \n > Your premium time: **${timeObj.hours} hour ${timeObj.minutes} minitues**!`)
db.set(`pretime_${message.guild.id}`, wait);
db.set(`prenowtime_${message.guild.id}`, Date.now());
// }
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};
exports.help = {
name: 'pre-make-this-user',
description: "Blabla.",
usage: 'pre-make-this-user'
};```
i translated.
@copper cradle
i really dislike that framework, idk which one it is, but it has the
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};
exports.help = {
name: 'pre-make-this-user',
description: "Blabla.",
usage: 'pre-make-this-user'
};```
^ cant be dealing with that
lol
😄
@neat ingot It's called the youtube tutorial framework
ha
i how fix now
what are you trying to do pudo?
ahhh, so a user can become a premium member, this command does what though? tell you how long you have left premium?
This command sets the time in the (wait) field. I'll do it as a code, but I have to fix this.
this
yea, if an argument hasnt been provided that will throw an error
why double !
😉
My new error now.
Why used two "!"?

