#development
1 messages · Page 1459 of 1
Small How ؟
no im doing that
Add anything that's helpful
k
@earnest phoenix
I didn't publish it to npm, either mattthew did or krista
We need to work on it a lot
How to make a small writing of the word ؟
remove duplicate typings for ts
remove the package from public, its not ready nor you should be posting unfinished packages
add colaborator keys for the ones who will be editing it, keep main repo in github, not npm
remove those shit commits and add some consistency onto it with proper descriptive commits
Dont push shit that doesnt work, if its work in progress, keep it stashed in local and merge them once its fully finished
If yall keep going like that its going to turn into a meme and bring bad pr dude, its already bad as is
hehe
wait its null
@crimson vapor The caching properties are not defined by default on startup so it's undefined which would also be considered as false
@earnest phoenix if yall got a discord server you guys talk into, send that message above there
well, this ain't about development, kinda is and not at the same time:
I like Firefox, and how it consumes less RAM than Chrome, but Chrome has more ways to see customized JS. My PC isn't good enough to handle Chrome + Discord + Spotify + League of Legends all open
but with Firefox it handles quite nice
We don't have one, at least not yet lmao
is there any alternative for a browser?
then foward that to the members who are actively contributing, thats constructive critisicm,
we do and I was against publishing it
The properties are undefined, those properties such as channels is based off of those properties
or was it someone else
I need another answer 😦
It's an optional property which is not defined on start up, so undefined or in other words false
alr
making pr
wait
should I add myself to collaborators?
or nah since im not working
I really wonder if we should start rewriting the whole thing
dang
discussion about ourcord here? cool
well maybe not throw away everything
Yea i mean like, as we first knew what was wrong when starting the project now we would know how to make it better
Or maybe
What emojis
I didn't make that pull request template so idk, i think misly made that template
But it's optional

