#development
1 messages · Page 1181 of 1
Use .map or a for loop with string.prototype.replace
let commands = o_commands.map(remove_js)
function remove_js(cmd) {
cmd.replace('js', '')
}```
this is not correct :(
Is there a way to download npm packages using a command?
I am using v12
Hello, i have the "- This request has grown unnaturally so we are unable to accept your verification request at this time." error and i made 2 commands one that shows me the servers and their ids and one that leaves them what are some sketchy names to look out for?
use process.exec
it's part of the child_process module https://nodejs.org/api/child_process.html
within node.js
var exec = require('child_process').exec;
child = exec('npm install discord.js').stderr.pipe(process.stderr);
like this?
ok
how do you expect anyone to help you when you provide no context
can’t open the console
!ajuda
hommie are you using windows server
haven't seen that shit since i was in elementary school
install node.js
!help
-botcommands @quick lily
@quick lily
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
@hushed axle run in through command prompt
I rent that vps today my friend help me install win
why the other vps can open the console and the new vps don’t 
How would we know
do you have node.js installed on the vps?
Which one?
the one where you can't open the console
yes
thanks
Should work
ty
Windows server lol
Schools still teaching that cause some companys require that knowledge
In my grade we have a few lessons of Windows Prompt
my education was so windows focused
its sad how little linux and programming was taught
Windows is useful for people who have no idea about computers or have an administrative work
Anything else should be made on linux
I can use user flags only in v12 ye?
Yeah
yuh
anyway you should stay off v11
It won't work when intents are required
Which is in early October
I will change to v12 when its gonna break

You're delaying the pain until later.
^^
I recommend you do it as soon as possible vs. doing it when you're required to.
it's like doing your homework very late in the night (or in school) instead of when you get home.
is there a way to check that args[0] is a member id? its for an unban command
right now the unban command detects everything even if it isnt an id
I have laptop so i will do it in the school
is there a way to check that args[0] is a member id? its for an unban command
@dense vessel what library are you using?
discordjs 12
is there a way to check that args[0] is a member id? its for an unban command
maybe parse args[0] to ulong?
@dense vessel you coding bot
IDs are typically 17-19 characters, but since they're snowflakes, I believe they can be forever growing in size (regex: \d{17,})
maybe parse args[0] to ulong?
IDs are typically 17-19 characters, but since they're snowflakes, I believe they can be forever growing in size (regex:
\d{17,})
ill try doing these, thanks for the help
Yeah but you can use parseInt in JS
It won't be accurate of course since it's too large
Since I don't really have any Discord friends that are interested in Formula 1, can I ask if someone who knows a little about Formula 1 wants to test my bot?
would checking if args[0] is NaN work too?
(not the channel for that)
Yeah but you still need to try parsing it. Really the only reason I'd bother trying to convert it to a number is just to see if it looks like a snowflake
that's a rat
Removed
Yeah but you still need to try parsing it. Really the only reason I'd bother trying to convert it to a number is just to see if it looks like a snowflake
alr thanks for the help lite
I did the snipe command. but does not see embed messages.
so RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty. gives a fault.
collector.on('collect', (reaction, user) => {
console.log(`Collected ${reaction.emoji.name} from ${user.tag}`).then(() => {
options.edit(`Okay, I've collected ${reaction.emoji.name} from you.`)
}).catch((err) => {
console.error(err);
})
});
is there a reason why .then is undefined
TypeError: Cannot read property 'then' of undefined
How do I make my py bot send like command not found?
Create an error handler for on_command_error and check if the exception is an instance of CommandNotFound
For reference:
async def clear(ctx, amount=300):
how do i make it so i can only clear 300 messages max
DP is the reaction or old message being received as a partial?
@earnest phoenix check if amount is greater than 300
Could you try logging the value before you fetch the reaction and message
To see if it does change or returns a new object
lets say i have this kind of object/array:
{"profiles":[
"a":{
"FinalPoint":"One"
}
"b":{
"FinalPoint":"Two"
}
]
}
and i wanted to print out a.FinalPoint and b.FinalPoint, without having to do that directly (like a foreach loop), how would this be done?
@drifting wedge I recommend you use IDs if you can reasonably do it, but you'd need to iterate over all cached channels to see if the name is equal to a string
If you tell us more info about what you're trying to do and how you're doing it we may be able to help more
like logging
@sudden geyser
ill use a db to store custom channels
but for now
ill just use a channel name
Is the channel name configurable by the user or is it pre-set by you. Like, the channel would have to be called logs and it would dispense logs there
Is the channel name configurable by the user or is it pre-set by you. Like, the channel would have to be called
logsand it would dispense logs there
@sudden geyser itll be preset
cuz i dont know how to use mango yet
@karmic compass that syntax is not correct in general. You might want to remove the array ([]) part and replace it with an object instead ({}). Then, you can do profiles.a.FinalPoint and so on
OExe what library are you using
@sudden geyser py
yep
discord.utils.find(predicate, seq) may interest you: https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.find
ok so i have channel
how would i make it like channel = channel_id of channel called logs
been busy making my traces prettier...
@grand finch how
As in you want to get the ID of the channel you found?
yes
@earnest phoenix
/**
* @desc returns a nicely ANSI coloured and formatted string that contains the stack
* Usually the stack is just a plain string with a bunc of '\nn\x20\x20\x20\x20's seperating it
*/
Object.defineProperty(Error.prototype, 'niceStack', {
enumerable: false,
configurable: false,
get() {
const stackFrames = this.stack.split(/\n\s+/);
let frame = -1;
return `\t${stackFrames.map((x) => {
let j = -1;
return `[${(++frame).toString(10).cyan}] ${stackFrames[frame].split('\x20').map((y) => {
if (frame === 0)
return y.yellow;
j++;
if (j === 0) /// 'at'
return y.grey;
if (j === 1) /// class and file
return y.yellow;
return y.replace(/\(([\x20-\x7E]+?)([^\/\\]+):(\d+):(\d+)\)/, (...k) => {
return `(${k[1].yellow}${k[2].cyan.bold}:${k[3].cyan}:${k[4].grey})`;
})
.replace(RegExp(process.cwd(), 'g'), '.'.cyan.bold);
}).join('\x20')}`;
})
.join('\r\n\t')}`;
},
});
Holy shit
By polluting the Error prototype 😄
I never thought of that
Also requires modules color and chalk but they also pollute the string proto
But they also wont dump colours out of the stdout isn't a tty which is neat
regex could be a lot better, currently most colours are just on splitting the stack dump by spaces (\x20)
After you find the channel with the util method I showed you, check if it's not equal to None. If it's not, get the .id property. Though, if all you need to do is send a message in that channel, you may be able to use the channel instance directly (<TextChannel>.send).
I also looked around a bit, and found the discord.util.get helper which can do the same thing but shorter.
Also requires modules
colorandchalkbut they also pollute the string proto
@grand finch chalk doesn't polute the string prototype to my knowledge
Oh right, maybe it's justcolors
yeah it is
channel = discord.utils.get(client.get_all_channels(), name='logs')
so like this would work?
or would it send it to all guilds?
Yeah that's one way of doing it, but I'd assume you want to restrict it to the guild the message was sent from
yep...
if role in ctx.message.author.roles and time < 300:
await ctx.send('Done')
role2 = discord.utils.find(lambda r: r.name == 'Level 2 Plan', ctx.message.guild.roles)
elif role2 in ctx.message.author.roles and time < 600:
await ctx.send('Done')
role3 = discord.utils.find(lambda r: r.name == 'Level 3 Plan', ctx.message.guild.roles)
elif role3 in ctx.message.author.roles and time < 1200:
await ctx.send('Done')
else:
await ctx.send('Time Limited Reach')```
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'role2' referenced before assignment
any idea why this error comes up?
Big F to 
If you have the guild you can do guild.text_channels to get all text channels from a guild
isnt available anymore, 
To be honest I'm glad the badge isn't being given out anymore
Big F to :developer:
@ionic dawn why?
Well, people like to collect badges
no more badges?
@ionic dawn why?
@drifting wedge Is not available anymore, discord said it 4 days ago, no1 will get the badge anymore
only for people who sended the verify before day 20
why tho
Yeah but collecting badges was the exact reason it got removed
Yeah but collecting badges was the exact reason it got removed
@sudden geyser exactly
channel = discord.utils.get(client.get_all_channels(), name='logs')
If you have the guild you can do
guild.text_channelsto get all text channels from a guild
@sudden geyser
Like, the fact they had to say extreme was alarming:
We’ve approved thousands of bots so far. As time goes on, the verification queue has become more and more filled with fraudulent submissions by individuals that are not submitting actual bots, but are going to extreme lengths to get a profile badge. These submissions are hindering the ability for legitimate bots to get verified in time for the deadline.
I already said how above: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/747261465181945890
and they are renaming the actual badge in the next update
i got that
but this is my code channel = discord.utils.get(client.get_all_channels(), name='logs')
how would i implement the guild
would it be channel = discord.utils.get(guild.text_channels.client.get_all_channels(), name='logs')
remove the .client.get_all_channels() part then try running the code to see if it works
channel = discord.utils.get(guild.text.channels(), name='logs')
imma try this
this is so wrong @client.event async def on_member_join() channel = discord.utils.get(guild.text.channels(), name='logs') await ctx.channel.send(f'Welcome {member}')
omega lul\
You can't make up properties/stuff. What you can use is listed on the documentation, like how you can't use an undefined variable.
i fixed it
channel = discord.utils.get(guild.text.channels(), name='logs')
await ctx.channel.send(f'Welcome {member}')```
i mean middle row still not working tho
Do you have a good understanding of Python
fixed up this nodejs stack dump
better formatted now
/** @desc returns a nicely ANSI coloured and formatted string that contains the stack */
Object.defineProperty(Error.prototype, 'niceStack', {
enumerable: false,
configurable: false,
get() {
const stackFrames = this.stack.split(/\n\s+/);
return `\t${stackFrames.map((curr, idx, arr) => {
switch (idx) {
case 0:
return curr.replace(/^([^:]*):?\s*(.*)$/, (...params) => {
return `${params[1].red} ${params[2]}`;
});
break;
default:
return curr
.replace(/^at\s*/, '\u2026') /// 'at' -> '\u2026'
.replace(/new ([^\x20]+)/, (...params) => { return `new ${params[1]}`.bold.blue; }) /// class instantiation
.replace(/(<\w+>)/, (...params) => { return params[1].grey; }) /// '<anonymous>' etc
.replace(/^\u{2026}([\x1b\x21-\x7E]+)\x20+([\(\[])/u, (...params) => { return `\u2026${params[1].yellow} ${params[2]}` })
.replace(/\[as\x20+(\w+)\]/, (...params) => { return `[as ${params[1].cyan}]`; }) /// '[as <things>]'
.replace(/\(([\x20-\x7E]+?)([^\/\\]+):(\d+):(\d+)\)/, (...k) => { return `(${k[1].grey}${k[2].cyan.bold}:${k[3].cyan}:${k[4].grey})`; }) /// path, filename, line, col
.replace(RegExp(process.cwd(), 'g'), '.'.cyan.bold); /// reldir
break;
}
})
.join('\r\n\t')}`;
},
});
lol, discord's syntax highlighter breaking a little bit there 😛
yes
how do i define guild?
im using an event
{guild.icon_url}
when i use ctx says i cant use ctx
message.author.createdAt
it's under the user class
oh
TypeError: add_field() missing 1 required keyword-only argument: 'name'
Ignoring exception in on_member_join```
getting this error
?
you can't add a field without a name..
what's your lang
I don't know py sorry
i finally finished my timerbot!
Im having an issue with the buy command which i want to 2 items but it's still buying one
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports = {
name: 'buy',
description: "buy command",
async execute(client, message, args) {
let prefix = 'h!'
let user = message.mentions.members.first() || message.author;
let author = db.fetch(`money_${message.guild.id}_${user.id}`)
if (!args[0]) return message.channel.send('What are you buying...?')
if (args[0] === "wand") {
if (author < 1) return message.reply(`You don't have enough money to buy this item`)
amount = args[2]
if (!args[2]) {
amount = 1
}
let embed = new Discord.MessageEmbed()
.setTitle(`Shop`)
.setDescription(`You have bought ${amount} wand`)
message.channel.send(embed)
db.add(`wand_${message.author.id}`, amount)
db.subtract(`money_${message.author.id}`, 1)
}
}
}
Here's the code
args 2 is the third message im assuming
prefix command args[0] args[1] args[2]
based on how you have the wand
what is args 1?

