#development
1 messages Β· Page 1100 of 1
@quartz kindle
which library
u here ?
d.js
i said no, he dms me anyway
lol
.>
you're not loading the fonts anywhere
ok but when using .timestamp where do you put it
on the embed
but where?
you're not loading the fonts anywhere
@quartz kindle how to do it ?
anywhere
like message.timestamp
would it be message.embed.timestamp or message.timestamp or wat
@hardy steeple .setTimestamp() in embed constructor
or how
on the embed, not the message
k
oh k
im gonna be coming back here and asking a bunch of stupid questions

still + got this
registerFont('Burbank Big Condensed Black.ttf', {family: 'Comic Sans'})
is it right ?
That's not a path
thats not the path
../
if its at ../
why is it looking for fortnite fonts tho
registerFont('./assets/fonsts/Burbank Big Condensed Black.ttf', {family: 'Comic Sans'})
ctx.fillStyle = "white";
ctx.font = "50px Fortnite";
var text = ctx.measureText(name)
var where = 261 - (text.width / 2)
You need to set the family to Fortnite
if you want to use the font as "Fortnite", you need to define it as such in the family field
are you generating more than 1
yes
code?
you're only saving one
you're saving only the last one
how to make it all ?
dont create a new canvas for each item
you're creating a new canvas inside the forEach loop
so for each item, a new canvas is created
how
How what
did you copy and paste this code?
dont create a new canvas inside the loop
create it outside
so all items use the same canvas
also, you're drawing all images at position 0x0
you need to calculate where each image should be based on how big is it
you're already doing it with your x and y variables, but you're not using them
Traceback (most recent call last):
File "discord_bots/invite-used/invite_used.py", line 1, in <module>
import discord
File "/home/zander/.local/lib/python3.6/site-packages/discord/__init__.py", line 23, in <module>
from .client import Client
File "/home/zander/.local/lib/python3.6/site-packages/discord/client.py", line 34, in <module>
import aiohttp
File "/home/zander/.local/lib/python3.6/site-packages/aiohttp/__init__.py", line 6, in <module>
from .client import BaseConnector as BaseConnector
File "/home/zander/.local/lib/python3.6/site-packages/aiohttp/client.py", line 30, in <module>
from yarl import URL
File "/home/zander/.local/lib/python3.6/site-packages/yarl/__init__.py", line 1, in <module>
from ._url import URL, cache_clear, cache_configure, cache_info
File "/home/zander/.local/lib/python3.6/site-packages/yarl/_url.py", line 56, in <module>
@rewrite_module
File "/home/zander/.local/lib/python3.6/site-packages/yarl/_url.py", line 132, in URL
_QUERY_PART_QUOTER = _Quoter(safe="?/:@", qs=True, requote=False)
File "yarl/_quoting.pyx", line 192, in yarl._quoting._Quoter.__init__
TypeError: __init__() got an unexpected keyword argument 'requote'
TypeError: __init__() got an unexpected keyword argument 'requote'
What does this mean? Could it be because I'm using python3.6?
This occurs on running my bot
most likely it means "requote" is wrong
I have no such thing in my code
.
a package called "yarl" is calling a function named "_Quoter"
and giving it invalid parameters
I'm not calling that, discord.py is doing that
File "/home/zander/.local/lib/python3.6/site-packages/discord/__init__.py", line 23, in <module> from .client import Client
there seems to be a SO solution for this
I recently updated discord.py due to an error outlined in this post and after updating it I can no longer import it.
Running import discord brings up the following error:
Traceback (most recent cal...
Huh well I upgraded to python3.8 anyway
Who knows mongodb (nodejs)?
what do u need?
\πΊπΈ
its just :us_america:
this not good
type this and copy \:flag_us:
coll.updateOne({'id': 1234}, { $set: { 'settings': {'option1': true}}})
How do I update 'settings' without deleting it?
yeah what he said
wdym ?
try it in vsc is not working
you just need to put in vsc
just use :flag_us:
@quartz kindle
:flag_us:
flat ?
typo
Um I think I have broken something... Im using ctrl+c to make my bot go down however its doing nothing for like the past 10 minutes lmao
ah nvm 10 minutes later.
Also if somebody could send me the docs. Would be nice.
oh nvm
@void vale i know it. i use mongoose
it's me or shoukaku have issues searching some songs? I can't search Thomas the tank engine on youtube
maybe the dev of the package got some wired issues with some stuff
π€
@lusty quest thx.
coll.updateOne({'id': 1234}, { $set: { 'settings.option1': true}})
hey can someone help me make a random cats or dog order etc ... plz in basic plz mp me ^^
like randomize an array?
well, what data structure do you have with your cat images?
@rain prairie thecatapi.com
Okay thx
so im genning an image
and its working
but im trying to send my self to it
how would i do that
send yourself?
res.end(buffer,'binary')```
yep just noticed
try this 
I'm not sure how that's related to the error
Express should set those automatically
and .sendFile already ends the request
It's working on my API ;/
@earnest phoenix what does that even do
He doesn't need to

I mean, sending the binary data is always better, I guess, there's no need to save the image
hello
does anyone know how i can fix the error vsc is giving me
trying to make a post request to my local api
I think you missed two " but not sure
i put cont and it auto filled it and i just had to put the type, lemme try tho
same thing
how to add another image behind this
put down the background image first, the same way you put the other images
let john = await loadImage(`./assets/images/rarities/${rar}_Border.png`)
ctx.drawImage(john, x, y, 256, 256);
@solemn latch
like this
yeah sure, that image will be at x,y 256x256px
Hi! I currently have braces and want to develop an app to put on my phone as I'm going on vacation wich will calculate how long I've worn it and my average etc. Now I have an iPhone and I've heard it's hard and costs money to put ur app on the app store now I was wondering if there is a way to put my app directly on my phone without needing to put it on the app store?
I think so with some xcode magic
and is there any certain language required to make an app for iOS?
ah the problems with iphone π¦
I don't remember the exact process (and I'm thinking of if you were to develop it with something like Xcode swift), but it had something to do with building a project but instead of running a simulator on your computer, you would run it on your phone instead.
So I would need Xcode swift to develop the app?
XCode supports C++ and Obj-C too.
or you could make a site that just does a bit of math and add it to your home screen
saves you time and effort
But also when I'm like 100+ kilomitors away form my pc?
Oh yeah
Website would be better actually
But
Won't I need a domain? To access it from my phone?
idk how to use glitch
Me neither lol
glitch is perfect for this
And imma store my stuff in a JSON as I'm the only one who uses it
@earnest phoenix
Why'd u tag him?
you don't need to store anything in a json tho
wanted to dm me ig
you can just make a function chat calculates the time difference from that time to now
But i need to store how long I've had it in
Yes
But I need to calculate an average over the time
Date.now() - (the date when u got them on)
Lets say O have 60 hours in 4 days it needs to calculate these 60 hours over the 4 days
I need to store the total hours
So
if I have it in glitch
Can i like view the page and interact with it?
you would have to code that
or you can do console.log()
I am going to
RangeError: Source is too large
at Uint16Array.set (<anonymous>)
at OpusScript.encode..
What could cause this error?
glitch console i meant.
Yeah but I still need a button to say I stopped wearing it, I started wearing it
You know
Should I use react?
To display the stuff
Or is that possible in raw HTML?
Displaying variables?
doesn't matter what you use, what matters is that you need to have a backend webserver
let arr = ["a", "b"]
how i can find the a
im confused
Why a backend webserver toh?
are you not just tracking how long you have them in?
Yes
so why do you need buttons
because you cannot expose any sensitive data to the frontend
its literally 2 numbers
If I start wearing it I press a button, then when I stop wearing them I press it again
I dont think it matters tbh
And it adds the total hours to the total
are you planning to put them back in?
Does discord bot API not like gif images?
It's not liek the blocks on ur teeth
discord doesnt mind gifs
i need help with the detailed description ;-;
Cause I get a url error when running a command.
I have like a brace to move my bottom jaw forward and I can take them out thats what I want to calculate as I need an average of 14hrs a day at the end
embed.author.icon_url: Not a well formed URL.
And I need to view if I am at my 14 hours
oh
you need a direct url to the image
avatarURL()
@stable nimbus ^
you cannot just grab a giphy page and expect it to work
thats not js
djs isnt the only lib
can any1 help
i need add image at the end
right..
I have it set to message.author.displayAvatarURL()
have what set to that?
:thonk:
Can I display variables in raw html?
Where it grabs the author display image where I think I'm getting the bad url error.
Or would I need to use react?
you could use ejs
you can just do res.send()
ejs?
you dont hvae to use a framework if u dont want to
if its a bot dashboard, you probably would use a framework instead of a template engine (ejs, pug etc), if its a small application. use view, angular actually dont, react
No
its not a dashboard
then just use ejs, if its something small
It's just a simple website on my glitch page with 1 button and some variables o ndisplay
make 3 files
/ - display's time and 2 buttons for 2 urls
/stop - stops the timer and redirects to /
/start - resumes the timer and redirects to /
i'd just use ejs for that then
Does anti NSFW count as a NSFW feature? π€
wdym
ejs is really simple too
yea
guys
ye
But I don't have NPM on glitch
try {
bot.commands.get(command).execute(bot, message, args, command, db);
} catch (err) {
console.error(err);
message.reply('houve um erro ao tentar executar esse comando!');
}
try isn't sending message inside
however you download stuff with glitch, do it the way u normally would
"string expected, got table"
js needs a then keyword π©
no?
im so confused
Me too.
Do I put the ejs script tags in head or body?
what
what
theres no ejs script tag
what
Am confused
here
well, i guess, but thats only limiting ejs to js
look at my code
see what I use ejs for
shit code but it works
i use ejs for https://github.com/OfficiallyLost/officially-lost.me
wdym
prob shouldn't use it for that but :shrug:
that's just a templating language lmfao
I'm confused
yeah
Does EJS work on glitch?
just like
ejs is a templating language
toilet
i wanna learn it
nasty
its good
im meant to be learning python and go :kek:
oh
there goes my nitro
whelp
lua seems like js + python to me
you dont
send a nitro emote
there's a grace period after your nitro expires
you get to keep it for a few more days
lmfao, my status still shows with the animated emoji
my nitro ended 27nd, grace periodova
why
have you got an express backend?
And glitch doesn't show it either
you cant open an ejs file like you can open an html file
add me and then send
RangeError: Source is too large
at Uint16Array.set (<anonymous>)
at OpusScript.encode..
What could cause this error?
What source?
@tulip ledge when using ejs, you need an index.js for basic stuff iirc
the music queue
javascript errors are SO easy to understand 90% of the time. literally self-explanatory
i dont know what is causing the error
whats the error stack?
RangeError: Source is too large
0|bot | at Uint16Array.set (<anonymous>)
0|bot | at OpusScript.encode (/root/bot/node_modules/opusscript/index.js:67:16)
0|bot | at Encoder._encode (/root/bot/node_modules/prism-media/src/opus/Opus.js:60:25)
0|bot | at Encoder._transform (/root/bot/node_modules/prism-media/src/opus/Opus.js:143:30)
0|bot | at Encoder.Transform._read (_stream_transform.js:191:10)
0|bot | at Encoder.Transform._write (_stream_transform.js:179:12)
0|bot | at doWrite (_stream_writable.js:403:12)
0|bot | at writeOrBuffer (_stream_writable.js:387:5)
0|bot | at Encoder.Writable.write (_stream_writable.js:318:11)
0|bot | at VolumeTransformer.ondata (_stream_readable.js:716:22)
0|bot | at VolumeTransformer.emit (events.js:315:20)
0|bot | at addChunk (_stream_readable.js:295:12)
0|bot | at readableAddChunk (_stream_readable.js:271:9)
0|bot | at VolumeTransformer.Readable.push (_stream_readable.js:212:10)
0|bot | at VolumeTransformer.Transform.push (_stream_transform.js:152:32)
0|bot | at VolumeTransformer._transform (/root/bot/node_modules/prism-media/src/core/VolumeTransformer.js:78:10)
index.js:67
he asked for the error
line 67 of index.js
of opus script
because its not your index
π€
he asked for the error
whats the error stack?
Is there anywhere I can ask for help
for code? here
Or a way to shows variables in html without need ejs
the erro is coming from this
this.inPCM.set(buffer);
what file is too big @quartz kindle
So is it impossible to make an app/website like this for free?
yeah
ejs is pretty basic stuff
But it doesn't work on glitch
really?
ajax is much easier in recent updates
Itβs possible to get someone to host ur stuff for free
Does heroku do the same?
fetch() is delightful
But itβs not gonna be good performance
Firebase has some decent options
@earnest phoenix likely an audio file you're trying to load
heroku is a host for websites
My number 1 discord bot hosting solution is Raspberry pi
yeah
Ik not related to you @tulip ledge
afailk, its only for websites
i have never had that error before
@tulip ledge what are you trying to do
check FireBase Chicken
can it be caused by a youtube song that is like 24h
Do anyone knows what can I do so when I turn off my PC the bot wont come offline?
I know how vps's work...

VPS hosting
@earnest phoenix ^
Wdym?
Check this link.
or ask someone to do it
yes because then that server hosts your bot
which is unlikely
or that π
@misty sigil @sand crown you have VPS?
Try AWS for hosting itβs free for the first year
every decent bot has a vps
I have a vps.
how about
no vps
every decent bot has server

i got a 9TB storage server that i leave running 24/7, since it doesnt use space nor much internet, might aswell leave it running there
i did had a wii running one of the bots, but i moved it now
y'all really do just host on anything
How much does it cost?
Β£3.59 a month
was a fun test for a couple weeks, but its annoying to keep it on
it depends
on what plan you get
if you can afford nitro you can afford a vpsβ’οΈ
Can someone help me debug this Connect4 command that I'm working on? For context, it's written in TypeScript using Eris.
https://gist.github.com/SinistreCyborg/96e359e41168ac1e9d51a76b55dfd8d1
and the problem is
it ends right after starting
My nitro was gifted 2 times and I won a giveaway to the other
ok
I didnt buy anything
watch as noob forgets about gifting
Congrats!
I console.log()-ed board and somehow the entire column the user chooses becomes that, not just the bottom-most one
o
board is a 2d array containing all the spots
const i = Number.parseInt(choice, 10) - 1;
board[colLevels[i]][i] = sign;
colLevels[i]--;
just looking
yeah that's the part that I think might be wrong
if it works right, just that "cell" should be set to sign
I am trying to make a server but I dont want to have any other bots and I want mine
but instead i get that
what lib @earnest phoenix
for board
that's what I meant by the entire "column" of the 2d array being set to sign
@earnest phoenix i can point you in the right direction if you tell me what library
lmao his status is the most cringeworthy thing I've seen here
lmao

Why is tyhis not triggerting?
client.on("messageReactionAdd", (messageReaction, user) => {
console.log(1)
console.log(messageReaction)
console.log(user)
})
Nothing's happening when I add a reaction to a message
is it a message sent before the bot started?
Yes
the message needs to be cached
Is there a way to check for older messages?
fetch the messages you want to check
And then
then it should be cached
I can just do: client.channels.cache.get().fetchMeessages(ID)
And then it will work?
Wut
messageReactionAdd only works with cached messages
as per the docs
fetch will cache fetched messages
client.channels.cache.get("734541084314828840").fetch("738020027034501240")
^
TypeError: Cannot read property 'fetch' of undefined
It will work with uncached messages if you subscribe to the partial event(s)
https://discord.js.org/#/docs/main/stable/topics/partials
Why does it say that client.channels.cache.get("734541084314828840") is undefined?
or check if its there first
But it is there
if !cache.has(id) => fetch
It is there
get only gets it if its cached
then why the fetch?
you are trying to fetch the channel, but all guild channels are cached by default
There is no message object
well, thats an assumption at least, im not sure what you are doing
then get channel too
by default, all guild channels are cached as per the discord.js docs...
I first tried to make a glitch web page to calculate this now I tried a discord bot and that doesn't work either I'm just gonna give up ffs
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Β―_(γ)_/Β―
depending on how often you need them you can request manually
as long as you have that channel id, you should be good
just
textChannel.messages.fetch(messageId)
that what i was assuming
if your bot got verified then it got kicked from almost all the servers to the amount where it couldnt be applied for verification would it remove the verify mark
verification is just a process to verify you, i dont see why they would remove it
they are already slow at verifying, i doubt they keep track
it just makes more work for them if your bot grows again
@tulip ledge use partials
I don't knoww what partials are D:
I already linked it to you. meh
@quartz kindle
so i made a severs command, whats the variable so it displays the guilds id? i have tried guild_id and guild.id idk what to put in
@commands.command(helpinfo='Info about servers Corotoz is in', aliases=['server', 'num', 'count'], hidden=True)
async def servers(self, ctx):
await ctx.message.delete()
if ctx.author.id in shut_cmd:
servers = self.bot.guilds
servers.sort(key=lambda x: x.member_count, reverse=True)
await ctx.send(':white_check_mark: ***Top servers with Corotoz:***')
for x in servers[:100]:
await ctx.send('**{}**, **{}** Members, {} region, Owned by <@{}>, Created at {}\n{}'.format(x.name, x.member_count, x.region, x.owner_id, x.created_at, x.guild.id. x.icon_url_as(format='png',size=32)))
y = 0
for x in self.bot.guilds:
y += x.member_count
await ctx.send('**Total number of Corotoz users:** **{}**!\n**Number of servers:** **{}**!'.format(y, len(self.bot.guilds)))
Can I mention "Anti NSFW" in my description and not have it removed for mentioning NSFW features and functions?
yes
Okay thank you
i think
Correct
client.channels.cache.get("738495925739192452").messages.fetch("738500060605841509")
^
TypeError: Cannot read property 'messages' of undefined
I am using partials
@slender thistle it didnt work
@commands.command(helpinfo='Info about servers Corotoz is in', aliases=['server', 'num', 'count'], hidden=True)
async def servers(self, ctx):
await ctx.message.delete()
if ctx.author.id in shut_cmd:
servers = self.bot.guilds
servers.sort(key=lambda x: x.member_count, reverse=True)
await ctx.send(':white_check_mark: ***Top servers with Corotoz:***')
for x in servers[:100]:
await ctx.send('**{}**, **{}** Members, {} region, Owned by <@{}>, Created at {}\n{}'.format(x.name, x.member_count, x.region, x.owner_id, x.created_at, x.id. x.icon_url_as(format='png',size=32)))
y = 0
for x in self.bot.guilds:
y += x.member_count
await ctx.send('**Total number of Corotoz users:** **{}**!\n**Number of servers:** **{}**!'.format(y, len(self.bot.guilds)))```
oh wait nvm sorry i put in a .
then the channel is wrong
why do python bots always look kinda messy
also
use f-strings
I checked like 3 times
where are you using this code?
const Discord = require("discord.js");
const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
const fs = require("fs")
const data = require("./data.json")
client.channels.cache.get("738495925739192452").messages.fetch("738500060605841509")
client.on("messageReactionAdd", (messageReaction, user) => {
console.log(messageReaction)
})
*inhales*
So o nready event I cache it?
*exhale-* look at my dashboard http://alebot.ale-bot.xyz
if thats what you want, yes
but partials are made so you receive events on uncached things
so if you use partials, depending on what you're doing, you dont need to fetch it
HTML
How exactly do you make a dropdown with an image right beside the arrow inside one big container and make it (the container itself) clickable?
add a listener to the container?
use the a tag
also in js is there a way to to define a statement like return as something other than return? (e.g x = return; if (1 > 0) x)
and in each navbar item thing, set the image to whatever, if thats what you're saying?
no u cant dice
return is a reserved keyword
wait what the fuck
Can you change the bots pfp using the api?
vue is massive
@honest perch using what api
poggers
discords
yeah
pog
????
code it, for example run a command !pfp something and it would change
you cant change the bots pfp
I think mixing Bootstrap Studio with dynamic socket.io website was kind of a bad idea
o let me make sure
I'll need plenty of placeholders for this thing if I want to understand what I want...
oh im prety sure then u'd just do
you can look at the source on how they did it
/api/users/@me
oh sick
@slender thistle react.lazy to the rescue
I prefer to stay away from using frontend frameworks directly because I'm bad at JS
i prefer to stay away from frontend
well I have to go full-stack in my case so /shrug
oof
I want to start from the very bottom and get hang of it before doing anything significant tbh
is it against any terms of service for a bot to have a command that makes randomized letters/numbers in a nitro code, so basically a generator
is it really a generator or just a pure guesser
m a g i c
but is it against any tos
lol
why is this happening
do i need to disable it?
its not hacked
no
u don't need to
wait this is a webhook
AAA
someone is sending through webhook
Someone sending those messages through a webhook
just delete the webhook
I'd suggest going through Discord ToS for that :^)
discord tos is shit
cuz fancy language
STUPID
and its WAY too long
i'm only halfway through it
lol
i find it interesting
I'd not do it if you are questioning it tbh
i did thank you
Sup how do I write a compiler oh nobody responded okay bye
what the fuck why
hode hh.
Idk but I want to make hode.hh so jakskdhwidne
@amber fractal no
how would I get the id of a user that was mentioned
what library
in d.js v12: message.mentions.users.first().id
ah ok thx
You could parse the message content for the message (e.g. using regex) or if the library you're using has some helper to get mentions in a message
or what jeremy said yeah
i think message payload has mentions in it
yes
also how would I detect weather a mentioned user was a bot
if (mentionedUser.bot) { do something }
ah ok thank you
np
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
yeah message has mentions payload by itself
so any lib should have it
so when I use message.mentions.users.first().id it gives me the error
its gonna be something dumb I can feel it
console.log(message.mentions.users.first())
gives me this
wait
y know how people have profile commands that can give you the profile of people
and the argument is the name of the persons profile youd like
how do i set that up
thank you for enlightening me
lol
your question is way too abstract
i use discord.js and when you use message.author.username it will give you the username of the person who called the message
but how would you make it send someone else, like someone specified in an argument
mm I need the id tho
you can get the first mention with
message.mentions.users.first()
or message.author
ok
so if you were to do that it would give you the person that was last mentioned?
in regards to using mentions see <#development message> and the problem with it
not really a problem if your args are not ordered
you should account for wrongly ordered arguments
if you don't, well you're a trash bot developer
so letting users do
!command mention arg
or !command arg mention is bad development?
π€
yes
99% of my commands with 2+ args can be ordered in any order intentionally
its more complex code but you dont need to remember the order of args
i can
!transfer @earnest phoenix 100
or
!transfer 100 @earnest phoenix
i spent awhile making it work like that
lets say we have a ban command and the user forgets to mention whoever they want to ban and go ahead and provide the reasoning only and they mention another user in the reason. a shitty bot would use mentions.first() and ban the user that was mentioned in the reason
sure, commands that require text descriptions you shouldnt mentions.first
when someone says im a trash bot developer
always have been π π«
see you actually take into account wrongly ordered args and parse them accordingly
but commands with structured arguments can have multiple acceptable orders
if the command is 1 argument but split in processing then what
for example I have a !play [move] for a game im working on
move is letter followed by number
e.g. !play T19
Yeah it's what I do
regex out all numbers 
but thats because I can guarantee the first char will be a letter
Cry was saying how you should be able to order arguments anyway
So I'm trying to use C or some form of programming that has C speeds to do some math?, I tried Cython only to learn that's it's not supported, any ideas on other things I could use instead of Cython (trying to avoid CPython) (this is just to do math calulation faster then python is currently doing)
c++ is pretty gnarly
Iβm Ned code partnet
the argument order is important in multi arg commands @halcyon crow
for single arg commands you don't have to worry about that since you know what the value should be
I guess its multi arg just inputted as one though
right now your command is structured.
I take the opposite approach to cry, i find too much unnecessary structure annoying
wouldnt it be nice if your command understood
!command T19
!command T 19
!command 19 T
no user would need to remember how to do a command
yeah perhaps
Is there an efficient way to do it though?
args = message.contents.split()
coords = ''.join(args[1:])
then process somehow
@solemn latch you could do something similar to what i do with my reminder command
check endsWith for the identifier or startsWith, then check if whatever in between is a number

wait
so if you were to do message.mentions.users.first()
itf would give you the person that was last mentioned?
how does that even make sense
man idk im stupid
f i r s t()
okay, so the first person that was mentioned?
yes
think oop: message is the message the user sent
.mentions is all the mentions in the message
.users is all mentioned users
.first() is the first mentioned user in the message
of course the docs can explain it better
thank you
brain exercises!
from there if you wanted to get the username of that user would you add .username to the end or no?
or would you set it as a var and then use it afterwards
as in var LastMention = message.mention.users.first()
message.channel.send(LastMention.username)
i mean
well i suppose it you mentioned two people in the same message it would be
*wouldnt
imma play terraria with my friend because im tired of coding
it would get the username of it yes
(also terraria is better than minecraft π΅ )
so when I use message.mentions.users.first().id it gives me the error
why does this happen?
there may not be any mentioned users in a message
there was tho
are you sure the error is coming from there
well thats what is on the line that the error comes from
message.mentions.users.first() from what i understand returns undefined only in messages with no mentions
no only the .id part returns undefined
your using .id on undefined
?
ah well I mentioned a user and if I console log it it shows an id so idk what is happening
you need a bit of validation, check if the mention exists first
before getting its id
Im using a command handler so the message has been sent before the id is needed
wat
do you whant me so send the code?
sure...
const Discord = require('discord.js');
const responses = [" won't be missed", "'s time ran out", " probably won't respawn", " was wasting oxygen anyways", " probably deserves our respect, but I don't think any of us will give it to them", "got ended by a holy hand grenade"];
const selfResponses = ["still alive", "can't kill the machine", "skynet will rule", "heroes never die", "I know where you live", "can you do *anything* properly?","you tryed to kill a fellow crusader what is thei heresy?", "you can't kill me cease your faggetory"];
module.exports = {name: 'shoot',description: 'kills the mentioned user', async execute(bot, msg, args) {
let User = msg.mentions.members.first()
let botID = 694986563179773995
if(User.id != msg.author.id){
msg.channel.send("<@" + msg.author.id + "> ***shot*** <@" + userID + ">", {files: ["gunshot.gif"]})
.then(function(){
if(User.id == botID)
msg.channel.send("<@" + msg.author.id + "> " + selfResponses[Math.floor(Math.random() * (selfResponses.length))]).catch(error => console.log("Send Error - " + error));
else
msg.channel.send("<@" + userID + ">" + responses[Math.floor(Math.random() * (responses.length))]).catch(error => console.log("Send Error - " + error));
})
}
else {
msg.channel.send("<@" + msg.author.id + "> ***committed suicide***")
}
}
};
and what is the line of the error? this one? if(User.id != msg.author.id){
does anyone know how i can move 'Lost' the the middle kinda bit of the screenshot?
its on let User = msg.mentions.members.first().id
you dont have that
this one?
let User = msg.mentions.members.first()
yeah I changed it later so user has the .id at the end but it made no difrence
you need to check if it exists
if(User && User.id !== msg.author.id)
or add before if(!User) return
or whatever
ah ok
@digital ibex some context is required
Hi
its just a website, the html i've already got, which is underneath:
i tried margin-top but that moves the whole container :/
and you want to move it down, but not move the container?
the css is' i've got for that is: css .gild-name { font-family: 'Cabin', sans-serif; font-weight: bolder; font-size: large; display: center; min-height: 10px; }
yeah
the min-height isnt doing anything btw, i just put it there to see what wuld happen
like
im assuming you dont want gild-name to be inside the container
im trying to make lost appear where the red line is
by container you mean b-container right?
so move gild-name down, you can use margin or padding or whatever
and bring the container up
i put it in the container... and this happens
yeah
how would i bring the container up?
whats the css for the container?
.b-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-auto-rows: 100px;
grid-gap: 5%;
margin-top: 9%;
margin-left: 6vh;
margin-right: 6vh;
}```
margin-top
d:\bordel\Dev\discord-application-bot\index.js:21
userToSubmitApplicationsTo.send(`${data.user.username} has submitted a form.\n${answers}`);
^
TypeError: Cannot read property 'send' of null
at applicationFormCompleted (d:\bordel\Dev\discord-application-bot\index.js:21:29)
at Client.<anonymous> (d:\bordel\Dev\discord-application-bot\index.js:175:7)
at Client.emit (events.js:315:20)
at MessageCreateHandler.handle (d:\bordel\Dev\discord-application-bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (d:\bordel\Dev\discord-application-bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (d:\bordel\Dev\discord-application-bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (d:\bordel\Dev\discord-application-bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (d:\bordel\Dev\discord-application-bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (d:\bordel\Dev\discord-application-bot\node_modules\ws\lib\websocket.js:789:20)
Process exited with code 1```
help me pls
What is userToSubmitApplicationsTo and how did you get it
How?
So is that message supposed to be sent to a channel?
yes
Then replace
let userToSubmitApplicationTo = null;``` with
```js
let userToSubmitApplicationTo = <client>.channels.cache.get(<That channel's id>);```
TypeError: Cannot read property 'send' of undefined
at applicationFormCompleted (d:\bordel\Dev\discord-application-bot\index.js:20:29)
Can i see how you did
You on v11?
yes
Well the Channel id is incorrect
no the id of channel is correct
you told him to do client.channels.cache.get(id) and he did client.channels.get(id)
so try it with the .cache added
no i'm in v11
@bright dove cache does not exist on v11
I recommend to update to v12 because v11 will not be maintained and shutdown in October 7th of 2020
you need to place your code that gets the text channel in your bot's ready event
once this happens, all channels will have been cached
it's good I found it alone but thank you
ah, nice
Any idea what this error means?
(node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:24) [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.```
a promise rejected, but there was no .catch() to handle it
(node:30068) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\15862\Desktop\coding\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26)
at Client.login (C:\Users\15862\Desktop\coding\node_modules\discord.js\src\client\Client.js:221:21)
(node:30068) 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:30068) [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.
PS C:\Users\15862\Desktop\coding>
what does that mean
pls help
'hi'
help pls
read the error
i did but i dont get it
ok
then how do i make it valid
const Discord = require('discord.js');
const bot = new Discord.Client();
const token = 'you not gonna control my bot';
bot.on('ready', () =>{
console.log('this bot is online!');
})
bot.login(token);
thats the script
it dont work y?
@sonic lodge
like i said, your token is invalid
Hey is there a host which provides both node an web?
where are you getting your token
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Migrated to my Raspberry Pi 4 B today! π
under the bots name in the bot category
i dont get it
@everyone help pls
(node:12612) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\15862\Desktop\coding\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26)
at Client.login (C:\Users\15862\Desktop\coding\node_modules\discord.js\src\client\Client.js:221:21)
(node:12612) 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:12612) [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.
PS C:\Users\15862\Desktop\coding>
really?
no
it didn't ping everyone, it's fine
its a fake thing
got it off google
@here
lol
(node:12612) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\15862\Desktop\coding\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26)
at Client.login (C:\Users\15862\Desktop\coding\node_modules\discord.js\src\client\Client.js:221:21)
(node:12612) 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:12612) [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.
PS C:\Users\15862\Desktop\coding>
can someone please help
pls don't spam the same message. I still see it up there
i need help
are you saving the file
It sounds like your token is bad
or pasting the token completely
i have a valid token but it says invalid
Print it out to console before your script uses it to make sure
im pressing copy then pasting it
dont
did you save the file
?
dont copy and paste code
why
i made my own code
then use that code
im talking about tokens
not code you found from google
ik
pretty sure this dude is a troll lol
Glad it works
but now for the commands π
well my thing got lost already lol so I'ma delete and resend