Million
loggers
Null => null
Yea, just edit the original commit
where is intents
idk im not dev
The lib is not ready yet, so it's not there
ok I edited the file
Guys, its weird. i can't use commands, only moderation commands.
But my code is ok
My bot started to lag out of nowhere. What can I do? I can't find the problem either.
your connexion q-q
if you're running the bot locally it's shard may disconnect and won't respond until it's connected again
q-p
but yea it's only a possiblity
@past needle guilds appear incomplete in stats if not connected
hey guys!
hey
if (name != "Egg") {
let var5 = Boolean(raid.ex_raid_eligible)
if (var5 = "true"){
let varz = reactionEmoji9
if (var5 = "false"){
let varz =
let text = `**${name}** | **${varz}** | **Boosted: **` + `${weatherString}` + "\n"```so i have written this code. I want the varz to not show if it isn't an ex raid. How would i do this?
because now it checks whether it is true, and it will send an emoji. If it is false i want it to be blanco.
i thought about writing: let varz = null
@misty sigil make an ourcord discord server please
could you help if you got time 🙂
We have one
send
=is for setting variables,==is a statement
https://pastebin.com/jeS89fnH
Guys, my code is good, but i can't use commands. only few commands.
I saved and restarted the bot...
Help me please..
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
okay.
appreciate it.
also you don't need to check if it is equal to "true" since you can just do if(varz)
okay but,.. how do i set it to 0 once it is false?
you need to set varz as ampty text just do varz = ''
Please help
ooowh yeah ofcourse. Thanks!
if (name != "Egg") {
let var5 = Boolean(raid.ex_raid_eligible)
if (var5 == "true"){
let varz = reactionEmoji9
}
else if (var5 == "true"){
let varz = ""
}
let text = `**${name}** | **${varz}** | **${weatherString}**` + + "\n"```this would ofc give varz is undefined.
but i don't know how to do it otherwise?
define it before the if statements
i cannot wrap the one statement in the other.
let varz = ''
ooowh okay got it

You don't need to redefine it remove the let just change the value varz = ""
Hello, this question will be a little more outside the code, but. About two weeks ago my bot started to be added to big servers eg 247k etc. recently an incredible lag appeared, even if the bot ping shows 16, it has an incredible delay. We cannot tolerate even a 1 second delay in our bot because everything happens in seconds, does anyone know or guess what a solution or problem is? Because we cannot detect the problem.
wait what why did they define the type again in the websocket file?
shouldn't you just import it from the d.ts file?
Well API latency isn't indicative of how well hardware can actually handle the thousands of events per seconds imo
okay, i have issues fixing it tho. js if (name != "Egg") { let varz = "" let var5 = Boolean(raid.ex_raid_eligible) if (var5 == "true"){ let varz = reactionEmoji9 let text = `**${name}** | **${varz}** | **${weatherString}**` + "\n" + `**${raid.gym_name}**` + "\n" + `*${lat1}, ${lng1}*` + "\n" + `**${reactionEmoji5}: ** ${raid.level} | **${reactionEmoji4}: ** ${raid.cp}` + "\n" + `**Distance From Last Raid: ** ${lastcoordinatez}` + " KM" + "\n" + `**${reactionEmoji7} **${move1[1]} | ${move1[2]}` + "\n" + `**Starts: **${getFormattedTime(raid.raid_start)} | **Ends: **${getFormattedTime(raid.raid_end)}\n` + `${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}ⓅⓄⓀⒺⒽⓊⒷ${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}` + "\n" let rawdata = fs.readFileSync("./data.json"); let channel1= JSON.parse(rawdata); let msg = await message.channel.send(text); await msg.react(reactionEmoji1); await msg.react(reactionEmoji2); await msg.react(reactionEmoji3);} } look, the problem is that it doesn't send an embed at all. It comes because the if statement is wrapping the whole code. I have no clue how to fix it.
@opal plank Don't know ts but you should do this right? Instead of declaring it again in the websocket.ts file #development message (context: ourcord)
<li class="nav-item">
<a class="nav-link" href="/me">Profile</a>
<li class="nav-item">
<a class="nav-link" href="/dashboard">Dashboard</a>
<li class="nav-item">
<a class="nav-link" href="/servers">Servers</a>
<li class="nav-item">
<a class="nav-link" href="/authorize/logout">Logout</a>
</li>
</ul>
<% }``` how do i remove the points
no, the whole point of d.ts is to automatically be picked up by the IDE
your let varz at the top have nothing you need to add something or just use let varz without the =
so let varz = " "
would work right
because it has a space
hmm okay i am trying the let varz
with nothing to it
still didn't work
even after addin text it did not work
I'm not on pc so I can't see your code well, I see just a bunch of text
what's d.ts, since i am working on one d.ts with a pretty big team
they add types to stuff like javascript files
d.ts is types
thats how you get intellisense and type checking for js packages
d.ts
declaration . types
its types for ts to be imported
wtf
bro
JSON?????????
JSON?!
Json > JSON
is it not Promise<Object>
or Promise<Array>
how would I be able to add a message to a embed
so like
message here
{cool af embed here}
so it can mention things'
message.channel.send("text here", embed)
oh ok thx
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'approve.png')
const embed = new Discord.MessageEmbed()
.setTitle(`${canvaUser.tag} got approved!`)
.attachFiles([attachment])
.setColor('#72e429')
message.channel.send(embed)``` why isn't the image in the embed? How do i fix this?
you gotta set the image to the attachment
i think it was something like
.setImage('attachment://approve.png')
aight
@mellow kelp i tried it. the image doesn't show though
How get approval
wait for a few days for the staff to check
about 1 month
about 9 days
dang u lucky
15 year old child bot
using dotEnv, got this: UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
Grundstücksvehrkehrsgenehmigungszuständigkeitsübertragungverordnung
you gotta use dotenv.config()
it loads the .env file
my code
hey, how would i access where they are taking the boosted from? nycpokemap.com
yea, I did that in the main bot file, but I didn't do that at his Dev version xD
🤦🏻♂️
oh lmao
i can't find where they are getting boosted from.
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'approve.png')
const embed = new Discord.MessageEmbed()
.setTitle(`${canvaUser.tag} got approved!`)
.attachFiles('attachment://approve.png')
.setColor('#72e429')
message.channel.send(embed)```
if its not there thats kind of a problem dont you think 
you added the .setImage right?
forgot xDDD
How can my bot fast approved
yes
you just had to add setImage()
I am indian
no way
don't change that attachFiles()

i did set image
// More stuff
.attachFiles([attachment])
.setImage('attachment://your-file.png')
with both
yes
oh okay
workin' fine now @mellow kelp. Time to test on Live ver.
thats poggers
Self role
not possible
Of bot
you just gotta wait
Wow! Thanks @pale vessel @mellow kelp it works!
poggers
@mellow kelp something like this will do
yea
👌🏻
poggersn't
nah
I did it in the local file
if you do they will actually appear on the variable itself
.env files have that syntax
but on heroku you set it just like that
well I tried to execute the Dev version with and without quotes
it's working the same
could anyone tell me where they are gettin the boosted from? The site is nycpokemap.com
i tried parsin the json but i couldn't find anythin useful.
Does anyone know how I can fix this issue
wdym the boosted?
Can I give link to of my bot to bot viewer se in this server
you see Windy (boosted)
your mongodb connection is probably not authenticated
$$help
just make the connection
make sure nothing is queried before the connection is complete
they are adding boosted to the current weather
Error: FFmpeg/avconv not found!
when did you install it
long time ago
and i wanna know how they check the weather and add boosted.
What's the mongo cmd for it
wdym
literally that i guess
just to put ffmpeg in the code?
Just run ffmpeg in console
anyone that could help, where is boosted coming from?
install ffmpeg
No, do you know what a command line is?
fucking powershell
lmfao
you have to install ffmpeg in your bot directory folder.
i did that as well
you shouldn't have to
none that knows?
what is this
anyone know what is !.
it is coming from a website
and they are adding weathername + (boosted)
and i am trying to figure out how to check if it's boosted.
i downloaded it, it shows it in the modules and still not working
how did you install it?
unless they explain (boosted) it shouldn't matter
but i need boosted
i only want the boosted to show
from the web
try reinstalling ffmpeg
no variable named boosted
because the weather doesn't concern me, i just need the boosted text to show.
@tardy hornet Try npm i ffmpeg-static
thats not how you install ffmpeg
hmmmm
it is how you install ffmpeg as package
Idk though its weird since there's different ways
it will also directly save it in your dir.
If you're on Linux you gotta install ffmpeg with sudo apt or something
anyways, none knows the answer yet on the question i sent?
Nope
ty worked
Nice
omg
anyone know how to make the embed thumbnail show as the pinged user? (discord.py)
you could just hit npm install tbh
sorry i only do js atm
Get the pinged user
does anyone do python
damn.
alr
yeah i had some random problems today too
which worked before
randomly stopped working
didn't update anything
just stopped working 😳
lol
maybe the language you were using had changes
either its not here or i cant find it
Don't
bad practice to commit your node_modules. package-lock.json and yarn.lock are accepted.
so i just delete it?
Yes
k
Heroku installs modules for you
what does vscode tell you? there should be a little modal that shows up explaining the error (correction: not a modal but a "popup")
hover over the red underline
yay thank u flaxepe
but flaze now when i do
node .```
it says this
PS D:\github\pepe-bot> node .```js
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'discord.js'
Require stack:
- D:\github\pepe-bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\github\pepe-bot\index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'D:\github\pepe-bot\index.js' ]
}
PS D:\github\pepe-bot> ```
Check your package.json
discord.js needs to be inside dependencies
Can you find a file named package.json?
here
yes
so how do i put it
Do you know what module your bot needs?
how have you installed your packages? have you used npm or yarn
nope
Check your code
Use npm i <module name>
That will put the module in your package.json folder
But you shouldn't push node_modules to your repo
For example npm i discord.js
}
PS D:\github\pepe-bot> npm i <module name>
At line:1 char:7
+ npm i <module name>
+ ~
The '<' operator is reserved for future use.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported
That will add discord.js to your dependencies in package.json
if(message.channel.type === 'dm'){``` how do i fix this?
the <module name> was a placeholder
whats on line 384
thx
for the "module name" of the installs you will make
so i have ```js
client.on('voiceStateUpdate', (oldMember, newMember) => {
let newUserChannel = newMember.channelID;
let oldUserChannel = oldMember.channelID;
if(newUserChannel === "779010277823741972")
{
console.log((`${newMember.member.user.username} Joined the vc `))
client.channels.cache.get('783262951955103754').send((`<@&785521742030307328> ${newMember.member} (${newMember.member.user.username}) has knocked on the office door`)) }
else{
console.log("Left vc")
client.channels.cache.get('783262951955103754').send((`no one opened the door so ${newMember.member} (${newMember.member.user.username}) left`)) }
}
)```
but i wanna make it if i drag it it doesnt send the ```js
client.channels.cache.get('783262951955103754').send((no one opened the door so ${newMember.member} (${newMember.member.user.username}) left)) }
is it possible to "Replace the last result"?
@clever pewter
Try else if (!newMember) instead of just else
If you drag, newMember won't be null
ok but u have to explain me how that works
When a member DC, newMember will be null since they left the VC
If you drag a member, newMember will exist since they only changed VC
o
So you would only say "member left" when newMember is null
So that picture is my console. Im trying to make a music bot well command I have it working joining the vc and then it stops working I Have ffmpeg installed but idk
ty in advance
const Discord = require('discord.js');
const { connect } = require('snekfetch');
const ytdl = require('ytdl-core');
module.exports = {
name: 'play',
description: 'play command',
execute(message, args){
const voiceChannel = message.member.voice.channel
if(!voiceChannel) return message.channel.send("You need to be in a channel to play music")
const premissions = voiceChannel.permissionsFor(message.client.user)
if(!permissions.has('CONNECT')) return message.channels.send('I dont have the permissions to connect to the voice channel')
if(!permissions.has('SPEAK')) return message.channel.send('I dont have permissions to speak in the channel')
try{
var connection = await voiceChannel.join()
}catch (error){
console.log(`There was an error connecting to the voice channel: ${error}`)
return message.channel.send(`There was an error connecting to the voice channel: ${error}`)
}
const dispatcher = connection.play(ytdl(args[1]))
.on('finish', () => {
voiceChannel.leave()
})
.on('error', error => {
console.log(error)
})
dispatcher.setVolumeLogarithmic(5 / 5)
}
}
wait wat where do i put it?
ah ty
let z = ""
if (isRaidBoosted(raid)) {
let z = "BOOSTED"
let text = `**${name}** | **${varz}** | **${z}**` + "\n"
+ `**${raid.gym_name}**` + "\n"
+ `*${lat1}, ${lng1}*` + "\n"
+ `**${reactionEmoji5}: ** ${raid.level} | **${reactionEmoji4}: ** ${raid.cp}` + "\n"
+ `**Distance From Last Raid: ** ${lastcoordinatez}` + " KM" + "\n"
+ `**${reactionEmoji7} **${move1[1]} | ${move1[2]}` + "\n"
+ `**Start: **${getFormattedTime(raid.raid_start)} | **Ends: **${getFormattedTime(raid.raid_end)}\n`
+ `${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}ⓅⓄⓀⒺⒽⓊⒷ${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}` + "\n"
let rawdata = fs.readFileSync("./data.json");
let channel1= JSON.parse(rawdata);
let msg = await message.channel.send(text);
await msg.react(reactionEmoji1);
await msg.react(reactionEmoji2);
await msg.react(reactionEmoji3);
}
}
}``` it doesn't send the text because of the if let z statement
does anybody know how to fix this
const user1 = message.mentions.users.first()
const user2 = message.mentions.users[1]``` i want the author to mention 2 people. how?
how do u get ffmpeg on heroku?
ffmpeg doesn’t really work on heroku
i think you can add a buildpack
am i doing something y this keeps hapening
well im fucked
here it is
const [user1, user2] = message.mentions.users
add that to buildpacks
It won’t work well
should work
I’m warning you
okay
it worked for me tho
never destructured an array before 
I do it for objects
const [command, ...args] = message.content.split(/\s+/);
smart tbh
so i have ```js
client.on('voiceStateUpdate', (oldMember, newMember) => {
let newUserChannel = newMember.channelID;
let oldUserChannel = oldMember.channelID;
if(newUserChannel === "779010277823741972")
{
console.log((`${newMember.member.user.username} Joined the vc `))
client.channels.cache.get('783262951955103754').send((`<@&785521742030307328> ${newMember.member} (${newMember.member.user.username}) has knocked on the office door`)) }
else{
console.log("Left vc")
client.channels.cache.get('783262951955103754').send((`no one opened the door so ${newMember.member} (${newMember.member.user.username}) left`)) }
}
)```
but i wanna make it if i drag it it doesnt send the ```js
client.channels.cache.get('783262951955103754').send((no one opened the door so ${newMember.member} (${newMember.member.user.username}) left)) }
let z = ""
if (isRaidBoosted(raid)) {
let z = "BOOSTED"
let text = `**${name}** | **${varz}** | **${z}**` + "\n"
+ `**${raid.gym_name}**` + "\n"
+ `*${lat1}, ${lng1}*` + "\n"
+ `**${reactionEmoji5}: ** ${raid.level} | **${reactionEmoji4}: ** ${raid.cp}` + "\n"
+ `**Distance From Last Raid: ** ${lastcoordinatez}` + " KM" + "\n"
+ `**${reactionEmoji7} **${move1[1]} | ${move1[2]}` + "\n"
+ `**Start: **${getFormattedTime(raid.raid_start)} | **Ends: **${getFormattedTime(raid.raid_end)}\n`
+ `${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}ⓅⓄⓀⒺⒽⓊⒷ${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}${reactionEmoji6}` + "\n"
let rawdata = fs.readFileSync("./data.json");
let channel1= JSON.parse(rawdata);
let msg = await message.channel.send(text);
await msg.react(reactionEmoji1);
await msg.react(reactionEmoji2);
await msg.react(reactionEmoji3);
}
}
}```this does't send the text. It is coming from the if (isRaidBoosted(raid). If i close the }, it will send, but as you can see i moved it all the way under the code.
else if (!newMember){
console.log("Left vc")
client.channels.cache.get('783262951955103754').send((`no one opened the door so ${newMember.member} (${newMember.member.user.username}) left`)) }
}
)```
it doesn't send anymore
and this doesnt work
Hey, so i was just coding my bot. The code worked just fine minutes ago. I did npm i that updated some packages and i started getting this error.
Half of my code just doesn't work now and throws this error 😦
do you use mongoose?
make sure you're not assigning a variable to the wrong type
where?
In schema or the code
only change in the schema i've made today is this and i don't see any issues with it
when you save a doc
I go here and then paste the link for ffmpeg on heroku right? am I dumb or am I super dumb
Did you do automatic debugging
no?
Ima try deleting the doc and creating one again
maybe it'll work automatic debugging
created methods in single files should be called into other files with module.exports right? JS btw
Aight yeah i think i messed up my document
I tried in another guild with another guild config document
it worked fine
👀
module.exports => export
require() => get
ikr
Deleted and created the document all working! Thanks million

loggers
Typescript is acting crazy... it says "player is possibly undefined" but it cannot be...
module.exports and interopability is very confusing lmao
LOL ik why
you sure Player always returns a player?
new Player() might return null likely
It's a constructor... constructors always return an instance of a class...
Yea i guess
it's just wrong
can't you return something else in it
but isnt it possible otherwise
no
well
hmm
are the typings correct?
anyone know how to send the discord server's thumbnail in an embed? discord.py
check the docs
oh 🤦♂️
well
the magic of javascript
im testing and it always returns false lmao
so in case user is undefined i guess youre good to go anyways
Yes quick.db can push arrays however when words are pushed its already in an array form so if I push 2 words it doesn't separate them so I would need to say "word1,word2,word3" for the bot to detect it
why do you think im here
can you separate them?
Maybe but I'm not sure how
Since by default the db logs them like that
They get logged as [ 'word1', 'word2' ]
And I guess the word no gets logged as null for some reason
2020-12-16T19:30:44.280859+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
const Discord = require('discord.js');
const { connect } = require('snekfetch');
const ytdl = require('ytdl-core');
module.exports = {
name: 'play',
description: 'play command',
async execute(message, args){
const voiceChannel = message.member.voice.channel
if(!voiceChannel) return message.channel.send("You need to be in a channel to play music")
const permissions = voiceChannel.permissionsFor(message.client.user)
if(!permissions.has('CONNECT')) return message.channels.send('I dont have the permissions to connect to the voice channel')
if(!permissions.has('SPEAK')) return message.channel.send('I dont have permissions to speak in the channel')
try{
var connection = await voiceChannel.join()
}catch (error){
console.log(`There was an error connecting to the voice channel: ${error}`)
return message.channel.send(`There was an error connecting to the voice channel: ${error}`)
}
const dispatcher = connection.play(ytdl(args[1]))
.on('finish', () => {
voiceChannel.leave()
})
.on('error', error => {
console.log(error)
})
dispatcher.setVolumeLogarithmic(5 / 5)
}
}
Im just trying to fix my .play command I think its .play command idk if its play or stop command
good point
In js its message.guild.iconURL so it may be similar to that for py? @little anvil
@crimson vapor do you have any ideas for how to solve my problem?
split the words before you push to the db
its similar, supposedly its guild.icon_url but it isnt working when i add ctx
But it may log them as an array again
So splitting before logging wouldn't work
I need to split during the fetching part
yeah
Gotta figure that out somehow
split them then forEach push
Aight
Whatcha mean?
this is an embed
I'm trying to make the thumbnail into the top right corner
but it wont make it the server icon
and it's recognizing guild as apart or icon_url
What do the docs say?
the docs don't really say things about it
Hmm
they just mention the variable once or twice
Try to str() icon_url
show your code pls
so i have ```js
client.on('voiceStateUpdate', (oldMember, newMember) => {
let newUserChannel = newMember.channelID;
let oldUserChannel = oldMember.channelID;
if(newUserChannel === "779010277823741972")
{
console.log((`${newMember.member.user.username} Joined the vc `))
client.channels.cache.get('783262951955103754').send((`<@&785521742030307328> ${newMember.member} (${newMember.member.user.username}) has knocked on the office door`)) }
else{
console.log("Left vc")
client.channels.cache.get('783262951955103754').send((`no one opened the door so ${newMember.member} (${newMember.member.user.username}) left`)) }
}
)```
but i wanna make it if i drag it it doesnt send the ```js
client.channels.cache.get('783262951955103754').send((no one opened the door so ${newMember.member} (${newMember.member.user.username}) left)) }
```js
else if (!newMember){
console.log("Left vc")
client.channels.cache.get('783262951955103754').send((`no one opened the door so ${newMember.member} (${newMember.member.user.username}) left`)) }
}
)``` ^^doesnt work
@bot.command(name='serverinfo', help='Information on your current server.')
async def support(ctx, *args, user: discord.Member = None):
if user is None:
user = ctx.author
icon_url = ctx.guild.icon_url
embed = discord.Embed(title="**Server Information**", color=0x0d48a6)
embed.set_footer(text=f"ID: {user.id}")
embed.set_thumbnail(url=str(icon_url)(format="png"))
removed portion
await ctx.send(embed=embed)
@sudden geyser
str(icon_url)(format="png")
alr
You're trying to call a str. The first set of parentheses initializes the str class.
@earnest phoenix it would be easier if you provided more context, any errors you have, whats supposed to happen and isnt happening etc.
The second one is to call it like a function, which a class instance isn't one.
I already explained the issue.
@earnest phoenix it doesn't have permission to send a message to that user
looks like the user has your bot blocked, or dms off @earnest phoenix
i'm that user.
do you have dms off?
@sudden geyser invalid syntax
May I ask if you have a good understanding of Python.
im sort of new
I'm about to lose my mind
arent we all
don't worry you can always buy a new one
🥰 yes indeed
Not when my ass is poorer than the entirety of Africa
mood
oh wait i found what's wrong
i used client.user.fetch();
lol
i fetchs the bot's ID
i believe
what
str() returns a string, which can't be called as a function
you could use guild.icon_url_as
"hi"()
hey nerds
misly wtf is that pfp
Yeah well no shit
Message.guild
😹
No Goose
python works like that?
You're wrong too
lets do some poothon code
@main trench it recognizes .guild. as apart of icon_url
Mr. dootdoot you may want to spend more time learning Python.
It's ctx.guild
Interesting
@misty sigil wanna watch me do python
Oh no
ok
I'm out of here, bye
go to palace
Ah python is weird
@slender thistle
Oh cool
Just google how to use str()
shivaco im great python developer
Another Python dev giving up because they didn't take their time to learn Python
I'll fucking murder you Misly
gonna watch you
/* eslint-disable require-jsdoc */
module.exports = {
name: "redeem",
aliases: [],
async execute(client, message, args) {
const timer = new Map();
if (timer.get(message.author.id) < Date.now() || !timer.get(message.author.id)) {
timer.set(message.author.id, Date.now() + 86400000);
return getPrize();
} else if (timer.get(message.author.id) > Date.now()) {
return message.channel.send("cooldown message");
}
function getPrize() {
const counts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const prizes = ["prizes here"];
const ran = Math.floor(Math.random() * counts.length);
switch (ran) {
case 1:
case 2:
case 3:
case 4:
case 5:
message.channel.send(prizes[0]); // the least rare prize
break;
case 6:
case 7:
case 8:
message.channel.send(prizes[1]); // the second rarest prize
break;
case 9:
case 10:
message.channel.send(prizes[2]); // the rarest prize
break;
}
}
},
};
```super tired right now, but can someone tell me why its not returning because of the cooldown? (ignore the getPrize function, i know the array has a len of 0 but my client is putting more stuff, thats not the issue right now)
You shouldn't create the timer inside the execute function.
You need it to live longer than the command's execution.
Its weird as far as you need to specify a whole lot more then js
So you should move it to a higher scope.
You should also check if the user is in the timer before you see if the time is before the current date in ms.
@pure lion do ourcord
@honest perch i need help
yes so do ourcord
fine
start rest
const Discord = require('discord.js');
const { connect } = require('snekfetch');
const ytdl = require('ytdl-core');
module.exports = {
name: 'play',
description: 'play command',
async execute(message, args){
const voiceChannel = message.member.voice.channel
if(!voiceChannel) return message.channel.send("You need to be in a channel to play music")
const permissions = voiceChannel.permissionsFor(message.client.user)
if(!permissions.has('CONNECT')) return message.channels.send('I dont have the permissions to connect to the voice channel')
if(!permissions.has('SPEAK')) return message.channel.send('I dont have permissions to speak in the channel')
try{
var connection = await voiceChannel.join()
}catch (error){
console.log(`There was an error connecting to the voice channel: ${error}`)
return message.channel.send(`There was an error connecting to the voice channel: ${error}`)
}
const dispatcher = connection.play(ytdl(args[1]))
.on('finish', () => {
voiceChannel.leave()
})
.on('error', error => {
console.log(error)
})
dispatcher.setVolumeLogarithmic(5 / 5)
}
}
2020-12-16T20:07:00.201215+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
Im trying to make a music bot but im getting an error on my !play command and no music plays :L
I'm using mongoose and I want to save something like this in schema
{
userid: "someid",
items: [name: "Name", qty: "Quantity"]
}
Basically, add items and their Quantity
Or
Items: { item1 , item2 }
@midnight viper does the module you use have docs?
I dont think so?
how do i get that page
rn im just trying to make it work and then understand what the code does
that my plan rn
Since the error is saying it needs to receive a string but it received nothing
@lone ermine what page?
@earnest phoenix whats the error
the umm the programing and how to make a bot
For coding a bot id recommend the app visual studio code and I can link some beginner tutorials in dms if you like
every developer knows notepad is the best editor
lol
message.author.id
Depends on the library you're using.
discord.js. but that makes sense
idk why it doesn't work when i put any message after the command
Check if the message starts with the string.
Not if the message content is the string.
ah?
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
The startsWith() method determines whether a string begins with the characters of a specified string, returning true or false as appropriate.
Lmao
can someone please help?
it cant find the file its looking for
const rolePermissions = role.permissions.serialize();
is there a way i could check if for example KICK_MEMBERS is true and then proceed a statement
ENOENT
E: error
NO: no
ENT: entry
@slender wagon you want to check if KICK_MEMBERS is true and then do something?
yes
anyone here kind enough to give me ideas for a command that will allow me to get the bot whitelisted for SERVER MEMBERS INTENT 
if (member.hasPermission("KICK_MEMBERS")) { /* code */ }
the thing is i am checking for role permissions
like
check the role if it has certain permissions
how do i make a deny permission override on a channel for a role
lol
you mean the role without the user
yes
it is for a lock command i am doing, basically i need to check if the channel is already locked and then send a message
but it doesn't look that easy, (i don't wanna use a database)
just wanna see if there is a way i could fetch a role and see if it has certain permission
role.permissions.has()
i think i tried that
but i'll give it another try
thanks
bruh, before i was trying hasPermission
@pure lion thanks a bunch
@slender wagon no worries
@main trench i did it but i cant do it ahhhh. Can someone try do it for me please.
Can someone code a bot for me pls
@everyone
did you just try to-
i tried to code one but i cant do it
so if I want to use https://iro.js.org/colorPicker_api.html this api, do I just require it, then use it like I do the Discord api?
First 500 people will get 2 months of Skillshare free: https://skl.sh/polymatter4
Patreon: https://patreon.com/polymatter
Twitter: https://twitter.com/polymatters
Reddit: https://reddit.com/r/PolyMatter
Discord: https://discord.gg/polymatter
It’s become popular to encourage anyone and everyone to code. But there simply won’t be unlimited deman...
Bully : D
No its facts @fallow swallow
do you are have stupid?
Clearly 
...
can somone answer my question and not argue with each other
#lazy js if (message.channel.name.includes(':lock:')){ return message.channel.send(`#${message.channel.name} has already been locked!`) } i ended up using this after i got tired of trying lmao
Anyone know what the best cloud service provider is for a MongoDB Atlas?
try harder
can anyone help me make a vote command
What do you need with about it?
trying to use get_user_vote and its just not going past that line of code
it runs but doesnt error and just sits on that line doing nothing
well its more voterewards i wanna do than vote
Any of them should be good
I would recommend AWS though
I think they have different free tier regions tho
Yep I went with AWS. Pretty good so far
Anyone wanna make a bot with me?
nah
no
whats the method to remove more than one element at the start of an array?
What language.
.splice(index, amount, ...elementsToAdd)
It mutates the array.
So it doesn't return a new one.
Just modifies the existing one.
Array.prototype.splice() returns the elements removed
ah
And modifies the original array
that's the answer I was looking for
oh wait @earnest phoenix
.slice() (not splice), actually returns the array without the removed elements
I just checked my code, and I actually forgot I had used it once
Omegalul
but it'll remove the number of elements always from index 0
like .slice(2) removes 0 and 1 index values
🤦🏻♂️ xD
You tried to do something you don't have access to. The stacktrace is not helpful so you'll have to debug your way through it step-by-step.
Missing access is a variation of discordapierror, it's thrown when a bot can't read a certain channel
Duck type your way through it. Log the state (either with breakpoints or console.log) and see if something is erroring before the log is produced.
if GuildMember.premiumSinceTimestamp changed would it trigger a guildMemberUpdate event?
I can't test it as I've already spent $12 on boosts within the past few days
\u200b
Yes
epic
Having issues with Gateway intents and discord.py, I have enabled intents in my code as well as on the developer pannel. My current intents code is ```py
intents = discord.Intents().all()
intents.members = True
bot = commands.Bot(command_prefix= ".", case_insensitive=True, Intents= intents)``` I get no errors although the members command gives the members from the last bot restart. Does anyone know why this is, I am using {ctx.guild.member_count} to fetch member counts.
op, ok that did error
fixed?
ah ok, yes that makes sense, the error is I dont have all of the intents enabled on the dev portal, thankyou! (you where right about the caps)
oh ok
method is when the function belongs to an object
I think method is for functions called from classes and functions are not attached to anything
function is for some random function out there
that's why
it'd make more sense if u come from some language like java
everything there is methods
i dont think that would make more sense
sounds like that would make less sense lol
and then when I use function in JS, boom, mind blow
i think he understands what it is now
"this is a F", lmao