also args is a string
not sure if you db interprets string as an amount
how do i make bot without knowing java script?
i dont know how to code and never learned how
woah java?
you want a bot without learning how to code?
Pay someone.
Buy / bid for a bot.
Buy / Find some botmaker app online @sacred vigil
though this is for Development, we dont usually give any of those options for support here
also im fairly certain JavaScript and Python are the 2 most common bot langs
though thats just an assumption
Hmm i have just fixed my buy command but now i have an issue with my bal command
so i have 39 dollars originally in the bank then when i bought two items and checked my bal, it said i have 38 dollars
isnt that the intended way?
no
i mean
🧠
const Discord = require("discord.js");
const db = require("quick.db");
module.exports = {
name: 'bal',
description: "this is an bal command",
async execute(client, message, args) {
if (!message.content.startsWith('h!')) return;
let user = message.mentions.members.first() || message.author;
//let bal = db.fetch(`money_${message.guild.id}_${user.id}`)
let bal = db.fetch(`money_${user.id}`)
if (bal === null) bal = 0;
//let bank = await db.fetch(`bank_${message.guild.id}_${user.id}`)
let bank = await db.fetch(`bank_${user.id}`)
if (bank === null) bank = 0;
let moneyEmbed = new Discord.MessageEmbed()
.setColor("#FFFFFF")
.setDescription(`**${user}'s Balance**\n\nPocket: ${bal}\nBank: ${bank}`);
message.channel.send(moneyEmbed)
}
}
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports = {
name: 'buy',
description: "buy command",
async execute(client, message, args) {
let prefix = 'h!'
let user = message.mentions.members.first() || message.author;
//let author = db.fetch(`money_${message.guild.id}_${user.id}`)
let author = db.fetch(`money_${user.id}`)
if (!args[0]) return message.channel.send('What are you buying...?')
if (args[0] === "wand") {
if (author < 1) return message.reply(`You don't have enough money to buy this item`)
let amount = args[1]
if (!args[1]) {
amount = 1
}
let embed = new Discord.MessageEmbed()
.setTitle(`Shop`)
.setDescription(`You have bought ${amount} wand(s)`)
message.channel.send(embed)
db.add(`wand_${message.author.id}`, amount)
db.subtract(`money_${message.author.id}`, 1)
}
}
}
oh
you just setting amount
so i take away the 1?
you arent multiplying amount and price 
if you buy 1 or 20 wans its always going to be 1 money
because you're subtracting the price of 1 wand
Ohh
if something costs $2, and you buy 3 of it, that's 2 * $3 = $6 spent ➕
const Discord = require("discord.js");
const client = new Discord.Client()
module.exports.run = async (bot, message, args) => {
client.guilds.cache.forEach((guild) => {
message.channel.send(`${guild.name} Has a total of ${guild.memberCount} members`)
})
}
module.exports.help = {
name: "serverinfo"
}
why doesnt this send?
fyi you can export multiple things
what
module.exports = {
something: 2,
somethingelse: 3,
};```
^^
how does that help with the question?
with the question, not much, with the code and good practices, a bit
also you passing bot
why the heck you initiating a new client?
and that error is?
I didnt record it
I have this cat command but it keeps looping
const Discord = require("discord.js");
const randomPuppy = require('random-puppy')
//const cat = require("random-puppy")
//const event = randomPuppy.all(cat);
module.exports = {
name: 'cat',
description: 'This is a random command',
async execute(client, message, args) {
const event = randomPuppy.all('cat');
event.on('data', url => {
let embed2 = new Discord.MessageEmbed()
.setImage(url)
message.channel.send(embed2)
});
}
}
Which part did i do wrong
erm, thats a listener...
then you dont use listeners
you need a promissified call or something of the sorts
aka fetch an image, dont listen for an event
Wait I will try something
Is it this:
const Discord = require("discord.js");
const randomPuppy = require('random-puppy')
//const cat = require("random-puppy")
//const event = randomPuppy.all(cat);
module.exports = {
name: 'cat',
description: 'This is a random command',
async execute(client, message, args) {
const image = randomPuppy.all('cat');
randomPuppy()
.then('cat', url => {
let embed2 = new Discord.MessageEmbed()
.setImage(url)
message.channel.send(embed2)
});
}
}
const user = message.mentions.users.first();
let image
if (!user) {
image = message.author.avatarURL("", true)
return
}
else {
image = user.avatarURL("", true)
}
const Embed = new Discord.MessageEmbed()
.setImage(image)
when sending this it doesn't show gifs nor does just doing -avatar it doesn't set image to your pfp.
bruh
@pale vessel i set it to gif and that still didnt work.
Hmm my cat command doesn't work
how would i name this my command async def soft-ban
by naming it like that
@client.command(name="soft-ban")
async def softban(ctx, ....):
pass```
ty
@pale vessel i set it to gif and that still didnt work.
@solemn leaf if you still haven't figured it out, it's because that's not how you use the method, refer https://discord.js.org/#/docs/main/stable/class/User?scrollTo=displayAvatarURL (displayAvatarURL() is recommended for supporting default avatars)
thank
How do i mention someone in this inventory command
const Discord = require("discord.js");
const db = require("quick.db");
module.exports = {
name: 'inventory',
description: "this is an inventory command",
async execute(client, message, args) {
if (!message.content.startsWith('h!')) return;
let user = message.mentions.members.first() || message.author;
let inv = db.fetch(`wand_${message.author.id}`)
if (inv === null) inv = 0;
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`${user}'s Inventory`)
.setDescription(`Wands: ${inv}`);
message.channel.send(embed)
}
}
@earnest phoenix message.mentions.users.first()
okay
@pale vessel so can I just do webp for the file?
what did you name the let for it?
do
let user = message.mentions.users.first();
user.tag
@pale vessel so can I just do webp for the file?
@solemn leaf webp is default, you can just do displayAvatarURL() with no options
@pale vessel okay and this is hap[enin
TypeError: user.displayAvatarURL(...) is not a function
if you want it to support gif, add dynamic displayAvatarURL({ dynamic: true })
are you sure that's a user?
yes
it's probably user.user.displayAvatarURL(), try that
I have this error when he has only got 4 items
const Discord = require("discord.js");
const db = require("quick.db");
module.exports = {
name: 'inventory',
description: "this is an inventory command",
async execute(client, message, args) {
if (!message.content.startsWith('h!')) return;
let user = message.mentions.users.first() || message.author;
let inv = db.fetch(`wand_${message.author.id}`)
if (inv === null) inv = 0;
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`${user.username}'s Inventory`)
.setDescription(`Wands: ${inv}`);
message.channel.send(embed)
}
}
Here's the code
Why does that happen?
@pale vessel fixed but still gifs dont move
if you want it to support gif, add dynamic
displayAvatarURL({ dynamic: true })
@pale vessel
@solemn leaf Could you help pls
Bruh Aki told me to change it to user
oh
1 sec
Where is user defined
it's not defined lmao
And are you spoonfeeding @solemn leaf
Yes
idc if I am
You are
can you like relax
you know the rules and so do i
const Discord = require("discord.js");
const db = require("quick.db");
module.exports = {
name: 'inventory',
description: "this is an inventory command",
async execute(client, message, args) {
if (!message.content.startsWith('h!')) return;
let user = message.mentions.user.first() || message.author;
let inv = db.fetch(`wand_${message.author.id}`)
if (inv === null) inv = 0;
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`${user.tag.name}'s Inventory`)
.setDescription(`Wands: ${inv}`);
message.channel.send(embed)
}
}
you know the rules and so do i
@pale vessel never gonna give you up reference
No the tag doesn't work
What are you looking for
it should work
user- @ them
that would be user.username
If you do just user it mentions them user.id is there is and user.username does name
Cannot read property 'first' of undefined
it's users
That database is wrongly setup
users.first()
zzZ
oh it was id
@solemn leaf do you even know what you're explaining her
^
i don't think so
Then
@earnest phoenix do users.first() like flazepe said
That doesn't seem right
What’s wrong with it?
Why are you having problems with three lines of code
you said you wanted username
^
That doesn't seem right
@earnest phoenix your database is setup wrong
Hello
@earnest phoenix if you want it to ping do ${user.id}, @earnest phoenix Bcs im new to js
hi
@earnest phoenix your database is setup wrong
@earnest phoenix how?
@earnest phoenix if you want it to ping do ${user.id}, @earnest phoenix Bcs im new to js
@solemn leaf new to js and also trying to explain someone intermediate level of code
it's <@id> or user.toString() for mentions
@earnest phoenix how?
@earnest phoenix there is a key required in your database
then you would wrap it
there is no key
You can just do ${user}
if you put the user object in a template literal, you don't need toString(), it'll automatically convert to a mention
@earnest phoenix there is a key required in your database
@earnest phoenix wdym? I use quick.db tho
so everyone's inventory is literally the same
What is the problem
what's the problem @earnest phoenix
OMG MY EYES
quick.db stores data as seperate keys in separate databases
Dude light mode is the death of me
db.set("databaseName.keyName",keyValue);
this will save as:
databaseName
|_keyName: keyValue
@plain haven what is your problem? You have yet to state a problem
better discord
@solemn leaf breaking Discord ToS (ban hammer incoming)
@plain haven what is your problem? You have yet to state a problem
@blissful coral why
You sent a picture
No i don't have any error when i run the command
Do you need help
Huh?
Then what’s the problem?
The quantity of the inventory is the same?
If you send a picture here - without a context, how do we know if you have a problem?
^^ @plain haven
@earnest phoenix in your database are you setting it to per player
@earnest phoenix
Or for your embed are you just pulling the same thing
you are getting the wands of the person who sent the message
Wait so i change to money?
use the mentioned user's id instead, otherwise use the sender's id
that or message.author.id
okay but then it will show their id instead of name?
okay
oh right ^^ i noticed
^^^ bad practice
:)
use ids instead
He wants it for the title
someone can have same name
Hmm it's still showing the same amount?
For the title not db
Right?
@earnest phoenix send code
Do js at the start of your block please
It makes it easier to read
const Discord = require("discord.js");
const db = require("quick.db");
module.exports = {
name: 'inventory',
description: "this is an inventory command",
async execute(client, message, args) {
if (!message.content.startsWith('h!')) return;
let user = message.mentions.users.first() || message.author;
let inv = db.fetch(`wand_${message.author.id}`)
if (inv === null) inv = 0;
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`${user.id}'s Inventory`)
.setDescription(`Wands: ${inv}`);
message.channel.send(embed)
}
}
let inv = db.fetch(`wand_${message.author.id}`)```
you still are getting the wands of the person who sent the message
^^
yes?
It should be
let inv = db.fetch(`wand_${user.id}`)
okay
Okay
Did it work?
Yes it works. Thanks
Also I have a problem with my cat command. So basically when i do the command, it keeps looping
const Discord = require("discord.js");
const randomPuppy = require('random-puppy')
//const cat = require("random-puppy")
module.exports = {
name: 'cat',
description: 'This is a random command',
async execute(client, message, args) {
const event = randomPuppy.all('cat');
event.on('data', url => {
let embed2 = new Discord.MessageEmbed()
.setImage(url)
message.channel.send(embed2)
console.log(url)
console.log(url)
})
}
}
I want to fetch the image of cats instead of puppy
randomPuppy
.all
Change that
You have cat // out
And it is defined the same as puppy
Change it to cat
So randomcat?
Yes
ok
Pretty sure
But it keeps looping?
it's sending the same image over and over?
yeah, i'd imagine there's lots of cat images in a cat subreddit
So your send statement is in the loop
yeah
You need to get one
Instead of all
And make sure the send is outside the loop
Or it will loop it
Hiiii
it seems weird that that node package has a function that constantly spits out images
Yeah
i'd imagine getting just one image from that would be unnecessarily complex
wrong place
i'd imagine getting just one image from that would be unnecessarily complex
But im not sure how?
Y’all like my cat?
yes, but wrong place
there seems to be another way to use the api that grabs just one image
Well shit idk what anyplace is
Oh
yeah, you definitely should
how?
Is it the same way i do the meme command
go to that link, and u see JSON
u can do it for dogs and cats too
how?
r/dogs
r/cats
@restive furnace r/wooooosh
no
Oh
It says this when i run the command: TypeError: Cannot read property 'data' of undefined
const Discord = require("discord.js")
const got = require("got")
module.exports = {
name: 'cat',
description: "this is a cat command",
async execute(message, args) {
const embed = new Discord.MessageEmbed()
got('https://www.reddit.com/r/cats/random/.json').then(response => {
let content = JSON.parse(response.body)
let permalink = content[0].data.children[0].data.permalink;
let memeUrl = `https://reddit.com${permalink}`;
let memeImage = content[0].data.children[0].data.url
let memeTitle = content[0].data.children[0].data.title
let memeUpvotes = content[0].data.children[0].data.ups
let memeDownvotes = content[0].data.children[0].data.downs
let memeNumComments = content[0].data.children[0].data.num_comments
embed.setTitle(`${memeTitle}`)
embed.setURL(`${memeUrl}`)
embed.setImage(memeImage)
embed.setColor('RANDOM')
embed.setFooter(`👍${memeUpvotes}👎${memeDownvotes}💬${memeNumComments}`)
message.channel.send(embed)
})
}
}
And I use the meme code to replace cats
What do i do?
Can someone pls provide me with a list of essential bots needed in a server
Not the point of this channel
@earnest phoenix find the line it is happening on first and look at that line
ok
some lines are missing the ;
some lines are missing the
;
@modest crane that wont cause the error lol
content is undefinded
JSON.parse return promise
idk maybe that was the problem
JSON.parse doesn't return a promise?
I got it fixed.
Whats the cause
I haven't defined the data
What
I mean the data wasn't defined but i just fixed it
Btw for the inventory, when i do this, it shows mine instead of another person
that's because your command uses either the first mention, or the author of the message
And not id
With what do I have to define connection in line 3? https://hasteb.in/edajikav.coffeescript
.join
hello i,m added bot
Then what do i change
guys you know about this?
Discord has taken the decision to remove the verified bot developer badge and discontinue it from the verified bot program. The badge will still physically remain, but no one will be able to get the badge anymore. In the video, I will discuss why this has happened and the majo...
that announcement came out like 5 days ago
;///
what do you mean
aeon
and what lang?
javascript
are you talking about the color?
its .setColor(<your hex color>)
yw
or color: 0xkkkk if u use the object
i am using 0000ff
as hex code
@torn ravine
but
do i need to use double quotes?
so it’d be .setColor('<color>')
sorry
btw the code isn't working
by getting vps
Do I have to download it?
@weak parrot do the funny
no
then
-vps
its a vps
-vps
A VPS or virtual private server is a virtualized server instance run in the cloud. It acts like a normal server, allowing you to remotely login and manage it just like a physical server or computer. If you're looking for a way to keep your bot online 24/7, a VPS is a great option.
Having trouble choosing a VPS provider or don't know where to start? Click here for a list of common and affordable VPS providers.
what's vps 😅
heres explained ^^^
then u need to get rpi or smth
I wasted all my money on games.
Rip then
Now what's rpi??
not even 3€/month
Microprofessor
All vps's are for money?
I can't use it till the next 6 months.
I took all pcoket money from my parents for the 6 months
collectively.
Open your pc 24/7
@earnest phoenix not usefull
why?
Theres ntohing er can do
How will I open my pc for 24 hrs?
-_-'
Just turn ofr the monitor or something
nice guy or girl ^
I was joking
Yo rude
😁
I know
I am willing to hodt it on my Raspberry Pi
Btw y token is ILHGIHFBYIEGFIhiLHH657ILHHIGIg
But comr at cost of 1$ per month
it is Mzkzkzbbtnskbsbdn.Kdjjdvzbjzjdj.bdjidi.kdbsbskks
what's raspberry pi?
Yeah
how can I randomize functions? like
let string = [
value.fucntion(),
value2.fucntion()
]
Yes
It codt me 20$
It costs money to buy one
But i can hodt it on mine
It codt me 20$
@earnest phoenix u write s, d?
For the price of 1$ per month
Not sure if you should do that tho
Yeah
Like if u give access
I wont give access
Or you aren't gonna do that
Imma seee prices for vps.
how can I randomize functions? like
let string = [
value.fucntion(),
value2.fucntion()
]
let index = getRandomInt(strings.length)
let str = strings[index];
Why
Why are you doing that?
Heloo
I don't understand
why bcs I have a object and I want to run a function that loads soemthing
Hello guys
send me a website for vps.
@real nacelle https://contabo.com
German server provider | #VPS from €3.99 / mo | EU and US Locations available | 15+ years of experience | 70k+ happy customers | #hosting #cloud #infrastructure
thanks!
Ai am from português
@golden condor
why bcs I have a object and I want to run a function that loads soemthing
When i try adding another into my buy command and do the buy command, nothing shows up and there's no error either
i cant buy vps lol.
Hello hermione
hi
Harry potter kkkkk
@solemn leaf you can store individual functions in arrays and call them directly from the array
@slender thistle
@sonic lodge can I pull it fromt he array like the string?
I am going to do breakfast, boi boi!!
wdym
array.length
yes?
@bronze linden Keep this channel related to development please. Also, non-English in #memes-and-media
it's just an array of functions
When i try adding another into my buy command and do the buy command, nothing shows up and there's no error either
What has gone wrong in my code?
sorry i went away suddenly had skool
What has gone wrong in my code?
@earnest phoenix show the code
also are you experienced with javascript
@sonic lodge str.then
discord bot development is very not recommended for beginners
I have learnt the basic
like?
you are confusing me more
no
@earnest phoenix you need to await the .fetch
example
let func1 = () => Math.random();
let func2 = () => 10;
let arr = [func1, func2];
arr[0]();```
What the fuck is str.then
thanks @sonic lodge
oh okay
iirc
Bruh
and is it .fetch or .get ?
I haven't used quick.db in a while lol
Yes it is
Look at the code
it just doesn't work for the second one
cuz
Your database is setup wrong
keys
quick.db strictly needs em
no
Yes
that's not the whole problem
this line of code:
let author = db.fetch(`money_${message.author.id}`);
it is fetching everything
They said that the first one works.
my bot got error and i dont know how to fixit please help
my bot got error and i dont know how to fixit please help
@earnest phoenix show code
is there a limit for .addfeilds?
how can I fill a transparent image with white color instead of black, before sending it?
i send log
@earnest phoenix you need to learn javascript first before using quickdb
or developing bots
@bronze linden Please keep this channel on topic of development
@earnest phoenix I suggest that you use .get instead of .fetch and either way, you need to await it and also you just define amount in the second if statement
Have they changed it then?
@earnest phoenix please show your code
okay
use grasshopper by google
it is how i learnt js
Yes the problem will be because you didn't define it
go nuts
Dude
Please enable slowmode on this channel <@&304313580025544704>
then come back to bot development
const Files = require(require('path').join(__dirname, 'js', 'Main.js')).Files;
if(!process.send) {
Files.initStandalone();
} else {
process.on('message', function(content) {
Files.initBotTest(content);
});
}
here is the code
const Files = require(require('path').join(__dirname, 'js', 'Main.js')).Files;
if(!process.send) {
Files.initStandalone();
} else {
process.on('message', function(content) {
Files.initBotTest(content);
});}
@earnest phoenix require inside require
Speack português brasil??? ?
Dude
i making bot with dbm
Can you stop giving wrong advice
other languages are in #memes-and-media
That works fine
Can you stop giving wrong advice
@golden condor what's wrong with telling someone to learn js
I told you several times to move away from this channel @bronze linden
No just in general
ok...
Also this person clearly knows some js to be able to write the code and have it work
You're not being helpful by saying "learn X". Point them at the right resources instead
yeah ik
Exactly
alright
God have mercy on my soul
I agree
bismillah
@earnest phoenix what's amount in your code
wait
I will show again
you're using the variable for both the price and the amount the user gets
so no matter whta you do everything is sold 1:1
ohhh
No
yes it is
Also try it now you've added in amount
she's subtracting amount from the user balance
Yeah...
Am Harry potter
LOL
Hlo Hermione where is Ron
https://hastebin.com/zuyomokewo.js
i do not know what i am even doing anymore this has gone to shit
ugh here we go
get reaction
get corresponding json value
clear reactions
post to array
get new reaction
get corresponding json value
clear reactions
post to array
get messages
post to array
get new message
post to array
this is what i need to do
@earnest phoenix where is Ron
What is the problem. With it
okay so
Just a tip
There is a message.awaitReactions function
Which can be easier than collectors
mk
It's a promise btw
Im not sure if im doing it right but here's the code: https://hastebin.com/itedetuwoq.js
Is it still not working?
no
isNaN(args[1])
let amount = parseInt(args[1])
if(isNaN(amount)) amount = 1
I just wrote that on my phone but I think that's right
In both
Wait what casing are you using when you run it
can you add in a
} else return message.channel.send("Invalid Item")
okay
It says this: ReferenceError: amount2 is not defined But i have already defined it?
You can just call it amount
Np
Oh hmm when i try buying two items, it says invalid item?
?
hi
does any one here?
``` if (message.content.startsWith(${prefix}channel)){
if(!message.member.hasPermission(["MANAGE_CHANNELS"])) return message.channel.send("Sorry you dont permision to preform this command")
if(!args[0]) return message.channel.send('Please include a name for the channel after the command')
message.guild.channels.cache.create(args.slice(0).join(" "), {type: 'text'}), message.channel.send("Channel Successfully created")
}```
i made this so i can make channels using bot
but when i do //channel
it give me error instead of "Please include a name for the channel after the command"
nvm
i forgot the let args
ctx is used with canvas or discord.py
hi guys i was trying to host my bot on Heroku but it always crashed. When I start it through Visual Studio Code it runs just fine
Because you didn't put the token?
What error does it give




