#development
1 messages · Page 1340 of 1
Minecraft takes so much memory for no reason
such as 91829308129083 listeners
store the message object in a database @pulsar bone
@earnest phoenix how
discord.js?
yes
you'll need a database like quick.db or mongodb
or mysql 


@pulsar bone you can just store the message object in the database and access it later when you need it
example for quickdb:
db.set("messageObjectIWillNeedLater.object", <message>);
I am very new to coding but I tried to follow the discordjs guide as much as I could. After deciding that i want my bot to be somewhat of a music bot I tried to add Voice but now my else statements are broken
@old cliff btw you can use repl.it it's a good free hosting websites and u can make it 24/7 without paying and it gives 24-26 GB of free memory (Project Will Be Public If U Don't Pay Tho) But U can put a random project name if u don't want it to be open source and u can hide your token with .env file if u know how to use it
Wait, can you storage objects in sql?
@sly bison wrong

Yep
@sly bison they don't give 24 GB of free memory they only give you 512 MB per repl else they'll go bankrupt because that's more than enough for almost anything so people won't pay for stuff
yeah
Just used mysql cause its easier than mongo
@earnest phoenix why when I do my bot info command it says 24gb tho?
I once ran an infinite loop in replit
but if your individual repl goes above 512 MB they'll kill the process
I'm dumb then
@sly bison yeah we know
while(true) 
Hehehe

