#development
1 messages ยท Page 1116 of 1
check your /var/log/nginx/ale-bot.xyz.error.log
and it's so much more lightweight than chrome's pip extension
okay
back to firefox i go
easy fix: define it.
jaja tons of tons of devs and me starting in a new languaje
and please don't create a new client again
all discord.js structures have a property linking back to the client
for example message.client
Why is my settings.py file from default Django project pointing at sqlite3 ๐ค
ok sorry
even client has a setTimeout/setInterval function, which is crazy
ยฏ_(ใ)_/ยฏ
client client client
tim it shows the site
the last guy say me client.user.id, smh
i need help
dont aks to ask
@faint prism you're blocking the handler for more than 3 seconds
@earnest phoenix Oof, forgot to add Task.Run(() => TimeConsumingFunction) for every message (Passive user data update)
what kind of error?
wait let me take a pic of it
Hello why bot offline in my server ?
it can have ext
whos bot
My english very bad sorry
yes maybe
const config = require('./config.json');
same
Invite manager
Refused to execute script from 'https://ale-bot.xyz/script.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
go complain in their support server
Invite manager
@earnest phoenix ask https://discord.gg/UmM2jK
how to disable strict MIME type
so fast @earnest phoenix
are you doing this in browser? Asterki
i just barley got the link
lmao
that error whn im making a bot
have you tried reading the error
yeah
and what does it say
it said "Cannot find module './Config' or its corresponding type declarations.ts(2307)"
do you understand what that means
nope
there wasnt an error for the yt person
i havent been filling it out
pls enable esModuleInterop and I think it's syntheticdefaultimports
typescripts import syntax is pure aids
i'm pretty sure it's all good except they're copypasting from a tutorial and importing is case sensitive
i dont see the config file at the location they are getting it from tho
@scenic kelp car soccer?
sir this is development
What's the advantage of using Django over Flask? 
so that you can do ts import { Client } from 'discord.js' instead of ts import * as Discord from 'discord. js'
im so close to having my website up plij tell how to
Refused to execute script from 'https://ale-bot.xyz/script.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
so is that a yes or no
*cri*
Refused to execute script from 'https://ale-bot.xyz/script.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
pls say how fix
d!help
@earnest phoenix Hm. If I spam one of my bot commands, I eventually hit a A MessageReceived handler is blocking the gateway task
But I'm sure not why totally... All the command calls are to async functions and that is called only from a delegate subscription
offload your entire logic to another task
@pure lion
if you spam you hit the ratelimit, if you call a method that's on a ratelimit it will block until the ratelimit expires
chances are you hit one in a command
the command is blocking
so either offload that to another task or you can set the default runmode to Async in the command service config
RunMode.Async basically does the former
executes the command in another task so it doesn't block
a
correct
you can either run that logic in another task or use RunMode.Async
keep in mind if you use RunMode.Async the result will always return successful and you will have to handle from the events instead
Hm
so the executeAsync calls a command for example:
The repo is the logic/implementation, and returns the reply string
I'm a bit slow rn, didn't sleep enough. I'll probably just come back to it later
the easiest solution is to:
run the filtering logic first (if message is in dm, if the author is bot etc.)
if the message passes the filter then run the rest of your logic in another task, easiest way being to use Task.Run
we filter first then offload to another task so we avoid wasting resources on messages we're not going to do anything with
so for example instead of:
await ReplyAsync(commandLogic())
it should be:
Task.Run(() => ReplyAsync(commandLogic())) ?
yes but to avoid effort of replacing it in every command you can just do it in your event handler
if (!result.IsSuccess) _logger.Log(LogSeverity.Error, result.ErrorReason);```
Which is this area
Task Handler(message)
{
//filtering logic
_ = Task.Run(async () => {
//executeasync and all of that nice shit
});
}
correct
aha, the async () => answered my next question ๐
these serever for wahat
have you tried reading the channel that's literally fucking named faq
under the category that's literally named information
Hi,
Does anyone know how i Convert: 2020-08-04T16:54:23.993Z
To a normal readable time in Javascript?
have you tried reading the channel that's literally fucking named faq
@earnest phoenix chill
i'm pretty sure you can just use the Date's constructor
Date's constructor properly parses ISO strings
But how?
...by passing the string in the constructor
seriously
wow
Sorry that i never worked with dates ๐
that's not never working with dates, that is not knowing javascript, you should know what passing in the constructor means regardless of the object type @sterile minnow
so I'm trying to do some shit with my bot. if I do!help, that should trigger the help command, the first console.log returns me an object with help: "help" in it, but the second console.log returns undefined, even if client.commands.get("help") works. any idea why
Ah shit. I have to handle database locking now @earnest phoenix
Ah this thing. I'm not native english so i dont understand some things
whats the point of evaling here?
SQLite? @faint prism
Doesn't SQLite not have any decent async libraries in Python? (asking for myself)
Isn't sqlite a bad idea for bots?
Depends on what its going to be doing
sqlite is made for storing configs/settings
Refused to execute script from 'https://ale-bot.xyz/script.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
SQLite can't do concurrent database writes without locking or forming a queue
But reads are infinite
It's C#, and I'm actually still on JSON serializing... My SQLite Database context ran into some dependency issues on my Linux-arm64 server, so I had to failover to my json ugh
you need to set the mime type to the relevant type
how
why not use efcore with sqlite
Efcore?
whatthat
entity framework core
an ORM
it handles all of the sql and the binaries for you
Never used it, lol
i love working with it
woooooooooooooooooooooooooooooooooooo
what do i doooooooooooooooooooooooooooooooooooooo
And I'm currently relying on Djangos ORM to handle the raw SQL for me, when it comes to SQLite
I should consider efcore. I went with sqlite just because it looked light and simple
I'm switching to Postgres here soon anyways since I have multiple origin servers, & SQLite can't be connected to remotely
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Configuring_server_MIME_types
bottom section covers it pretty well
Post gres post gres post gres
bcuz thats whats in cache @delicate shore
But this server alone
I need to actually work out a better database solution
How to fix that?
My one currently it's so bad
Jeremy
What are you using currently? @placid iron
Oh god
bcuz thats whats in cache @delicate shore
@misty sigil
Ant way to clear cache
no
@delicate shore you won't be able to efficiently get the member count
And
Okay other thing:
How do i like make a image out of these things: spotify:ab67616d0000b27391f5ee49ad8fa5da6f4bcfcf
Because i wanna make like a RichPresence Command where i set the Image of the Game or sth like that as a embed thumbnail
Discord.js
Oh, yee, might wanna move to Postgres or something & implement connection pooling
infact client.users.cache.clear()
And as you can see the gives me more of database locked problems
I'm going to rework the whole thing to pool connections
@misty sigil I think they're asking how to get the correct member count of all servers
If you have multiple writes a second, yee
probably should look at the spotify api docs @sterile minnow
Ye
ty
Just switch to Postgres & use connection pooling, switching to Postgres alone would be fine even without the connection pooling, in order to fix DB locks
i thought i can get that with discord itself but makes sense
discord doesnt host images for spotify
ty
@solemn latch it doesnt cover how i can actually set it up to execute the file
I use postgres for my other project so it wouldn't be hard for me to do tbh. I'll look into it as idk the performance differences
@pure lion what are you using, php?
your header should include the correct content type
Postgres can serve 100k+ reads/writes a second typically, pretty easily, if not millions
I don't think you'll ever need to worry about it
@delicate shore you won't be able to efficiently get the member count
@vestal star
Then why is server count perfect
Servers arn't cached @delicate shore
Ah ok then 
Ok
I have already moved all the SQL stuff into a single file, I just need to configure it to create a single connection then give each script the same connection
Yall need to learn how to use google...
people get used to others googling for them
@vestal star nope, express
Ok
What is the best Spotify npmjs thingy without token to search like a track or sth?
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
Tayron use the spotify api
:l
are we going on a lmgtfy rampage rn?
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
Probably, idk why ppl don't bother to just use google

For all those people who find it more convenient to bother you with their question rather than search it for themselves.
not funny
I searched for it on google and only web client things came up but thanks for help not
lol
No i need that to just fucking get information abt the song and make a embed with this shit
THIS IS FOR CHATTING ABOUT BOT DEV, NOT USING US AS MACHINES TO GOOGLE SHIT FOR YOU. IDC ABOUT PEOPLE NEEDING SERIOUS HELP ABOUT SHIT THEY ACTUALLY DID RESEARCH FOR
you people need to calm down
k
I NEED HELP THATS WHY I FUCKING ASK
How i can check does number is a number
@solemn latch ty
I searched for it on google and only web client things came up but thanks for help not
@vestal star
Petition to add an lmgtfy command to luca
The web client is what you fucking need...
No make it public
How i can check does number is a number
so ? why u guys are mad
You need to use the official API and send a request to a certain endpoint to get information
it's not that hard tbh
This is what they were calling "web client" https://github.com/thelinmichael/spotify-web-api-node
@earnest phoenix Could you elaborate?
typeof
isNaN ?
also works
yes but not woriing
what is ur number?
i tried
isNaN(8)
would be false
isNaN("text")
would be true
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN
I need a fucking therapist after looking at this channel.
call anyone who asks a stupid question a fucking donkey full of yanky danky doodle shite
LoL
smh i forgot my question
you
fucking donkey full of yanky danky doodle shite
i set the content-type to text-js but it also renders the html as plain text so how do i make this fucker work
this channel is becoming gordon ramsay ๐
you need to set it text/html if you want to deliver html
but i want to also execute the js
Is the js in a <script > tag?
Oh god that was a fat rip
its from a src
just witnessed a guy in Testers do an eval with
for (g in client.guilds.cache) {
g.leave();
}
Rip his 44 servers

LmAo
you are delivering js as html
lol @opal plank
so what do
when you have copy/paste code and dont know what it does
deliver js as js and html as html
just witnessed a guy in Testers do an eval with
for (g in client.guilds.cache) { g.leave(); }Rip his 44 servers
@opal plank did he just make their bot leave all guilds
Could you just have the js in a static file
yeah @zenith terrace
all 44 servers
And link it in a script tag
wouldnt js be application/javascript
rip for that user
i d k
yes it would
imnotsurehowtosenditasthat
as the content-type
yes
fucking donkey full of yanky danky doodle shite
why
but you can only have one unless im mistaken
is there a method to remove a reaction based on the reaction itself?
one per request
if someone requests
index.html
then later requests script.js
they can have different headers
Someone fucking help this lost soul
e
eval this this.client.shard.broadcastEval('for (let g in this.guilds.cache) g.leave()')
hypening#4183, is this the guy who did dis or what? Not Erwin
you dumbass. ur sending html as a js file and expecting it to render
wait, your script.js file is actually html?

const socket = io('/');
const videoGrid = document.getElementById('video-grid');
const peer = new Peer(undefined, {
host: '/',
port: '3001'
});
const myVideo = document.createElement('video');
myVideo.muted = true;
const peers = {}
navigator.mediaDevices.getUserMedia({
video: true,
audio: true
}).then(stream => {
addVidStream(myVideo, stream)
peer.on('call', call => {
call.answer(stream)
const video = document.createElement('video')
call.on('stream', uStream => {
addVidStream(video, uStream)
})
})
socket.on('user-connected', userID => {
connectToUser(userID, stream)
})
})
socket.on('user-disconnect', userID => {
if (peers[userID]) peers[userID].close()
})
peer.on('open', ID => {
socket.emit('join-room', connection.IDs.room, ID);
});
function connectToUser(userID, stream) {
const call = peer.call(userID, stream)
const video = document.createElement('video')
call.on('stream', uStream => {
addVidStream(video, uStream)
})
call.on('close', () => {
video.remove()
})
peers[userID] = call
}
function addVidStream(video, stream) {
video.srcObject = stream
video.addEventListener('loadedmetadata', () => {
video.play()
})
videoGrid.append(video)
}
this is my script.js file
whats your domain again?
its the same fucking thing, except my link skips a step

Also you really need to fix ur styling
is there a discord library for Brainfuck
nop
at least im not using !important
Not optimal
yeah, looks like your your script.js isnt what you think it is
oh yeah idk how to mobile theres probably a meta tag
Not optimal
@placid iron but it's OK he's not using!important
it's offcenter because of the screenshot
if you look in your browser, and press f12, and look at script.js its not what your screenshot shows
but thats fucked
what the fuck
oop
LMAO
lmao
some people should learn how to use css before using it
<meta isthisbitchmobile?>
nop
navigator.something
just write good responsive css
How do you expect meta tags to help anyway
or use bootstrap or react
meta tags are just for "meta"
m e t a

but yeah what the fuck do i do
http://egg.rovi.me/ meta if I don't say so myself
because thats the room.ejs file
@pure lion get it to send the js as js would be a start ๐
ok but how do i send the fucking file as its own soidguoshndfhunad;fbh
this man is a lost cause
@placid iron You should see me site on mobile then
Its AIDs
Actually
My entire frontend is dogshit
its aids on pc too
this is room.js file
https://alebot.is-inside.me/8T5PRng5.png
@earnest phoenix I love my front end, my backend is aids. Together we can combine and become trash at both ends ok

.ejs
Right so first of all I see that isn't a .html or a .js
oh no you cut off the margins
I did not
https://nekos.club is mine @vestal star
The best source for your neko related needs. โก
its fine
Why can't I access l e w d n e k o s
I could help you make it better
You can't? @placid iron
you cant access lewd nekos, oh no
Ehh, whats wrong?
Error 1020
*cri*
F
ยฏ_(ใ)_/ยฏ
so ignoring the mentally disabled everything else :)))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Aight my power went the fuck out
What is .ejs
wdymwhatis.ejs
yes
Ah ok
you think good
what are you actually using ejs for?
Tamplating
room ID template black magic fuckery (not clickbait ๐ฏ%) (definitely real) (also definitely braindead) โข๏ธ
isnt the room id just
Is a uiidv4
couldnt you just use js to display it rather than templating it into the page?
Uuid
it is a uuidv4 and i dont fucking know woo
Okay, try it again https://nekos.club/lewd @placid iron @solemn latch
The best source for your neko related needs. โก
It's the uuid stack overflow answer
yeah its working
oh
About to test maintenance mode using Cloudflare workers, hopefully this works

What about now, receiving maintenance message when trying to view the site?
yeah
Pog
I have so much work to do, I'm almost done filtering loli images, images that are too small, & images with text/web links on them out of the API/site
Then I have to rewrite the front end
Then work on the API some more

@earnest phoenix ._. loli image
U are HENTAI

oof
So for peerjs (installed globally so I can start a server on a port from the console) what the fuck do I do to make it work
This is gonna be my first bot I can't wait
It's a hacker themed bot but it's only for moderation lol
Noice
how long do these take
3+ weeks
No
??
my bot it takes only 4 days
yes for now
but during the corona it takes fast
like 1 week min
nvm i am dumb
ok it takes 3 weeks +
My options don't seem to work
.
@earnest phoenix i dont know if you care that much but i think i have the connection pooling groundwork layed out, i just need to edit the scripts to implement it
oh i am not good in music
@earnest phoenix What's the problem tho
literaly i dont know anything about music
Confused
the options dont do anything
They do, you can't notice them
i changed the volume to 0.5 and nothing changed
didnt hear any difference
That doesn't change the volume of the dispatcher
i dont even see the volume option in ytdl
<StreamDispatcher>.setVolumeLogarithmic(<Volume>);```
const options = { seek: 2, volume: 0.5, bitrate: 192000, filter: 'audioonly' };
d.dispatcher = await d.connection.play(ytdl(url, options));
volume is not an option in ytdl
ok ๐
Even if it's, it wouldn't affect the volume of the dispatcher
yes i understand that now ty
what does seek do exactly
how to declarate a global variable who can use in all the files?
I saw them in a youtube video when i just started learning discordjs and i have never changed them
hmm
(module.)exports
well i dont see seek as an option
the global object is exposed to every file in your program
type global.my_property = 5, and my_property is available in all your files
bitrate is an option though isnt it
Please don't use the global object to set variables
well im talking abaut variables, im piss off of declarate Dsicord on all my files
why do you need to require discord?
embeds
In discord.js v12.2.0 is there a way to fetch any user information by there ID?
<Client>.users.fetch(<id>);
Any user?
you forgot the cache manager change
you can just build embeds yourself, theres no real good reason to use the lib embed builder
Even if the user is not sharing a server with the bot?
you can just build embeds yourself, theres no real good reason to use the lib embed builder
@solemn latch if i dont it will say: Discord is not defined, i think is because i use const embed = new Discord.MessageEmbed()
how long does it take to get your bot verified
3+weeks
the discordjs embed builder just builds an object
@heavy marsh <client>.users.fetch(<id>) would fetch every user no matter what
Oog
OOh ok let me check
there's literally a damn channel for questions under a category that's literally fucking named INFORMATION in bold capital letters and you couldn't be bothered to skim through that?
lmao
Chill man
i feel the same way
please everyone here have questions
a lot of dumb ones which they could answer themselves lol
but yes someones have to piss off the others
What is 2 + 2? 
a lot of dumb ones which they could answer themselves lol
rule #0 read #rules-and-info and #502193464054644737 , thats may luca say when someone joins
true + true = 2
hey devs of luca
correct
no, me is dumb, i write emebd and thats why some of the embeds dont work
huh, maybe but i think ill declarate discord on all commands
actually isn't to hard, is just anoying
well the discord.messageEmbed is slower
It's not slower, just longer
Read conseption time
You can just extend MessageEmbed from discord.js and export through all files
if (command.aliases) data.push(`**Aliases:** ${command.aliases.join(', ')}`);
if (command.description) data.push(`**Description:** ${command.description}`);
if (command.usage) data.push(`**Usage:** ${prefix}${command.name} ${command.usage}`);
data.push(`**Cooldown:** ${command.cooldown || 3} second(s)`);
const embed = new Discord.MessageEmbed()
.setDescription(data, { split: true})
.setColor('#7288da')
message.channel.send(embed);
``` well i use this and i have no problems
like i just copy paste from the discord.js guide
i only add the embeds

Aight I have a quick question, what is best practice for keeping "global" variables, classes, and functions?
i have the same question...

1- Declare the variable/class/function
2- export it through all files using module.exports
3- There
Example?
You declare them in your main file?
Like this?
app.js
require('vars.js').var
vars.js
module.exports.var = "foobar"
//functions.js
module.exports = {
myMethod() {
},
myOtherMethod() {
},
};
// command.js
const { myMethod } = require('./functions');
myMethod();
There's a lot of ways to do it
K, but what if it's not static
Can I have some help please, All my commands work fine but my eval and poll command, Can someone help me please.
https://pastebin.com/X1rqD1Nj (Re-sent with pastebin)
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.
K, but what if it's not static
What do you mean
dont you just pass the variable?
I mean, I have a list of links, and I need to refresh it every 15 minutes and I need to be able to access this list from other files
And set it
@still merlin well look ok, but line 24 needs a ;
also line 19 dont need a ;
that can be one of the problem
@still merlin
message.channel.send(`\`\`\`โ Error preforming eval command\`\`\` (${err})`)``` try this?
But i want the text block like this
Then you can do something like
const links = require('path-to-links');
module.exports.refreshLinks = () => {
// Logic here
};
```@vestal star
Unless I'm understanding incorrectly 
So I should store shit in modules?
@still merlin wym poll not working
maybe you add the ; in the wrog site
the semicolons don't matter
^
How else would you export it then @vestal star
well in java yes, im traumed with java
K
not in js
@still merlin read the console and copy & paste here the first line of the error
sometimes looks like this: SyntaxError: Unexpected token '.'
well you understand me rigth?
Server count posted! x40 more times
Server count posted!
Server count posted!
Server count posted!
DiscordAPIError: Missing Permissions
at RequestHandler.execute (C:\Users\Jon\Desktop\SpiderBot Project\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
method: 'delete',
path: '/guilds/734421364710309969/members/397195869738500116',
code: 50013,
httpStatus: 403
}
Server count posted!
that is all my console has
@still merlin it doesnโt have permission to react
yep
bot doesnโt
My bot has admin permissions
does it have every perm tho
Yes
try cls the screen, then executing again the command
Also my bot is trying to delete a guild I think
anyone know how i can get actual member count instead of cached member count?
thath should show the error
anyone know how i can get actual member count instead of cached member count?
@misty sigil${client.members.size}?
so just a forEach?
try changing th let embed for const
you could map and reduce it aswell
nothing is sending
@misty sigil
<Client>.guilds.cache.map(g => g.memberCount).reduce((a, b) => a + b);```
Let and Const don't matter do they?
I mean there both variables except you can't change const's
when you have over 10 different connections to a database and each one blocks when they are using the databse (and i have some on message listeners) and then i pool them all into one
@still merlin js const args = message.content.split(" ").slice(1); switch (args[0]) { i see the problem
?
args[0] !== <poll
args[0] === Test
You've completely set all commands to first argument
switch (args[0]) {```
Should be
```js
switch (message.content.split(" ")[0]) {```
Any errors?
No
const args = message.content.slice(1).split(' ');
const command = args.shift().toLowerCase();
switch(command) {
};
Postgres is hot
@still merlin oh wait omg... I just realized
so i just have a connection function where i can pass a connection into and that overides the default one
:\Users\-- name --\Desktop\SpiderBot Project\index.js:951
const command = args.shift().toLowerCase();
^
TypeError: Cannot read property 'toLowerCase' of undefined
at Client.<anonymous> (C:\Users\Jon\Desktop\SpiderBot Project\index.js:951:31)
at Client.emit (events.js:327:22)```
and then the bot class has a connection variable
You literally set the commands to poll or eval without the prefix
Postgres has a connection limit among other things you need to learn, compared to something like SQLite
I'm just doing what I always do ๐คท
mmm, also you have to have a server or something. i didnt realise that (even if it is localhost)
Make sure you go through & understand how it runs, or else you'll have problems later down the rode
@still merlin change it back to what i said and try changing
case "poll":```
To
```js
case "<poll":```
And
```js
case "eval":```
To
```js
case "<eval":```
I do case: and then just ignore anything in the start that isnt the prefix
SQLite doesn't scale well
or removing < from your command variable
It's not good in the long run
yeah but like...... i dont think im going anywhere with this either lmao
.property
@still merlin Did you define args the same way I did
<Object>.property```
For string properties such as `'dist-tags':`
```js
<Object>[<property>]``` @earnest phoenix
i am bored
Thanks.
what shall i add to my api
Idk but i fixed it
rate limits
So .property is the property I am looking for?
rate limits
Internet went down for a moment
Yea
Debouncing for data that doesn't change very often
Authentication
Try to improve your error handling
If your API is in a single file then try to separate it and check out how to implement common practices such as controllers and services
how would i add multiple requests to a command on python
like
.mute @/test 20 rude
yes
If you're using Discord.py's command framework, you can use that * syntax like this: py @commands.Command() async def mute(ctx, member: discord.Member, time: int, *, reason)
I think
alright
var userbank
try {
userbank = db.getData(dbpath.bank + userid)
} catch (err) {
console.log(err)
}
var multiplier = this.getMultiplier(userid) (Multiplier value is 1.05)
if(Math.sign(value) === 1) {
value = value * multiplier
}
userbank += value
db.push(dbpath.bank + userid, parseInt(userbank))
return userbank
}```Guys can someone please please help me, js is confusing me again. This is a function, where a value with a multiplier should be pushed into a database, but the multiplier should only be used, if the value of value is > 0. But somehow the multiplier is always getting used, even if the number is negative, it smh ignores the if
are you using your control statement (if) properly? I assume db.push is where you push to the database some more data, but you never tell it to exit or not run it.
It should work, idk because it always has worked, but smh the multiplier does not work
Does anyone know how to use custom emojis when trying to display a users status, I tried this .addField("Status", message.author.presence.status + \ :${message.author.presence.status}:`)` but it just said :dnd:
if(reaction.emoji.id === "740293919820218478") { // -
message.channel.send("Hola")
``` gives me ```ReferenceError: reaction is not defined```
but i have the id
reaction is supposed to be a reaction (probably) yet it's clearly not defined
var reaction = collected.first() add this @jovial nexus
๐ค
` } else
if (command === 'kick') {
const userKick = message.mentions.users.first
if (userKick) {
var member = message.guild.member(userKick);
if (member) {
member.kick('you have have been for breaking the rules.').then(() => {
message.reply(`kicked user ${userKick.tag}!`);
}).catch(err => {
message.reply('I was not able to kick that user.')
console.log(err);
})
} else {
message.reply('that user is not in the server.')
}
} else {
message.reply('you need to state the person you want to kick.')
}
}
})
bot.login(token);`
oops
Does anyone know how to use custom emojis when trying to display a users status, I tried this
.addField("Status", message.author.presence.status + \:${message.author.presence.status}:`)but it just said :dnd\: @still merlin you'd need to look in themessage.author.presence.activitiesarray and see if.typeis equal toCUSTOM_STATUS`
this wont work discord.js
You can then do .emoji on the activity
```
```
but you also need to be in the server the emoji came from
jeez what won't work about it.
ill give you the error code or something
(node:8508) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
your bot needs permission to kick a user
you can use this
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=kickable
to determine if a member is kickable
ok
What means UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access?
But what is Missing Access???
take a shot at guessing
Bro I would not ask if i knew it..?
it's self explanatory
When does this apper?
โจ brain exercises โจ
When does this appear?
when you're missing access
let's try this, when you try to enter a locked door, you're missing what?
access
pls just tell me to what it has not got access?!
when you're missing access
i will refuse to give you any other answer until you start thinking
im teaching you how to read and understand your own errors
@earnest phoenix
Learn to Google, read, & think for yourself
Some people are beyond help. We also must learn to accept this.
when you try do to an action you're missing access for
I know that
im not sure how it can be explained more clearly than that
But it somehow it happens at every command?
Like I said
Some people are beyond help. We also must learn to accept this.
How to set time in tasks.loop ? , i don't want to run it daily after 24h , i want to run it daily at 12 am. how can i do that
schedulers
in what language
i lost my crystal ball, can't read minds anymore sorry
I got mine right here
Lemme see... Hes talking about Python
magic
i lost my crystal ball, can't read minds anymore sorry
how much will a replacement cost
and don't say anything about a brain
about tree fiddy
Ok, I will tell it like that: My bot has never made any problems, but just now a guy added it to his server, and at every command he used, there was UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access? Does anyone have an idea why this appeared?
its a permission error
permissions
your bot is doing something it doesnt have access to
he hasn't given the bot all the perms it needs obviously
But it's not Missing Permissions
debug it then
it's Missing Access
see from which line the error is coming from
which line is it coming from
Just from discord.js files
@jagged sun
You need include in your code to check for permissions prior to executing a privileged command. And then make sure your invite link includes them.
missing access is a form of missing permissions
@jagged sun
You need include in your code to check for permissions prior to executing a privileged command. And then make sure your invite link includes them.
@faint prism I did that
missing access is a form of missing permissions
@solemn latch Do you know which permission?
depends on what your bots trying to do
just sending messages lmao
then it probably doesnt have access to those channels
^
But if it has permission read messages but not send messages it is Missing Permissions
sometimes
so i make a meme command with snekfetch and randompuppy, but when i try it whows this...
my discord.js bot stops playing a track three seconds before the end. The most interesting thing is that it works on my windows10 computer, and such a bug occurs on the Linux Ubuntu server.
There are no logs, or events..
yeah give me a sec i need to borrow a ๐ฎ to pull all relevant info out of your mind with โจ magic โจ
maybe a buffering issue of some kind?
ie it stops playing if its not loading something, so once the rest of the audio is loaded it stops playing?
use node-fetch
@earnest phoenix work at thesame way or i need chane the code?
every lib is different
it's pretty similar tbh
Maybe, my server not so powerful
look at the npm page for respective methods and samples
ok ill see
maybe a buffering issue of some kind?
ie it stops playing if its not loading something, so once the rest of the audio is loaded it stops playing?
I think so. I am loading audio from YouTube using Ytdl-core. What i have to do for fix, or just catch this bug in code?
does the same happen for longer audio tracks or does it cut off really early
whether it's a bohemian rhapsody or a one-hour version of Never Gonna Give You Up, the mistake happens at the end (yes, I did listen to the one-hour version of this track)
the github issues page for this issue seems to have a few fixes
if i want my bot to send a message that is greater than 2048 characters how do i delete the other chracters
like if the message was greater than 2048 how do i delete the excess
depends on your language
https://github.com/fent/node-ytdl-core/issues/402#issuecomment-457841788
Okay, i'll try it tomorrow, thank you
take the first 2048 characters in the string
๐ง
there are multiple ways to do this
a lot of which are documented and explained online already
discord.js
discordjs is a lib, not a language
you don't delete characters because that's not how programming works
javascript
a string is already allocated
a lot of which are documented and explained online already
@earnest phoenix
learn to use tools available to you to resolve your issue
id look into substring
Can i send a message to a channel in every server regarding a poll/change in my bot?
you can, but you shouldn't
it might be api abuse
it is api abuse
Hi
If i add a timeout?
its api abuse by nature
Oh API abuse as in privacy?
if you want to poll something, poll it in your support server
1 well every 15 seconds is useless wew
anyone know how to stop setTimeout from firing the first time
set Timeout doesnt fire first time afaik
@small prairie how to get bot developer badge?
get a verified bot
@flat hollow make a bot, get it to 75+ servers organically, apply for verification, Wait an eternity , get your badge
@small prairie k
heres the discord-developers server, it has a lot of info for that question
https://discord.gg/discord-developers
Ty
if I have a json like this { halp: "help",haop:"help"} how can I make it so a variable will find either halp or haop from user input in js?
"halp": "help"
}```
like variable.halp
https://oliy.is-just-a.dev/7rar7o_5398.png why not make an alias array
this pains me
how do you do that
that
@halcyon ember you probably want to structure your json as an array instead,
{
"help": [ "haop", "help" ]
}
i thought that was just an example object
๐คทโโ๏ธ
How do I make my discord py bot dm someone when they add my bot to their server?
just for an example
json Example vvvvv
{
"testVar": "somestring",
"otherVar": "A string"
}
js v
const test = "testVar"
jsonExample[test]
would return somestring
right?
well i make a meme command but yeet
module.exports = {
name: 'meme',
aliases: ['Meme', 'memes', 'Memes'],
description: 'Send a meme.',
guildOnly: false,
execute(message) {
const Discord = require('discord.js');
const Puppy = require('random-puppy');
const reddit = ['dankmeme', 'dankmemes', 'me_irl', 'memes']
const subreddit = reddit[Math.floor(Math.random() * reddit.legth)];
const img = random(subreddit);
const embed = new Discord.MessgeEmbed()
.setImage(img)
.setTitle(`From /r/${subreddit}`)
.setURL(`https://reddit.com/r/${subreddit}`)
message.channel.send(embed);
},
};
``` says random is not defined
no, you can't
yes you can
yunite does
you can't get who invited your bot
Yunite Does
You can, wym
Just have it DM the guild owner
kk
its not
Exactly
Its not but its the best you'll get
ok
Unless you make it check audit log
And grab the user from there, idk if discord.py supports that though
does audit log have bot invites?
ah cool
unless you go through oauth2 or query audit logs, you can't get who invited the bot
safest bet would be to go through oauth2 since audit log perms can still be turned off regardless whether you ask for it or not
but oauth2 requires more effort
oauth2 is shit
no it isn't
Oauth2 is used everywhere for a reason
@earnest phoenix if I do that how can I take a variable say command that has value of "haop" how can I make it find within the array and return "help"?
are you trying to add multi language support?
no
then what are you trying to do
I think the object method was right
im trying to make it so if you make a typo it will execute the right command
well i mean like a message like unknown command, did you mean this command
there's a tutorial for aliases in the discordjs.guide
you can add a couple typos
if you want
hmm
Might want to have two types of aliases, actual aliases, and typo aliases
A bit more work, but would allow you to display proper aliases separately from typos
hmm
how do i make it so only a certain role can use a command in python
loop through the user roles and check for the name/id
can i get a code rq lol
no
the code to everything is 42
Rule 7.
a. Donโt spoon-feed or attack beginners.
Everyone starts somewhere and asking questions is smart. Do not attack people for not knowing how to code. Point them to great learning sources and help them with problems.
However, you shouldnโt just give them finished code because then they only learn to copy more.
b. If you are a beginner, have a will to learn and do not expect to be spoon-fed.
Is there any black magic fuckery I need to use to make peerjs work because it's not working properly
yeah, its ez
Hi
i use quickdb to store my radios and f.e. i have radio1 radio2 and radio3
And it is stored like this:
[
{name:"Radio1"}
{name:"radio2"}
{name:"radio3"}
]
How do i delete radio 2
Google didnt help just made me more confused then before
say mother trucker ur moms a sucker, go to sleep b4 i go to sleep peerjs peejs work or dont work, peerjs peerjs, live or die!
e๐ ฑ๏ธpic
i need that for quick db tho
...
fetch it from quickdb and then delete it from the array?
has anyone here used contabo and galaxy gate?
i have 2 vps's on galaxygate rn
yeah, its ez
Share so I can sleep
i want to get a gg vps or contabo, dk which one, im swaying more to galazy gate but idk
contabo is known to oversell
ur prob better off going to stackoverflow.com since it seems not many people have used that here
Ayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
now someone who has used it will say something now
Please^^^
why tho
No
vxhelp
You get what you pay for
oh
:)
It's vx_kick me
lol
Nope doesnt do shit
Do anyone knows how can I add a server count in my bots status?
Yes
but why is conbato shit
Hey, does anyone know how to get user badges?
?
contabo is good
Do anyone knows how can I add a server count in my bots status?
@earnest phoenix client.user.setActtivity(client.guilds.size) | In JS
what language
@noble parrot wdym?
@digital ibex you get what you pay for
@sterile minnow OK thnx
thats not a bad thing tho
Unorganised computers
So from the user id, is there a way to get the badges on the user profile?
oh
Slow write speeds
js
Slow Internet speeds
discord.js
Gg has great Internet speeds from what I've seen
i still need help the thing on stack didnt do shit
client.users.get(user id).flags
thanks
n-p
i still need help the thing on stack didnt do shit
This is a very big mood
How i can be bot developer
Learn language of the computers
๐ฉ
You create a bot and add it to the site. Look in #502193464054644737





