#development
1 messages Β· Page 1541 of 1
which you can get with adding a \ before a emoji
for example ->
would be !nao_happy
Adding the  for example would add that emoji to the message then (if your bot is in that server with the emoji of course)
ok tq
any suggestions for a Backup if systemchannel is not aviable? want to send a message in there if someone invites the bot, but im not sure what would be a good backup.
well want to have the dude who invited the bot to run a setup command to make sure it will work and not shit itself

alternative i will just make the bot cry around on command if its not setup
@rustic nova srry for
but is this it? :cookieeat:
nope
it should be <:emoji_name:id>
again, easily being able to get it by using \ before emojis
also, you need to send the \emoji to be able to see the full emoji mention
ohh

Hello, if my bot cannot find the command when prefix + command_name is typed, if I write a code to say command not found, will there be a problem?
Please tag when you reply.
it can cause a ton of spam
people 60% the time write commands wrong or with one letter off
so...well...a lot of spam if they keep trying
CommandNotFound eh's...are a 50/50
i understand if i add it to my bot will it be banned from top.gg?
Thanks, I will not add. π
so um, js client.on('guildMemberRemove', member => { const currentGuild = member.guild.id }) when the member leaves the server, it cant seem to track what server it left
? wdym
log the member
yeah, but what i want it to do is get the guild id that the user left
log the member and see what properties it has
ok
I feel like that's not needed
do u need to log join/leaves in a channel ?
??
yes
it is?
i can help
thats literally part of debugging??
but it's a public bot, so i need to check so it doesn't log a user from another server
i use quick.db
ok so log member and show me the output
ew quick.db
@earnest phoenix quick.db is a wrapper for sql
for
client.on('guildMemberAdd', member => {
const currentGuild = member.guild.id
})``` getting the id works
i dont use quick db
but not for js client.on('guildMemberRemove', member => { const currentGuild = member.guild.id })

flazepe help
- Ping
thanks
Alll i need is to get the guild's id that the user left from

You need the guild members intent
log it
log the member
yeah but how?
...
Same way you log anything
Use console.log()
how did you get bot dev without knowing how to log something
client.logger.info(`${member.guild.name}: ${member.user.tag} has joined the server`);```