F for that function
wdym?
i mean, you just create a function
like this
but I'm using the same for different files
aight
cuz I used module.exports for the commands
don't know if it works the same way
It says member is not defined anyone know why?
and right down you have:
the declaration need to be before
wait a min. no
forget what I just said
you mean message.member.hasPermission()
yep, he didn't import member
so do put
message.member.hasPermission()
yes
before
you replace
not that
yeah
oh ok ty you
ok
also let member = message.mentions.members.first()
@hollow sedge I have a problem
what
I used exports inside the function file
then I used require in the command
and says it's not a function
maybe I got confused
whats ur code
function slugify(str) {
const map = {
'-' : ' ',
'a' : 'á|à|ã|â|ä|À|Á|Ã|Â|Ä',
'e' : 'é|è|ê|ë|É|È|Ê|Ë',
'i' : 'í|ì|î|ï|Í|Ì|Î|Ï',
'o' : 'ó|ò|ô|õ|ö|Ó|Ò|Ô|Õ|Ö',
'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü',
'c' : 'ç|Ç',
'n' : 'ñ|Ñ',
};
for (const pattern in map) {
str = str.replace(new RegExp(map[pattern], 'g'), pattern);
}
return str;
}
exports = { slugify };
Maybe show us the error + stacktrace
this is slugify.js
hold on
What in the god's name
you gotta do module.exports = slugify
so like this?
@earnest phoenix also let member = message.mentions.members.first()
you got two variables with the same name
i did
me? where
oh
i meant the other guy
remove it
what I mean is replace this with message.member.hasPermission()
fixed it, I still have a lot to learn about Node.js
I just started learning it in June
ESmodules are so much simpler tho
export default slugify
import slugify from './slugify';
but they don't work straightforward with node
yea those don't work on commonjs modules
if you wanna do that you have to change the extension
.mjs
yeah well typescript works with es modules
export keyword works differently in js and ts
i'd say just stick to module.exports and require while using node
its about es modules and commonjs
Either use module.exports or just exports
Both are the same
oh cool
is
module.exports = { foo };
the same as
module.exports = foo;
?
No
why?
let foo = "bar";
module.exports = { foo }; // { foo: 'bar' }
module.exports = foo; // bar```
ah yes, makes sense
yea
so what about module.exports = foo();?
you would be exporting the return value of that function
since I have a function
after writing the function I could just do module.exports = function();, right?
let foo = () => "bar";
module.exports = foo(); // bar```
if you want to just export what the function returns, yes
yeah
i may have found a way to DM random users of discord
If you want to export the function itself to use it in other files
using a bot
Export it without invoking it
what
wha-
how would you randomly dm people
like
randomly build an ID?
i dunno all i know is am not using it
you know functions are basically another variable type right?
you can export functions to use them on another file
i think everyone could do that
but it works and it's possibly a discord bug
Using random snowflakes is not a discord bug
bruh i could DM server invite links to over 2000 random people, thats self promotion so it is a bug
you wouldnt be able to
yea
How is a user, using random snowflakes to make API requests a discord bug?
actually you might be
unless they aren't creating the random snowflakes but rather getting them from discord i don't think it is
Using a snowflake doesn't matter from where it's, it's not a discord bug
so that means I am invoking the function while exporting when doing module.exports = function();
Yes
so i should still use module.exports = { function };
i mean you'll get banned from discord and probably get ratelimited
No