can someone send me the example code for collecting message from user and converting it to embed
I might also sneak in a lil rickroll
can someone send me the example code for collecting message from user and converting it to embed
@pulsar bone spoonfeeding
we won't just give you code
can someone send me the example code for collecting message from user and converting it to embed
@pulsar bone Use args.
Args wtf
@pulsar bone spoonfeeding
@earnest phoenix call it whatever its easy for me to learn that way
Well, copy pasting isnt that bad if atleast you read it after doing it
^
If you dont you are not programming, you are copying like an ape
And calling yourself a programmer
bot.on('message', () => {
send(new Discord.MessageEmbed()
.setDescription(message.content))
}```
Only copy paste codes if you know what every line does, and why it is there.
not working code btw
bruh
cursed code
Btw is send a function????
@carmine summit yes
That code isnt even closed.
it's a method of the TextChannel object and methods are just functions
Remember to be at least slightly helpful, and not just talk smack on code. Everyone learns, they're asking help for a reason. 
Well... you are not even specifying a channel to send it
I'm drunk
yes it can
message will go indefined
bot.on('message', message => {
message.channel.send(new Discord.MessageEmbed()
.setDescription(message.content)
);
});
yes
Dont tell me bot is not defined
perfect
Yes
Close the damn code.
) moment
Don't tell me you defined it as client
oh wait
there should be a closing bracket at end

parenthesis xd
Yes
you are only closing the arrow function
👍
There we go
You're an official api abuser
for bot developer role?
No
Oh for that
You cannot
ah damn dumbo coder is another category?
That code is bs
thought its the same
It just repeats ecery message
@old cliff btw you can use repl.it it's a good free hosting websites and u can make it 24/7 without paying and it gives 24-26 GB of free memory (Project Will Be Public If U Don't Pay Tho) But U can put a random project name if u don't want it to be open source and u can hide your token with .env file if u know how to use it
@sly bison yeah I know about that
As an embed
@marsh bluff with that joke and that code I can tell you are an experienced comedian
thanks

that's what i do for a living
post shitty code on stack overflow and gain points for bread

Congratulations you are now an official API abuser. You just made a bot that repeats every message as an embed 
Who? @marsh bluff
what
lol
@carmine summit I remember you about the DaddyBot, his only function is reply with 'Hi im daddy' whenever someone say hi
wait he did just that and got a bot developer role?
Cursed english 
@marsh bluff lmao stop I'm laughing to death no sarcasm
thanks my mission of making people laugh from my terrible comedy is completed
i can go finish my russian literature test now
lmfao
@half briar if you're trying to use a bot goto #commands or #265156322012561408
if you need help with programming ask here
What is that cursed code I just read, I just went here for boredom and saw that 
What are the ${...} called inside a `
template literals
@surreal sage you can add code inside 
not entirely correct but ok
message.channel.send(`Hi ${message.author}`)
k
it's mostly used for putting the values of variables inside strings
you can't put full on complex code inside it
stuff like if statements won't work
just use ternary
well
i love annoying vo1d he's qt

im sure noone will put a complex function or whatever inside
@ionic dawn i did once
@celest axle this the wrong channel
let yes = []
yes.push('no')
@ionic dawn i know but how is it called
do I look like a real programmer? oh pls
an array
Sphinx
Is there any way to remove the annoying Next/Previous topic in the sidebar? Using basic theme
message.guild.members.cache.get(id).displayAvatarURL();
``` why isnt this working 
member.user.displayAvatarURL() 
Why is that not working? want it for sharding, ping me
at Object.run (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\commands\music\play.js:11:38)
at Client.<anonymous> (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\server.js:101:17)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:15728) 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:15728) [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.
const { manager } = require("erela.js");
const { Client, Collection } = require("discord.js");
const client = new Client()
module.exports = {
name: "play",
category: "Music",
description: "Play Music",
usage: "play <url or name>",
run: async (client, message, args) => {
const res = await client.manager.search(
message.content.slice(6),
message.author
);
const player = client.manager.create({
guild: message.guild.id,
voiceChannel: message.member.voice.channel.id,
textChannel: message.channel.id,
});
player.connect();
player.queue.add(res.tracks[0]);
message.channel.send(`Enqueuing track ${res.tracks[0].title}.`);
if (!player.playing && !player.paused && !player.queue.length)
player.play();
if (
!player.playing &&
!player.paused &&
player.queue.size === res.tracks.length
)
player.play();
}
}
```
whats the issue
i m using https://npmjs.com/package/erela.js
you may have messed up the initalisation a bit
can u help me checking it?
I suggest you to go ask in https://discord.com/invite/5dTpady @next flax
you can get support for erela.js there
its the discord server of the maker of erela.js as well
also pick the erela.js role in #719543275844796518
that thunder named person had same error
not a lot of people in here know erela.js
actually only a few do
so its better you ask in thier server and wait for a response
cuz they know erela.js
hm
they can give better support
@tired panther regarding #development message : I'd recommend using a webhook instead. You can just post the message to it from anywhere, from any shard.
o
let user = bot.snipe.users.get(channel.sender);
error:
TypeError: Cannot read property 'get' of undefined
how do i define get?
ty
users is undefined and therefore has no properties like get()
i made a snipe command
and i want in the author to send the pfp of the person who sent the deleted message, how do i do that
If you relay audio from one voice connection to another
will
const audio = connectionA.receiver.createStream('User');
connectionB.play(audio, { type: 'opus' });
work?
this is something I did test but it doesnt work for me thats why im asking if the format allows for the connection to be streamed into a channel
How can I make my discord bot detect if someone voted for it on top.gg?
Cuz I wanna give like some kind of prize every time someone votes
Discord verification queue

How to increase
Automatically??
Is there certain api I need to use?
I need a bot that only asks "new created" accounts to be verified.
⚠️ NEW ACCOUNT created 13 hours, 48 minutes and 5 seconds ago⚠️
This kind of accounts ^
Sure, you can see the date an account was created on
Note, NOT all accounts / new joining members. Only new created accounts.
depending on the library
I need a bot that add a role to this kind of users "non-verified"
Are you making a bot or looking for a bot?
Letting them verify themself before they can access the server.
Write an if statement to check if an account was created like 24 hours ago if not return
@umbral zealot Both. Is there a existing bot for that?
that's-
I will ask for help on a non-dbl issue, your bot always gives missing permissions error and the bot restarts in 6 hours.When the bot restarts, timed commands such as the draw are reset, if there is any help, dm come please
you can ask here
@earnest phoenix "your bot" what bot?
this channel is for any development topic, mainly discord bots
discord bot
Who's bot?
whose?
not available on the server
who is?
What fucking bot are you talking about, mate, we have no idea.
just me
...then go to the support server for the bot?
I'm talking about error my bot says missing permisions and closes
Then why did you say "your bot always gives..."
Then give it the permissions
god people are so confusing sometimes.
If it says missing permissions give it the permissions it needs
I'm using google translate I'm not sure about anything I wrote
Give it permissions, or check that it has permissions before executing the command
Can someone help me with this
if it doesn't have permissions, tell the user it doesn't have them.
sigh
My bot is a public bot, I can't be sure if anyone gives it so I need a return system or an error debugger. I want help from it.
@humble wasp message.client.commands is undefined.
no you're having trouble with message.client.commands being undefined, so message.client.commands.array() tells you it can't read the property array of undefined where message.client.commands is what's undefined.
So what i need to do huh?
@client.command()
async def leaderboard(ctx):
with open('pointspotd.json', 'r') as json_file:
lead = json.load(json_file)
embed = discord.Embed(title = "Leaderboard", description = "This the leaderboard in The Calt Server.")
for item in sorted(lead.items(), reverse=True, key = lambda p: p[1]):
idofuser = int("{0}".format(*item))
points = int("{1}".format(*item))
user = client.get_user(idofuser)
embed.add_field(name = f"{user.mention}", value = f"Points: {points}", inline = False)
await ctx.send(embed = embed)
```Do you know what is wrong with this?
Nothing is sending, no errors.
no idea, it depends what message.client.commands is supposed to be?
@umbral zealot Too many commands and I can't see where the error came from
Define message.client.command
@charred kindle Ye thanks that really helped (no)
@earnest phoenix then add proper error handling in your commands, so that you know where it comes from.
So if discord.js is not required/imported/used correctly
Well, can you send an example command?
You aren’t defining message.client
message.client is valid in discord.js. But message.client.commands doesn't exist in discord.js. it's not a thing. discord.js doesn't konw what "commands" are.
@umbral zealot So when the command is calling it supposed to reply all the bot commands that it have
Well, can you send an example command?
@umbral zealot
I can't send you anything @earnest phoenix because I litearlly have no idea what your bot does, what language it's in, or what library you're using.
js
hey
I'm using javascriprt discord.js
@humble wasp this is undefined.
lmao
where is it pointing to
lmao
So how i define it?
lmao
No idea
@umbral zealot javascriprt discord.js
〈Evie.Codes〉bugün saat 17:27
@humble wasp this is

wut
So how i define it?
@humble wasp Define an array with commands the BOT supports.
javascript and discord.js is all different codes
@umbral zealot javascriprt discord.js
〈Evie.Codes〉bugün saat 17:27
@humble wasp this is
@earnest phoenix
here @earnest phoenix , read this https://www.joyent.com/node-js/production/design/errors
What the fuck
I fucking hate the quote system, with every fiber of my body.
JavaScript is a programming language, discord.js is a discord api wrapper
yeah I hope so
Man this chat 👁️
Or better define an object.
@humble wasp Define an array with commands the BOT supports.
@boreal iron
@humble wasp we have no idea what client.commands is supposed to be, you're using it, what do you Think it's supposed to be? Where did you read that this was a thing?
Just define a new property on the client object with the value of a new collection
The bot is writed on discord.js commando
I only write bots in esoteric languages
Writing bots in binary moment
@humble wasp Looking at the commands.forEach function your command needs to be a valid object, containing name , aliases and description properties
hey so i wanted to ask when something or someone is tagged
it has some charcters over the ID in my knowledge the chars are <>@#! is there anything else than this exists when something is tagged ??
No

hey so i wanted to ask when something or someone is tagged
it has some charcters over the ID in my knowledge the chars are<>@#!is there anything else than this exists when something is tagged ??
@upper crescent there is a "mentions" property typically
user mentions are only <@id> or <!@id> there is no other way to tag a user.
don't forget & for roles
Isn't it @! ?
for channels
yeah i meant that only @faint prism
eh could be @! actually
nah
I don't exactly parse mentions manually I let my lib do it 😄
no when a channel is mentioned is it #
<@id> => mobile
<@!id> => PC
yes
<#id> - channel
<@id> - mention
<@!id> mention with nick
<@&id> - role
@!
@humble wasp For example:
[{
name: 'command1',
aliases: 'cmd1',
description: 'the fuck I do'
},
{
name: 'command2',
aliases: 'cmd2',
description: 'the fuck I do here, too'
}]
I don't exactly parse mentions manually I let my lib do it 😄
i am using discordgo
the fuck you do
yes

What does the dictionary consist of
@slender thistle the keys are id numbers and the values are their scores
I doubt many here write in golang
so sort the dict by value xd
Can you people respond any later
Wot
I respond the next day sometimes
Or hell, sometimes I quote from msgs that I dig up in the search that are years old
Question... Can you put a Check onto an event? so say like i wanted the bot to add roles only to users who join a certain guild? D.PY
y e s
Of course
I doubt many here write in golang
Question... Can you put a Check onto an event? so say like i wanted the bot to add roles only to users who join a certain guild?
@earnest phoenix
if (condition) {
...
} else if (alternativeCondition) {
...
} else {
...
}
😉

elif
L Y N X, there are parameter returned when the event emits
Use those to do the thing you want
thank you
SyntaxError moment
shhh, there's no syntax error, it's just u doing something wrong
@humble wasp For example:
[{ name: 'command1', aliases: 'cmd1', description: 'the fuck I do' }, { name: 'command2', aliases: 'cmd2', description: 'the fuck I do here, too' }]
@boreal iron Whaaaaaaaaaaat???????????
So I'm trying to make a typescript discord bot and I have this as my command class, https://srcb.in/503db304bb, but when I try to do the options, it doesn't work. Any advice?
wdym
@compact echo you need to declare the class properties before you can initialize them
Sorry, I'm learning typescript 🙂
Wait
What do you mean by declare properties before you can init them?
class XYZ {
abc: string;
constructor(somedata: string) {
this.abc = somedata
}
}
ye
k
How can I be active 24/7 my bot
@earnest phoenix https://repl.it/ then use https://uptimerobot.com/ if you want
ok
lots of tuts on it
yes
@earnest phoenix https://repl.it/ then use https://uptimerobot.com/ if you want
@compact echo uptimerobot not work for glitch
Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages: Clojure, Haskell, Kotlin, QBasic, Forth, LOLCODE, BrainF, Emoticon, Bloop, Unlambda, JavaScript, CoffeeScript, Scheme, APL, Lua, Pyt...
😆
@humble wasp What - what?
don't use glitch, they can delete your project if they find out you host a bot
Already gave you the example how your commands array has to look like.
share it somewhere else
Lol
don't use glitch, they can delete your project if they find out you host a bot
@pale vessel wait they do? lol I host like 10 bots on it ;-;
Boost use?
@compact echo use boost?
If someone knew the answer they would respond
stop asking the same thing over and over please
😦
My friend created a pinger that works
@compact echo pinger means uptimerobot
nope, not that
Not web.
why are you using json
It's a discord bot
it's against their tos to use pinging services
@faint prism this is a private boy

Bot
and?
I’m only going to use in one server
why are you using JSON is my question
🤣 🤣
Because I don’t want to learn database right now
Bobthegod is working with me
How to uptime bot 24/7?
mhm
Nope
How to uptime bot 24/7?
@boreal locust use a hosting website
@boreal locust glitch.om
mhmhmhmhmhmhmhmhmhmhmhmhmhmhmhm
@boreal locust host it somewhere or leave your computer on 24/7
Spammer
I use aws

Could I make an eval command that I can only run? With my bot.
using a sqlite database at least is a quick solution
Could I make an eval command that I can only run? With my bot.
@wicked sapphire make it so if checks the id number
I have 5 min to go
It just doesn’t send anything
Could I make an eval command that I can only run? With my bot.
@wicked sapphire yeah, but be careful you lock it down. Otherwise someone can abuse it
😄
@boreal locust use a hosting website
@earnest phoenix that free hosting website?
@earnest phoenix that free hosting website?
@boreal locust u can use aws
Anyone know how to make a calculate command, without eval()?
@boreal locust u can use aws
@modest smelt ok
@faint prism so how should I proceed with JSON
Without JSON
Anyone know how to make a calculate command, without eval()?
@wicked sapphire you can use a library, depends on what programming language you use
@earnest phoenix that free hosting website?
@boreal locust 100%
Bruh
Huhh
if people want to use json, let them use it lol
@boreal locust 100%
@earnest phoenix where?
@faint prism json is not the only problem
we tried just defining a dictionary
with everything that was in the json file

and it didn’t work
Glitch give 1000hours/month
10k when

@quartz kindle Like this? https://srcb.in/1f5ec78e13
Glitch give 1000hours/month
@earnest phoenix only for static sites
else it will complain that client has no properties and methods
Well I have a client class already
so just do client:ClientClassHere
just so its not any
the dictionary can use user ids. Only store what's needed
Store have nothing free
@earnest phoenix only for static sites
@misty sigil it's work 24/7
quick question ppl... I want to edit the contents of a file that was committed a while ago, and had commits made on top of it. Is there a way I can amend a commit by hash?
@outer topaz
So how can i use json?
Yes
is there a way i can fix this, it doesn't apply css
Don't strictly check mime type or include text/html or approved ones
how do i turn that off
google it idk off the top of my head
mmk
If anyone has suggestions about what can be added to improve a simple application bot, give them to me.
(just ping me please)
@stoic girder Can I see it?
depends on the bot itself
^
im pretty sure im not allowed to post this https://top.gg/bot/753982465261174847. apparently "advertisment"
https://hasteb.in/ozugulub.bashany any idea why it is not working?
yes but is defined xD
cause your command handler most likely does not include it
but it isnt
Exactly
Bumping my question:
Sphinx
Is there any way to remove annoying Next/Previous topic sections in the sidebar? I'm using the basic theme
@tired panther show me your command handler
command.execute(message, args, Discord, client );
is message defined in that file
yes
client.on('message', message => {
all other commands work
but the sharding one does not
I want to send a message in another shard
Code: https://srcb.in/e05ccaa109
Trying to let the options be in the super() instead of the constructor
@tired panther Don't ghost ping. I saw that
i thought u went away sorry
i don't know why sry
xD, but any ideas why it is not working
nope
just use a webhook.
^^
why not use a webhook
I'm idling here need help with js pingg me
no
how can i literally put together strings?
int?
so like int1 + in2 = int1int2
like literally put them together not add them
@drifting wedge Parse them as strings before concatenating
ok ty
can anyone help for a sec? need to make my bot send out a message greeting everyone who joins the server but it tells me that
djs?
yes
in v12 i belive your missing the cache
oh like
Alright so I have this string wich is the user's current inventory:
1:4,2:3 for example, then I have an array of objects with the items to be added like this:
[
{
itemid: "2",
amount: 1
}, {
itemid: "1",
amount: 2
}
]
Now I have this function to basically add these items into the inventory:
static addMaterialsToInv(items, string = "1:4,2:3") {
let newInventory = [];
let currentItems = string.split(",");
for (let i = 0; i < currentItems.length; i++) {
let item = currentItems[i].split(":");
for (let j = 0; j < items.length; j++) {
if(item[0] === items[j].itemid) {
let newAmount = parseInt(item[1]) + items[j].amount;
let newItem = `${item[0]}:${newAmount}`;
newInventory.push(newItem)
}
else newInventory.push(`${item[0]}:${item[1]}`)
}
}
}
now this works fine if there's only 1 item, but if there's more then 1 item it will return this:
1:6,1:4,2:3,2:4 when it should only return 1:6,2:4 any idea on how to fix this?
.cache at the end?
thanks a ton, works now
what's concatenating
item + item
basically adding up
but then with strings
so u get
"hello" + "bye" = "hellobye"
@tulip ledge Is it like, 1,4 === itemId,amount?

the issue is that the for loop loops twice when there's 2 drops and then it checks like thi: id:1 === id:2? No, add 1:4 to the list even tho 1:6 is already there but I don't know how to fix that issue
Tim would say alakazam and it's fixed lol
help pls
ight ty
it's still used in the client
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined
ı got this error
how can ı solve it
[{
itemid: "2",
amount: 1
},
{
itemid: "1",
amount: 2
}]
static addMaterialsToInv(items, string = "1:4,2:3")
Increasing itemid 1 by 4 and 2 by 3, right?
no no no
the string is what the user currently has
the array with objects is what it needs to add
oh
So it should become: 1:6,2:4
alright
@maiden steeple send code
expecting the entered string is in format id:amount,
@tulip ledge Is this what you wanted or
no not rlly it should return a string
So like id: 1and amount: 2 it should increase the 1 in the string with 2 so it should result in 1:x+2 if u get what I mean
I got that to work but it does weird stuff when u have multiple objects in the array
.addField(`**Toplam Üye ・** ${message.guild.memberCount}\n**Aktif Üye ・** ${message.guild.members.filter(m => !m.user.bot && m.user.presence.status !== "offline").size}\n**Taglı Üye ・** %{message.guild.members.filter(m => m.user.username.includes(tag)).size))\n**Sesteki Üye ・** ${message.guild.channels.cache.filter(count)}`) and the error is UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined
message.guild.members.cache
U need to use cache if ur using V12
So it should be message.guild.members.cache.filter(...)
o/
//queue command
const player = bot.music.players.get(message.guild.id);
if(!player || !player.queue[0]) return message.channel.send("No song currently playing.")
let index = 1;
let string = "";
if(player.queue[0]) string += `_**Currently Playing**_\n ${player.queue[0].title} - **Requested by ${player.queue[0].requester.username}**. \n`;
if(player.queue[1]) string += `_**Rest of queue**_\n ${player.queue.slice(1,10).map(x => `**${index++})** ${x.title} - **Requested by ${x.requester.username}**. \n`).join("\n")}`;
const embed = new RichEmbed()
.setAuthor(`Current Queue for ${message.guild.name}`, messgae.guild.iconURL
.setThumbnail(player.queue[0].thumbnail)
.setDescription(string)
return message.channel.send(embed);
//done
this one
please us codeblocks
when im doing it in my music bot it shows error
and thats just code, please provide an error
please us codeblocks
@tulip ledge how?
```js
code
```
and thats just code, please provide an error
@tulip ledge syntax error
can u give the full error?
alr
are you using discord v11?
Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem.
I think I see the issue
.setAuthor(Current Queue for ${message.guild.name}, messgae.guild.iconURL
.setThumbnail(player.queue[0].thumbnail)
If u open brackets you need to close them too
Also isn't iconURL supposed to be called as a function?
There is no template string's `
theres so much wrong with that code lol
rewriting the whole code is better than find every single error
There is no template string's `
@earnest phoenix There is, it didn't show up cause he copied it from his previous message which wasn't using a code block
but he has to type the correct code else ban
missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11