client.on('guildMemberRemove', member => {
})```
Not guildmemberadd
@pale vessel can you help me make an audit log class
replace lol
i need help with guildmemberremove
I Don't Know
I know, but doesn't seem to help at all
bro is this guy for real


π§
i just need help structuring it, there's way more variables to account for
and i'm lazy
for gods sake
I don't know how audit logs work
No u
Never dealt with them
there are docs flazepe
learn how they work then
π
twat

oh ok fair enough
i'm reading the docs
look at this shit https://discord.com/developers/docs/resources/audit-log
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
What about it
so i did it, now what?
Check your console after that event is triggered?
yeah i did
Nothing?
see if theres a guild property?
is there an id property
i don't think so
show full guild
o wait yeah
thats the guild id
try logging member.guild.id
Well, do whatever you want with it?
yeah but
i use quick.db
then i use this
const currentGuild = member.guild.id```
i use quick.db to check if a guild's leave message is enabled or not
But it says that it's disabled
even tho that i enabled the guild leave message
nvm ur bad
@pale vessel
Unhandled rejection error! TypeError: Object prototype may only be an Object or null: true Anyone know what this means? Some of my commands aren't working because of this error!
@misty sigil read this and you'll understand why this is hard to structure https://discord.com/developers/docs/resources/audit-log#audit-log-change-object
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
wtf are you doing to object prototypes
I don't even know what it is lol.
I googled it but nothing related came up. I checked Discord.js docs.
can you provide the line that errored
@trim saddle Wth it came from this line let BotMessage = await msg.reply("Pinging!");. Should I show the full error?
yes
"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: 2)"
"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."
The rest is a bunch of ats.
. that's the standard text for any unhandled rejection.
post on like hastebin/pastebin/mystbin
You know what imma find an alternative way.
let BotMessage = await msg.reply("Pinging!");
BotMessage.edit({
embed: {
title: "Pong!",
description: [
"**Responce time: **: `" +
(BotMessage.createdAt - msg.createdAt) +
"ms`"
].join("\n"),
color: "#0099ff",
timestamp: new Date()
}
}).catch(() =>
BotMessage.edit(
"Unknown error occurred. Do I have permision to Embed Links?"
)
);
``` This is the full code.
need help with regex
how can i regex string that contain any number from 1 to 10
not 0
i've tried [1-10] and its just get 1 and 10
hm
[1-9]|10
\d{1,10}
Anyone know what's going on?
out of Ram
@ebon belfry your project died from using all the ram
O_O
optimize it to prevent it
Dang
PC or Server?
How do I optimize it?
what lib did you use and what did you bot do?
disabling loading all members and or presences can save a huge amount of ram.
there's your problem, you don't get a lot of ram from repl
make your code less stressful on resources, usually sticking to async functions, don't cache everything, try to avoid unused variables
buy a VPS
Downl-
get off repl and get a vps
replit has a $5 a month plan that gives you 2gb of ram
Oh
its not the best, but easy way to solve it if you dont want to bother with VPS's
Well, everyone is upset and it's a real problem to me because my bot is in over 800 servers
did you use normal D.js?
I use the discord.js package
yeah you probably shouldn't use repl when your bot grows extensively
https://www.npmjs.com/package/discord.js-light look into this
https://galaxygate.net/hosting/vps/ you could look at gg's hosting
GalaxyGate Hosting
you will save some ram, but some stuff will be a bit more annoying
4GB for $10/mo
Thanks for the help :)
you should only get what you need.
$3 a month for a gig, which is double what you have now
lol i pay 56β¬/Month for 64GB ram and 6C / 12T
and you can upgrade gg vps's easy
you got a fat bot 8?
The issue is that there is no point of getting a VPS if I earn no money from my bot.
no, but one that uses ML and this fryed my old 10β¬ Digital ocean VPS
then djs light is probably the route you want to go.
using it properly will dramatically decrease ram usage.
a ton of people don't get any kind of revenue from their bot
sometimes investing in a vps with your money will give you the ability to give users features that may or may not pay for
you never know until you try
Ok! I never even knew that existed 
most small to medium sized bots lose money.
if you want to generate income from bots, the bot has to be extremely Unique and reliable. if the bot gets popular you get maybe some income but also competition of other guys trying to copy your bot
Yea, another thing is that I don't really have any costed features
i legit run a bot in almost 60k guilds and haven't gotten a cent from users
Ok, thanks! I will look into discord.js-light
O_O
Dang
got me from 300MB ram down to 95MB ram with about 100 Guilds back then
mainly because i didn't paywall anything people just don't like tipping i guess
technically, made some money on my bot from galaxygate affiliates.
got a few signups off my bot linking it.
i dont like adding paywalls, i think about adding softlocks or something like this
like shorter cooldowns if you pay or something in this way
but i vote/boost locked instead
if you pay you get 2x the Votes
probably against the rules but i bet someone does it
thing is i locked up singular commands
i have a hard time to think about stuff that i could lock behind a paywall or get some fair way to monetize the bot a bit
Trash in what terms?
well repl does encourage bot hosting
but they prefer webapps
plus since you're not paying for it, it's not gonna tailor to your needs
Discord Bots eat way more resources than a Website (unless your Blog as example blows up)
it's not trash you're just misusing the service π€·ββοΈ
it's like cooking a chicken in the microwave and then complaining it didn't come out right
i think there was an option for that on the browser thing
set the frame to false in BrowerWindow options
you sure? π€ my heavily optimized low-level bot uses only ~5mb
well the thing is 90% of the Users that Host Bots on Repl.it either use JS or py and they eat ram like Chrome does bcs of poor optimisation
the rest are competent people
true true, but if they were interested to not eat so much resources, they might even beat me
i mean i dont want the frame
but i want the like controls
like close, miniize etc
so frame false doesnt work
set the -webkit-app-region: drag in the css of the top bar
lemme try! ty
Well what problems is it having
Cannot read staff properly @sudden geyser
command is undefined probably
making white lightning eh?
Traceback (most recent call last):
File "c:/Users/jusmi/Desktop/MoBot/bot.py", line 293, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
File "C:\Users\jusmi\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 663, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\jusmi\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.fun' raised an error: FileNotFoundError: JSON file wasn't found
i have the json file
Can anyone give a link for a list of fonts for canvas
there isnt one
canvas uses your system fonts right? or any you add yourself
yup
can anyone help me with electron packager?
like do i need to prefix it with npm?
like i dont get it
how did you open the json file?
i fixed the issue
thanks
it was in a different directory
hey guys
how would i create a function with levels?
Like level 1 = the bot only sends emojis
level 2 = only gifs etc
would that need cases?
huh?
i want to have different bot events that i can select
so if my command for example is !case1
check with roles @eternal osprey
it only performs the code withing case1
and if i do !case2
it only runs case2 and stops case1
what?
@eternal osprey if someone have that specific role he can send emojis for example
that is not my question
at all.
const ErrorEmbed = new Discord.MessageEmbed()
.setTitle("Error!")
.setDescription(`Error shouting. Here's the error: ${err}`)
.setFooter("Shout Command Failed", process.env.bot_logo)
.setColor("#0099ff");
msg.reply(ErrorEmbed)
```Is their anything wrong with this? I don't understand this error at all!! `UnhandledPromiseRejectionWarning: TypeError: Object prototype may only be an Object or null: true`
then what was your question ? @eternal osprey
msg.reply()
i literally wrote it above
i want to switch through cases and events within those cases
so you when you run case 1 for example the bot allow only emojis ?
is that what you meant ?
for example, yes.
so if i use !case1 it will run the code within the case1
and if i use !case2 it runs only the code within case2
and stops case1
you need database then
why
case1: disabled
case2: disabled
if you run case 1 the bot will change case1: enabled then go and check on_message
exactly what i need!
i can explain more if u want

you may use activate and deactivate commands @eternal osprey
I know, question is how.
which language you coding with ?
javascript
i do python but i will explain it
could you offer me some of those hot brains
for example :
?activate case 1
you need to have case 1 in data base so u can change the case 1 from disabled to enabled
node js I need to tell if 2 screenshots are the same, the issue is that it runs on an event and sometimes it gets called very quickly and doesn't have time to cache the buffer. how can I force one function to end before another starts, or an equivalent solution
@quartz kindle big brain answer from you?
promises
how can i compile electron into an exe?
I don't think I can await a fs.watch()
ive been trying for like 3 hours
download the electron sdk, it already has an exe
like my electron program
big brain tim π
fs.watch('poggers path', {}, (e, s) => {
if (s === 'screenshot.png' && fs.existsSync(file)) handleFile()
})```
any way for me to force handleFile to finish before the next event happens?
I don't think so
thats not what he ask for @crimson vapor
huh
did you know what was the question of awsome ?
no I don't know what they were asking
before the next event happens no, but you can make the next event queue itself while waiting for it to finish
what does handleFile() do?
show code
// Function to watch the file
function handleFile () {
// Check if it exists
const exist = fs.existsSync(file)
if (!exist) { return customError('The handleFile function was called, but no file exists') }
// Check if we already did it
// IK this is inefficient but idk how else to do this
const check = fs.readFileSync(file).buffer
// If its the last file, just return
if (check === lastFile) return
else lastFile = check
// Get the settings
const { save } = settings.get('config')
// Save the file
switch (save) {
case 'clipboard': return saveClipboard()
case 'imgur': return saveImgur()
case 'local': return saveLocal()
case 'custom': return saveCustom()
case 'PyroCDN': return savePyroCDN()
default: return customError(`Save method ${save} is not accepted.`)
}
}```
tim
the electron sdk already comes with an exe
you just add your code and then run the exe
@crimson vapor lol awsome thought you gonna help him
wdym
@eternal osprey you still here ?
nah ive got my own code to figure out
π
use electron-builder
Tim how would I make it queue
switch/case should never be used in JS
why not 
it creates too many bug
how are there bugs
is anybody here do python ?
switch/case isn't buggy, it's your code that's your buggy
no it doesnt
im just asking @drifting wedge π
Tim do you know how I would do what you said?
need to see what the code does to be able to find how to queue it
explain the code to him
Switch statements can introduce fall-through hazards
he meant what the command do @crimson vapor
then always break
i dont see anything in there that needs queuing, what is the problem you're having right now?
sometimes the fs.watchFile is calling two times because of the way mac takes screenshots
ill post the shortest one
sec
function saveLocal () {
// Create a file name and path
const filename = createFileName(new Date())
const filePath = `${app.getPath('documents')}/screenshots/` + filename
// Make the path if it doesn't exist
if (!fs.existsSync(`${app.getPath('documents')}/screenshots`)) {
fs.mkdirSync(`${app.getPath('documents')}/screenshots`)
}
try {
// Rename the file
fs.renameSync(file, filePath)
} catch (err) {
// If it errors, notify the user
return customError(err.toString())
}
notifSaved()
}```
oo, uploading to all the image hosters
@quartz kindle you seems Mr.brilliant in this server π
all the sync functions are blocking so they wont let any other part of your code run until they are finished, so im still not seeing anything that would cause issues
tims the one you go to when no one knows. :p
hmm
what does notifsaved do?
hey how would i switch between 2 cases? Like if someone uses !case1 it performs the whole code within the case, but if someone types !case2, it only performs the code within case2 and stops case1 from running
creates a new electron Notification and sends it
const notifUpload = () => new Notification({ title: 'Screenshot Uploaded', body: 'Screenshot link has been copied to your clipboard' }).show()```
var price;
switch (fruit) {
case 'orange':
price = 2.99;
break;
case 'apple':
price = 1.24;
break;
case 'cherry':
price = 3.55;
break;
default:
price = 1.11;
}
return 'My fruit costs ' + price;
}```
vs
```function getPrice(fruit) {
var fruits = {
orange: 2.99,
apple: 1.24,
cherry: 3.55,
default: 1.11
};
return 'My fruit costs' + (fruits[fruit] || items['default']);
}```
i already told you
i did not get anything what you said
its inefficient to map functions like values can be
no its not?
maps are super fast
you basically only told me to make an activate/disable command. I can't do anything with it
not code
like
writing it
more chars and imo harder to read
ig less efficient isnt a good phrase to use
with that you can check what u gonna do
yeah but that info is not helping me tbh.
i still have no clue how to begin.
do you know how to work with databases ?
yeah
function idk(type) {
({
"a": a(),
"b": b(),
"c": c(),
"d": d(),
}[type] || default) ();
}```
ewww
i dont think he wants a toggle feature, looks like he wants to check which command is run?
not really
then you should know what i was talking about @eternal osprey
a toggle function is what i need.
so basically, !case1 writes enabled to case1 in the database. Then checking with an if statement? So if(case1 == enabled){bla bla bla}
yeh
okay got it
but if u want to enable only one case ,in your command you should change the statements of the other cases from enabled to disabled
yeah
imo use disabled as an array
if(disabled.has(cmd.name)) return;```
is there a reason you dont just have one command?
!setWhatever enabled or !setWhatever disabled
that is what i was about to do!
in python it would be easier tbh
its like 2 lines in js
idk how js work π
js is literally english
if(arg === "enabled"); //setdb variable to true
else //setdb variable to false
i actually have learned c++ for a bit. But damn it was way too hard imo.
aha okay thanks!
if you want to get fancy you can also have another check for if no arg was provided and just invert the status.
nothinf is hard when u learn it
messing with memory is fun
nothing is hard when you make it easy! ;p
until you start breaking and corrupting it π₯°
yes, int x = ((int*)((char*)((int*)(void*)0)));
i cant count how many times i broke my code with dangling pointers
that's gonna try to read from 0x0 in ur RAM and segfault
also to fix dangling pointers (mostly), use std::unique/shared/weak_ptr
can anyone help me make my electron project into an exe?
One message removed from a suspended account.
One message removed from a suspended account.
ye but i cant get it to work
One message removed from a suspended account.
i cant get it to work
how come
One message removed from a suspended account.
there should be a boilerplate on their website
One message removed from a suspended account.
ik but i cant get it to work at all
gimme a min
i removed it
lemme install it
npm i electron-builder?
One message removed from a suspended account.