error
@earnest phoenix you're missing a )
fuck you auto-correct
what line
but he has to type the correct code else ban
@earnest phoenix i agree
what line
@earnest phoenixyou tell us
sugchannel.send(embed: ${suggestmessage})
the think is there `
how can I access correctly suggest message
oh god I thought that was java for a second
@boreal iron .=???
static addMaterialsToInv(array = [{ itemid: "2", amount: 1 }, { itemid: "1", amount: 2 }], string = "1:4,2:3")
{
let output = "";
let items = string.split(",");
for(let a = 0; a < array.length; a++)
{
for(let b = 0; b < items.length; b++)
{
let element = items[b].split(":");
if(array[a].itemid == element[0])
{
array[a].amount += parseInt(element[1]);
break;
}
}
}
for(let c = 0; c < array.length; c++) output += array[c].itemid + ":" + array[c].amount + ",";
return output.substr(0, (output.length - 1));
}
Short PHP flashback, sorry
yikes
still don't understand why php decided to use . for concatenation
😂
@boreal iron is it supposed to be +=?
I remember when I switched to python for a project, I kept adding semicolons and curly brackets
nah u can use concat... edited the post already
@boreal iron is it supposed to be +=?
@tulip ledge thats a valid operator
I know I could use for loops, William, but reading my post will answer this
it's just there because I'm too lazy to write for loops
writing one term forEach is faster in typing
then function () etc is faster than just for (i of array) ?
@boreal iron undefined1:24
items.forEach(function(item) {})
// can use this instead
items.forEach(item => {})
@boreal iron
Imma also not using arrow function expressions, because I dont like to
as soon as i posted my msg
or
oh forgot to close );
for (let i of array) console.log(i);
@tulip ledge
gonna update it real quick
typing in Notepad++, so no hints if you forgot to close it or not :)
let's call it hardcore
Imma also not using arrow function expressions, because I dont like to
Arrow functions are considered better practice
I dont care what they are considered
I'm coding since 14 years and I'm not gonna change my style
that's bad
^
yes 
lmao never use var
@tulip ledge Mate
bet I'm getting rid of it in updates and newer code

Ah so you are willing to change
Good on you then
None of this is a jab at you either, just trying to encourage better practces
I also started with notepad++ 7 years ago, would strongly recommend the transition to sublime text 3
euhm @earnest phoenix yours returns 1:4,2:3 the same string
Well I write that for demonstration purposes for Chicken...
ye FakE's one didnt work either lol
nope urs returned undefined1:14
Another reason to switch to an actual code editor
pfff no risk no fun
How do rate limits work? Do you store in a database when the last command was executed and compare or smth?
@earnest phoenix
static addMaterialsToInv(items, string) {
let newInventory = [...items];
string.split(",").map(itemIdentifier => {
if (items.some(item => item.itemId === itemIdentifier.split(":")[0])) {
newInventory.find(i => i.itemId === itemIdentifier.split(":")[0]).amount += parseInt(itemIdentifier.split(":")[1]);
} else {
newInventory.push({
itemId: itemIdentifier.split(":")[0],
amount: parseInt(itemIdentifier.split(":")[1])
});
}
});
let sortedItems = [];
let itemIds = string.split(",");
while (itemIds.length) {
sortedItems.push(newInventory.find(i => i.itemId === itemIds[0].split(":")[0])), itemIds.splice(0, 1);
}
return sortedItems.map(i => i.itemId + ":" + i.amount).join(",");
}
Returns the same thing as string -> 1:4,2:3
Ok nvm I found the issue
You were using itemId with a captical I, I was using itemid
alright ty very much
Np
@tender needle some info here if you want to look through it, there's libraries out there that will handle a lot of it for you depending on how you implement the API https://nordicapis.com/everything-you-need-to-know-about-api-rate-limiting/
@fringe pendant Thanks
if your api is nodejs, it's super easy to introduce a rate limit
^
Can someone help me on installing quick.db on macOS 10.12? I get this error everytime. https://srcb.in/081bad0310
I want to host a second domain on my nginx server but it always redirects to the other server I have active
are you using cheddar's vps
@tulip ledge Found my issue btw and updated the message even if you don't need it anymore 
forgot to parseInt() the amount... lol
idk cedar's cf
uhhh naw
Eh
language?
discord.js
i think you can use jimp
make a canvas, then get a random word and then draw the word on the canvas
or use jimp
ye
Thanks for this
np
Can someone help me on installing quick.db on macOS 10.12? I get this error everytime. https://srcb.in/081bad0310 plz help ❤️
@compact echo heyo
there's a section on how to install it
and how to trouble shoot it
in quick.db npm page
@earnest phoenix Heyoooooo, I've seen it, doesn't work 😭
what's the error message?
the srcb.in
It says to do this
Mac
Install: XCode
Run: npm i -g node-gyp in terminal
Run: node-gyp --python /path/to/python2.7 (skip this step if you didn't install python 3.x)
Run: npm i quick.db
None of this is a jab at you either, just trying to encourage better practces
huh don't worry, I'm cool and too old to change anythign anyways :D
I have XCode, but the problem is that it's an old version because
my mac is an old version
Have you tried to install it with force flag?
npm i quick.db -f
Same error?
client.shard.broadcastEval(
`
const sugchannel = this.guilds.cache.get('${sguild}').channels.cache.get('${schannel}');
if (sugchannel) {
const suggestmessage = new Discord.MessageEmbed();
suggestmessage.setTitle("A new Suggestion:");
suggestmessage.setDescription("${args.join(" ")}");
suggestmessage.setAuthor(
message.author.username + "#" + message.author.discriminator,
message.author.displayAvatarURL
);
suggestmessage.setFooter(
"ID: " + message.author.id + " Name: " + message.author.username
);
suggestmessage.setTimestamp();
sugchannel.send(suggestmessage)
true;
}else {
false;
}
`)
does not work
I am stuk on this since 4 hours
Elaborate on "does not work"
It would send a message in another shard
but the embed message is not been sent
const suggestmessage = new Discord.MessageEmbed();
suggestmessage.setTitle("A new Suggestion:");
suggestmessage.setDescription(args.join(" "));
suggestmessage.setAuthor(
message.author.username + "#" + message.author.discriminator,
message.author.displayAvatarURL
);
suggestmessage.setFooter(
"ID: " + message.author.id + " Name: " + message.author.username
);
suggestmessage.setTimestamp();
client.shard.broadcastEval(
`
const sugchannel = this.guilds.cache.get('${sguild}').channels.cache.get('${schannel}');
if (sugchannel) {
sugchannel.send(suggestmessage)
true;
}else {
false;
}
`)
``` thats my code
You realize you're using ' instead of `
I meant around the template literals
It can send in the right channel
Wot
how?
How can I make a command available to only one person? I program in discord.js
so I'm trying to add mongodb to my bot so i can keep currency values and stuff whenever I update the bot
const {Schema, model} = require('mongodb');
const Guild = Schema({
id: String,
prefix: {
default: ']',
type: String
}
});
``` so I do this, and I get `TypeError: Schema is not a function` (djs)
if(message.author.id !== id) return;
How can I make a command available to only one person? I program in discord.js
@radiant vigil if (msg.author.id === 'id of person you want here')
if(message.author.id !== "138029731655188480") return message.reply("go to hell");
@tulip ledge
@radiant vigil ^^
Schema is a constructor not a function @upper elm
u need to do new Schema
No one any idea?
ok thanks
like we said earlier... ur using ' instead of backticks
Thanks @chilly bison and @upper elm
np
ight I'm getting distracted again I should go study history
on behalf of him'
cartography.....
alr chickendev gl on whatever test or whatever
@upper elm
Schema is available on mongoose not mongodb
ok
so do i have to install mongoose? what's the difference, and do i need mongodb
sorry for all the questions
mongodb is a dependency used by mongoose
ooh ok
client.shard.broadcastEval(`
const sugchannel = this.guilds.cache.get('${sguild}').channels.cache.get('${schannel}');
if (sugchannel) {
sugchannel.send(suggestmessage)
true;
}
else {
false;
}
`)
```How do i access suggestmessage when it is not in the ` ``?
@tulip ledge @earnest phoenix hehe, since other people complained about my code style
https://jsben.ch/Hredl
yes ur code style is weird to me
But way faster
forEach(function()) why not an arrow function?
Nobody knows sharding?
huh I said don't use foreach
I said I'm too lazy to write for loops but updated my post
I'm gonna clean it up a lil tho
Array mapping and finding will cycle the whole array always, mines will break if id match is done
u can use the break keyword in if statements? Nani o.O
I thought it was only for switch case
Oh... yeah and I missunderstood your array actually are the items, that's why there was an error in version 1
@tulip ledge no
ye I noticed too
i dont think so at least
nope, there's a for loop before
what @boreal iron ??
break, breaks the first loop
@tired panther js client.shard.broadcastEval(`(() => this.channels.cache.get(${schannel}) ? this.channels.cache.get(${s.channel}).send(${suggestmessage}) : null)()`);
for what is the ? @earnest phoenix
huh
welp another PHP flashback then, it used to be an alias there
its a ternary operator
its like an if statement @tired panther
Conditional operator to check if the channel is available on that shard
<statement> ? if true do this : if false do this
let me try
yup getting distracted again .--.
But it doesn't matter, since does what is suppost to do
I hate history so much tho... Why can't they just give me computer science
I hate how belgium doesn't give computer science untill u go to college or uni
i have a snipe command, and i want it to put in the .setAuthor the user that sent the message that got deleted.
like the computer science we get now is word and excel ....
Computer science is poggers and nothing else
break is used in switch()
@sharp thicket u better watch https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_state_break
break; is used in any loop
No
"can be"
Why does that break break the first for loop and not the one it's nested in?
oh u said it broke the first for loop
huh did I?
break 2?
maybe not spelled correctly
@boreal iron i dont watch yt vids
shame on me
*@Voltrex Master#0001* I am so thank full u solve by problem which i stuck for 4 hours
Np
thats outdated prob @boreal iron
stop distracting me D:
@client.command()
async def leaderboard(ctx):
with open('pointspotd.json', 'r') as json_file:
lead = json.load(json_file)
embed = discord.Embed(title = "Leaderboard", description = "This the leaderboard in The Calt Server.")
for item in sorted(lead.items(), reverse=True, key = lambda p: p[1]):
idofuser = int("{0}".format(*item))
points = int("{1}".format(*item))
user = client.get_user(idofuser)
embed.add_field(name = f"{user.mention}", value = f"Points: {points}", inline = False)
await ctx.send(embed = embed)
```Do you know what is wrong with this?
Nothing is sending, no errors.
huh yeah, said something different than I meant lol
idk py sorry
happens
for(var i = 0; i < 10; i++){
//loop code
}
very
thats outdated prob
@sharp thicket What's outdated?
What are you guys even talking about
I don't even know myself 
the break; in an if statement
What
The break is still inside the loop
@earnest phoenix did not work xD
I incidently ran my alpha bot, which does not have sharding
```js
client.shard.broadcastEval(
(() => this.channels.cache.get(${sguild}) ? this.channels.cache.get(${schannel}).send(${suggestmessage}) : null)())```
run it on the one that has sharding
error:
SyntaxError: Unexpected identifier
at Client._eval (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\Client.js:391:17)
at ShardClientUtil._handleMessage (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\sharding\ShardClientUtil.js:185:82)
at process.emit (events.js:327:22)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
🤦♂️
?
this error comes
yes u revealed r name
but you usually don't use it in a for loop
@vernal rivet Usually not, but if you have one (need) match only, break will end the loop which dramatically decreases your script runtime
lol
so whats the problem?
You but Korabi still wonders about it
maybe ur bot does not have sharding
code in string = me sad
@sharp thicket it has sharding , indeed
huh ok, so you got it now? it's basically correct all I wanted to say
well can you read your error?
@sharp thicket
but I can not conclude any thing
@boreal iron Is this what you guys were talking about?
Also the break is not needed at all
break; just exits out of the scope. it similar to return, but doesn't return a type, and doesn't actually exit out of the method/function
you usually don't need to use it that often
Not related
i use ++i, and i am cool 
The break is not needed, but if(i == 3) break; it would be
client.shard.broadcastEval(`(() => this.channels.cache.get(${sguild}) ? this.channels.cache.get(${schannel}).send(${suggestmessage}) : null)()`)
``` thats the code and then the erorr comes, [#development message](/guild/264445053596991498/channel/272764566411149314/)
well can you read your error?
@sharp thicket
U still quote urself lol
yes the link ⤴️
i know
but why is it in a string? does broadcastEval require a string?
@tired panther js client.shard.broadcastEval( `(() => this.channels.cache.get("${sguild}") ? this.channels.cache.get("${schannel}").send("${suggestmessage}") : null)()`);
yes
Try
@vernal rivet Evaluations require a string as a parameter
It iterates through all shards with the same thing
tbh thats stupid, but at the same time i guess it makes sense.
yes
If that doesn't work i got a big brain idea