well it's been boring, we're doing online classes since like november
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i'm most likely going to fail 2 if i don't start doing assignments but i just cant get myself to do it
One message removed from a suspended account.
One message removed from a suspended account.
wdym save as dev?
@earnest phoenix
save it as a dev dependency
wot?
in the dependencies in pkg.json
i mean package*
?
this is the console command right?
npm i electron-builder
do i do it anyqhere or in direcotry?
that works
electron-builder : The term 'electron-builder' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ electron-builder -v
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (electron-builder:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException``` @earnest phoenix
this is the error
that always always always happens
try running with npx
ποΈ π ποΈ
worked
installing globally also would've worked
worked tho
i just left my headset on my spacebar and crashed vscode because of the huge column count 
Is there a way to change the python code to node.js?
rewrite it in node.js
manually
there's no converter or something... actually there probably is but I wouldn't rely on it
Um... I'm a python user and I don't know much about node.js, but I wonder what code my code works with in node.
you would have to rewrite it from scratch
Oops... okay
They are two completely different languages, different semantics, different syntax, different libraries
So if you want to convert your bot to node.js you would have to learn javascript and do it manually
npm is awesome
Uh lol
Is-is-odd? It determines if it is a package is odd?
yes
Lol
npx is the same as node
npx just runs ts natively
transpiling it beforehand will yield the same thign
yikes
not only, no
Let me send the code
i know it isnt only used for it
Having problems with this
unless you using it for very specific stuff like tarballs, npx does absolutely nothing in the bot context other that running most things in js or ts code
yes but erwin
Yo guys can someone help me lol
the goal was to execute electron-builder's CLI
which is a package
BRUH TAKE THIS TO #general
which si doable with node
dont you tell us what is dev or not
sure but you have to peek into node_modules
...
neither are you a mod not are you sure what we are talking about
@earnest phoenix you fuck off
you're a whitename with barely two entire brain cells 
ingore
its still odd to use npx for electron
Says the guy that also has a white name idiot
electron should be executable from node
cringe
can you guys shut up for a sec
you can still run electron apps from node
@earnest phoenix they don't need to move to general
electron-builder
they're talking about code stuff
Oh mb
correct
just wait to ask your question for a little while
But itβs flooding the chat so I canβt get help...
electron-BUILDER doesnt need to be run with npx
But itβs gonna be glossed
Bruh auto correct
don't you realise you're the one flooding chat with your annoying pictures of your code
^^
stop please
it doesn't
but it's easier than doing node node_modules/electron-builder/cli/cli.js
you can run electron builder with node, eys
Smh what is development for idiot?
final warning: be nice
Itβs him bruh
calling people dumb and stupid does absolutely nothing
the way you run electron doesnt need to be sued with npx, npx simply executes the file its meant to
Can anyone help?
you could use node directly to run electron on
yes but this isn't running electron
His normal routine
jank code go brrrr
Development is for help/discussions regarding coding. Spamming the same question isn't considered "discussion" per se, unlike what these two are doing.
Uh guys?
like i said @earnest phoenix, if there's a discussion going on just wait to ask for a little while
No ones gonna scroll up and check after tho @scenic kelp
electron uses js as a bunch of dependencies, its only right to assume it uses js to run a bunch of its stuf
but this isn't related to running electron
that's why you wait for a little while to ask again
rather than just spamming it over and over
like i mentioned, electron CAN be run from js naitvely
okay but that's not what we're talking about
with cli, yes, but you can run it natively with node
Well ima just go to the discord.js server
the question was how to package their app into an exe (presumably distributable)
the npx dependency only makes node be able to run it
oh my god
im aware, you can do it this way simpler imo
rather than using npx, which is a node dependncy
using npx for THIS case would only mean to add an extra dependency to your code
without a proper use for ti
unless you're on an ancient version of node, npx should be prepackaged no?
then, ues
yes
which most people wouldnt
if they are using es5 or lower, then yes, im on the wrong here
if they arent using es5+ to run electron
you are able to run node directly to run electron apps
from es5 and above
the only reason i see to use npx in this case would be if they are using old node versions
quote me if im wrong, but es5 is the minimum version to run electron on natively
node can compile electron code
i still dont see how running electron with node is relevant here
its adding an extra dependency without need
it isn't
electron-builder is already their dev dependency
./node_modules/.bin/electron-builder --prepackaged <packed dir> is a much easier thing to do without bloating apps with extra depeendencies
npx electron-builder -w instead of node ./node_modules/electron-builder/whatever... -w to build for windows
it's the same thing
it's still the same amount of effort ποΈ π ποΈ
one of them wouldnt bloat the app with extra dev depes
what
i wouldnt usually bitch about this, but its the same case of installing a full app as dependecy to run a single thing
which is the case here
you're asking to install npx to run electron-builder, witch doesnt require npx
its simply an extra dependency
no
as per the image i sent twice now
erwin oh my god
i dont see anything here related to it being integrated in node
thats interesting, my bad then, npx seems to be bundled with node 8
npm specifically
i had to install it since i begun using node older than that
i'm using node 15
never had to install any extra tools
everything works smoothly out of the box
alright, my bad
does channel cache reset when the bot restarts discord.js
Channels should get cached anyway. But yes.
how long would it take for the channel to cache after the bot turns on
can anyone help me get a custom electron icon?
Depends. It shouldn't be long, maybe a few minutes.
ok thank you
the bot starts with all channels cached
yes
o
the initial guild create events include all channels
So i'm making a channel, but what do i put in permissionoverwrites?
message.guild.channels.create(`Total Members: ${message.guild.memberCount}`, { type: 'voice', permissionOverwrites: , reason: 'New channel added for fun!' });```
how do i get a custom electron icon?
electron?
it keeps saying its not working
"β’ default Electron icon is used reason=application icon is not set"
const win = new BrowserWindow({
width: 800,
height: 600,
icon: __dirname + '/chess.png',
webPreferences: {
nodeIntegration: true
},
})
win.loadFile('index.html')
}```
.csv data
yes
and then fetch something from it
well u cant with discord js ofc u can use a lib
the "name" and "type" value for the discord_id
u can use djs with it
but like djs is a module, not the lang
like u can have other modules
So i'm making a channel, but what do i put in permissionoverwrites?js message.guild.channels.create(`Total Members: ${message.guild.memberCount}`, { type: 'voice', permissionOverwrites: , reason: 'New channel added for fun!' });
thats up to you like i said
channel.updateOverwrite(channel.guild.roles.everyone, { VIEW_CHANNEL: false });
thats an example
k
thanks
i found this for csv's but
how would i only get the information of one row
so essentially
if i specified a discord_id
it would show the name and type values associated in the csv
ping if u reply kthx
So um, i tried this but when i reacted it immediatly said this
promptMsg.react('1οΈβ£').then(() => promptMsg.react('2οΈβ£'));
const filter = (reaction, user) => {
return ['1οΈβ£', '2οΈβ£'].includes(reaction.emoji.name) && user.id === message.author.id;
};
promptMsg.awaitReactions(filter, { max: 1, time: 20000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '1οΈβ£') {
message.reply('**Voice Channel** type selected. Setting up server stats...');
message.guild.channels.create(`Total Members: ${message.guild.memberCount}`, { type: 'voice', permissionOverwrites: (channel.guild.roles.everyone, { VIEW_CHANNEL: true }, { MANAGE_CHANNEL: false } , { MANAGE_PERMISSIONS: false } , { CREATE_INVITE: false} , { CONNECT: false }, { SPEAK: false } , { VIDEO: false} , { USE_VOICE_ACTIVITY: false} , { PRIORITY_SPEAKER: false}, { MUTE_MEMBERS: false} , { DEAFEN_MEMBERS: false } , { MOVE_MEMBERS: false}), reason: 'New channel added for fun!' });
} else if (reaction.emoji.name === '2οΈβ£'){
message.reply('**Text Channel** type selected. Setting up server stats...');
}
})
.catch(collected => {
message.reply(':redtick2: Time ran out! **Cancelling...**')
});```
You need some steel cylinders, a valve, some steel and high octane fuel
word + word != sentence
Hey so, I've been writing code rules to contribute to the discord mobile syntax highlighting but I'm stuck at something, is it possible to like match all the template expressions that are wrapped between template strings instead of having to iterate through it to match them one by one?
Afaik you need to iterate all matches
@fiery trellis
??
Anyone?
Get the user object -> get the private channel -> once open, send the message
is there anything wrong with this? ```html
<html>
<head>
<title>Chess</title>
<link rel="stylesheet" src="style.css">
</head>
<body class="page" style="background-color: #202020;">
<div class="board page">
<h1>test two</h1>
</div>
<script src="script.js"></script>
</body>
</html>```
?
the css doesnt seem to be doing anything
It's allowed
oh ok
afaik you cant have a space in a div class
href not src
in link tags
hey guys so is it possible to split items into multiple parts so i dont go above the discord limit? heres my items thing
let items = db.fetch(message.author.id, { items: [] });```
i just want it to where it slices it in half or something
let e;
e = a.trim[message.length / 2]
message.reply(e)
and that should send the first half
0 will trim the first part
oh ok
ok
.trim[0] doesnt make sense
trim is a function, not an array
.trim()
and what it does is remove excess spaces and line breaks from the beginning and end of the string
??
did you invent your own language
database.fetch("userIDs").trim[0];
no, i just code weirdly
that makes 0 sense
i tried other things too
let me do eval real quick
lol
it cant work for you, it doesnt exist
and see if iβm mistaken it for another function/array
are you getting a json object and getting the 0 index of an array inside the object called "trim" or something
because .trim[] isn't a thing
Huh I am mistaken it for another array
hm
Probably something I use alot
[that isnt my bot btw, just a friends bot i use eval with bc im lazy to make it myself xD]
embeds have a 2048 limit on description and 1024 limit on fields
and a total combined limit of 6000 per embed
o ig i did something wrong with .trim[]
@agile lance can you show us what your code looks like, im very intrigued
I have a function so i have to do is: "w(time in seconds)"
well im just curious how you're using .trim[0] and it works
is there a snippet for that
like copy and paste those few lines
do something like
if you want
function w(x) {
if (isNaN(x)) return console.log("X is a invalid number. Can not continue function!")
return new Promise(setTimeout(() { }, x * 1000)
}
something along those lines
ok so where's the .trim[0]
i was showing you my weird way to do things
for my db for cash and stuff
i do
oh wait it just gets rid of spaces
and what does db.fetch("Balance_" + message.author.id") return
I feel like you're just catching the error or something and ignoring it, which gives the impression that .trim[0] is actually doing something
sus boi
but its not spliting half of the things
take the .trim[0] out and see if the output changes
look heres what it does
alr
I don't think .trim() takes an input does it
like it's not .substring()
trim does not split things
.split probably
removes leading/trailing spaces and newline characters
slice, substring and substr are for cutting strings
oh
"The trim() method removes whitespace from both ends of a string"
so slice
split is for converting a string into an array
same output without .trim[0] @fringe pendant
But no error at all
Unless the db catches the error and works around it
yeah so it's doing nothing, and somehow you're avoiding the error
π€·ββοΈ
can you show it with an eval command?
iβll have to see
idk if i even have eval on that bot
considering its a new bot
my other one i dont have a db on
yeah i dont have eval on this bot
can you show the code for the balance command?
ok
let me open my code editor
name: 'bal',
run(client, message, args, discord) {
const db = require('quick.db')
let your_bal = db.fetch(`Cash_${message.author.id}`).trim[0];
if(your_bal == null) your_bal = 0;
const embed = new discord.MessageEmbed()
.setColor('RANDOM')
.setTitle('Balance')
.setDescription(`**You have a balance of: ${your_bal} dollars.**`)
message.channel.send(embed)
}
}```
that makes absolutely 0 sense
the only way that would work is if the database fetch returns an object containing a trim key with an array lol
const Pokemon = db.get(user.id);```
ik
im trying to cut it
this is not cutting tho
:/
show code
Ok
let box = db.fetch(`blacklist_${message.author.id}`)
if(box === 1) return message.channel.send(`${message.author} you are blacklisted! so you cant do this command! fill this out if you think this is unfair: https://forms.gle/EdYtdHNj4E5eLpnJ9 `)
let start3 = db.fetch(`ustart_${message.author.id}`)
if(start3 === 0) return message.channel.send(`${message.author} you need to do the command +start`)
let user = message.mentions.users.first() || message.author;
const Pokemon = db.get(user.id);
if(Pokemon === null) Pokemon = "Nothing"
const Embed = new MessageEmbed()
.setColor('RANDOM')
.setTitle(`Pokemon.exe`)
.addField("pokemon:", Pokemon)
message.channel.send(Embed);```
thats code
now it sends this error
wheres the slice/subtr/substring?
ph yeah
oh wait imma re add
hold
let box = db.fetch(`blacklist_${message.author.id}`)
if(box === 1) return message.channel.send(`${message.author} you are blacklisted! so you cant do this command! fill this out if you think this is unfair: https://forms.gle/EdYtdHNj4E5eLpnJ9 `)
let start3 = db.fetch(`ustart_${message.author.id}`)
if(start3 === 0) return message.channel.send(`${message.author} you need to do the command +start`)
let user = message.mentions.users.first() || message.author;
let Pokemon = db.get(user.id);
if(Pokemon === null) Pokemon = "Nothing"
const Embed = new MessageEmbed()
.setColor('RANDOM')
.setTitle(`Pokemon.exe`)
.addField("pokemon:", `${Pokemon}`.slice(0))
message.channel.send(Embed);
done
i tried adding the ` there to see if that works
@quartz kindle
but it didnt
no
??
oh
0 is start
that would return 2 characters
for example ye
(node:11) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN top.gg
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
(Use node --trace-warnings ... to show where the warning was created)
(node:11) 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: 2)
(node:11) [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.
what the error
am confused
bot.on('ready', () => {
setInterval(() => {
dbl.postStats(bot.guilds.size/*, bot.shards.Id, bot.shards.total*/);
}, 18000000);
});
is the only thing i have top.gg related
Note that it'll throw an error if the length is smaller than 500
also i meant max is 500 characters btw





Is this relates to bot development somehow?