#development
1 messages · Page 713 of 1
ok
simply read the error
it says "can't send messages to this user" this means they aren't accepting dms from server members
so you could encompass your code in a try/catch block
so these errors dont appear in your console/you can send error messages back to discord
for more information on try/catch please read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
Apparently channel isn't defined, but it is, or I'm just an idiot. Running discord.JS. The error:
at Object.module.exports.run (/root/DiscordBotApp/commands/tempmute.js:38:36)
at Client.client.on.message (/root/DiscordBotApp/server.js:178:17)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/DiscordBotApp/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/root/DiscordBotApp/node_modules/ws/lib/websocket.js:789:20)
(node:1283) DeprecationWarning: Collection#find: pass a function instead
(node:1283) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
at item.request.gen.end (/root/DiscordBotApp/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/root/DiscordBotApp/node_modules/snekfetch/src/index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
and the piece of code:
try{
message.guild.channels.forEach(channel, id)
channel.overwritePermissions(tomute, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
}catch(e){
console.log(e.stack);
};
Thanks in advance!
the thing is its sending the message and the users are receiving the message, so it obviously can send a message to the person so im stumped @valid frigate
and, will do, ty
@wooden lance call it as an actual function
?
forEach takes a function as it's first arg
any reason my bot could be going offline randomly after a couple of minutes?
no error or anything
it just goes offline and comes back on once i restart it
then repeats
what are you using to host it @gritty bolt
you using something like screen?
nodejs
did you look at the console?
when you close the terminal connection?
and it usually runs on a forever instance
install pm2
hmmmm
pm2 start {bot's main file}
^
yea but thats not the issue
it will then stay online unless it has unexpected downtime
it happens without forever
oh
weird
ikr
//ON DM MESSAGE REPLY
client.on('message', msg => {
try{
if (msg.channel.type == "dm") {
msg.author.send ("TEST MESSAGE",);
return;
}
}
catch(err) {
}
});
So this is what I've got so far, but errors keep showing up in console
I tried adding
catch(err) {
console.log ("ERROR TEST")
}
but that didnt show up at all, any idea whats going on?
the user dm'ing the bot gets the "Test Message" from the bot, and nothing else which is expected, but the console logs it as message unable to be sent to user
(node:26812) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
at item.request.gen.end (F:\desktop\Dappers Bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
at then (F:\desktop\Dappers Bot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26812) 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(). (rejection id: 2)
(node:26812) [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.
the user either has the bot blocked, or he does not allow dms from people who are not friends
Using discordjs and for some reason channel.overwritePermissions(tomute).delete(); is not working. Apparently it's not a function! Anyone know why it's not working?
wait
crap need to use .get lol
.
ok it's apparently undefined. wow im crap at this
@wooden lance try {...} catch (ex) {...} won't work in async calls/promises. You'll need to await or .catch it
i realised that. i removed it.
at textChannels2.forEach (/root/DiscordBotApp/commands/tempmute.js:102:55)
at Map.forEach (<anonymous>)
at Timeout._onTimeout (/root/DiscordBotApp/commands/tempmute.js:101:21)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
(node:2144) 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(). (rejection id: 5)
let textChannels2 = message.guild.channels.filter(channel => channel.type === 'text');
if (textChannels2.every(channel => channel.permissionOverwrites.get(tomute.id))) {
textChannels2.forEach(async (channel, id) => {
await channel.permissionOverwrites.get(tomute).delete();
});
}
@quartz kindle
thing is, the bot is sending the message and the user is receiving it, but it still shows that error in the console?
@wooden lance permissionOverwrites isn't a message object I dong believe and from what it seems, this code will abuse the api
you're trying to get a member object when the keys are snowflakes
rip looks like not going to be using that for muting then
Yup can someone help me for change presence of my bot
From play to watch ? (node.js)
client.on('ready', () => {
setInterval(function () {
var statut = [
`Faites s!help pour afficher l'aide.`,
`${client.guilds.array().length} serveurs. | Préfix du bot s!`,
`Préfix du bot s!`,
`${client.users.size} utilisateurs. | Préfix du bot s!`
];
var random = Math.floor(Math.random() * (statut.length));
client.user.setPresence({
game: {
name: statut[random],
type: 3
},
});
}, 12000);
});
type 3 is watching but not working 😐
it's activity not game | edit: let me check some more
are you on stable or master? You could pass the string name of the activity instead of number
@earnest phoenix I would set the delay to around 20000 at least
12 seconds is too fast
12 seconds is the absolute minimum
client.on('ready', () => {
setInterval(function () {
var statut = [
`Faites .help pour afficher l'aide`,
`${client.guilds.array().length} serveurs.`,
`${client.users.filter(u => !u.bot).size} utilisateurs.`
];
var view = [
`STREAMING`,
`WATCHING`,
`WATCHING`
];
var random = Math.floor(Math.random() * (statut.length));
client.user.setPresence({
game: {
name: statut[random],
type: view[random]
},
});
}, 120000);
});
not working too
ping me if you have to help 🙂
client.user.setActivity('TEXT', { url: 'URL', type: 'WATCHING' } );
@earnest phoenix
thats what I've been using to set watching
yup i know that but with intervalfunction it's possible ?
for look like mine
I had a similar thing before
I am currently looking for it
idk if ittl work ,I'm still pretty new, but try this
client.on('ready', () => {
setInterval(function () {
var statut = [
`Faites .help pour afficher l'aide`,
`${client.guilds.array().length} serveurs.`,
`${client.users.filter(u => !u.bot).size} utilisateurs.`
];
var view = [
`STREAMING`,
`WATCHING`,
`WATCHING`
];
//var random = Math.floor(Math.random() * (statut.length));
var viewrandom = view[Math.floor(Math.random() * answers.length)];
var statutrandom = status[Math.floor(Math.random() * answers.length)];
client.user.setPresence({
game: {
name: statutrandom,
type: viewrandom
},
});
}, 120000);
});
no clue if ittl actually work tho
I'm going to try
@modest basalt
not working
@earnest phoenix 😐
oof, one sec
yup it's not easy xd
it's like 3 days i try to fix many bugs on my bot like this one
he work but not like i want '-'
okay so i think client.user.setPresence only works for like, Online, Idle, Do not Disturb, and Offline
try this?
client.on('ready', () => {
setInterval(function () {
var statut = [
`Faites .help pour afficher l'aide`,
`${client.guilds.array().length} serveurs.`,
`${client.users.filter(u => !u.bot).size} utilisateurs.`
];
var view = [
`STREAMING`,
`WATCHING`,
`WATCHING`
];
//var random = Math.floor(Math.random() * (statut.length));
var viewrandom = view[Math.floor(Math.random() * answers.length)];
var statutrandom = status[Math.floor(Math.random() * answers.length)];
client.user.setActivity(statutrandom, { type: viewrandom })
},
});
}, 120000);
});
@modest basalt
nop
That changes it every 2 mins.
You will have to wait 2 mins before it's status will update.
hi, I have a question on connections. To send messages via eg curl your bot needs to authorize via the gateway. Since I can send curl messages after using discord.js, I suppose that plugin authorized for me .
now is this authorization permanent for that bot or will it expire?
Well using discordjs it doesn’t activate until you connect to the gateway. You can do it through curl with just using the bots token in the authorization header
you don't need to go through the gatway to send messages i think
messages are rest requests
i'm curious now going to test it out
but the strange thing is that the curl wasn't working with a 40001 error until I made a discord.js app for the same bot, after which it was working
yeah you don't need to through the gateway to send a message
mmm okay
I thought so because the docs say Before using this endpoint, you must connect to and identify with a gateway at least once.
they might mean once in a lifetime of the application by that
i'm using an API wrapper here but it shouldn't make a difference between curl requests because it's just REST
ok thx
Hi how can i detect when a new bot is adding on server and auto ban this bot if he's not in whitlist ?
ping me to answer
Not allowing people you can’t trust to add bots
One message removed from a suspended account.
Well in each command you can just add an aliases array and when you find commands u can get the command from collection and if it doesn’t exist then search for it using the aliases array
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Yes
the command handler would have have to deal with finding the aliases
One message removed from a suspended account.

hi
How do I make a system that gives a random number between 500 and 1500 (js)
Math.random
^
I dont think so
hmm
it wont
It was not
Math.random gives you a float betwren 0 and 1
oh
In js
Math.floor?
Math.floor(Math.random() * max) + min
^
/**
* Returns a random number between two values
* @param {number} smallNumber - The minimum returned value
* @param {number} bigNumber - The maximum returned value
*/
exports.randomBetween = (i, j) => {
let s = Math.floor(Math.random() * j) + i;
return s
}```
Oh thanks
@mossy vine if i put this code main file its will work?
@earnest phoenix if you are placing it in the file you want to use it in, replace exports. with const . if you are placing it a different file, make sure to import it
client not work?
client.randomBetween
no idea why you would do that tho
i tried it's saying function
You add it to client like that
Then when you want to use it, you do client.randomBetween(50,100) for exanple
You could also put
function randomBetween(i, j) {
let s = Math.floor(Math.random() * j) + i
return s
}
somewhere and call it like normal
i also said that
There is no need to create a variable just return the Math.floor or use an arrow function and do js const randomBetween = (low, high) => Math.floor(Math.random() * high) + low;
How do I make a Discord bot on mobile?
I'm on android
Not really
help pls
Then I don't know.
okay
@vestal axle I was talking to @fluid coral.
@vestal axle that's fine. Run the bot
this is;
client.guilds.filter(x => x.memberCount < 15).leave() true?
you can't use a method that's on an object on a collection of objects
Python:
Is it a bad idea to create own subclass list with a method to return the list's length
Just a question for discord.py, how do you check if a bot has perms?
Yours or another?
?
Which bot are you talking about?
my bot
For permissions that could be overriden by channel overwrites, use guild.permissions_for(guild.me)
wait what?
um ok, I was on about if the bot has certain perms on a server
how to check which ones they got for commands
Ik it is to do w/ @earnest phoenix_has_permissions but it doesn't seem to be working
Show how you are using it
Separate them with commas, not ands
It can't kick without the permission
You probably gave it admin permission
Also checking for admin perm as well as other ones is pointless
oh ok
no specific length
what do you want to do
Hey
+eval client.guilds.filter(x => x.memberCount < 10).forEach(x=>{x.leave()});
this
true?
👍
:D!
:d
?
what mean
this
@earnest phoenix is that original?
tag in dapi
probably made by one of the members
ah
What exactly is your error?
It can't find the directory it seems.
^^
well
have you checked to see if the file is in that directory
You could also use path to find the directory for extra measurements or uploading the image to something like imgur and just putting the image link
No problem 
I say using imgur is honestly just easier and removing attachFiles and only using setImage with the image link
you also save bandwidth
Yeah so it isn't uploading the image every time the command is executed
I've got a <div> in between two other <div>s, is there a way I can automatically center it?
<div style="width:40%;height:4vw;margin:auto;">
<a href="[redacted for brevity]">
<button class="hlink iabInviteAdmin hButton"
style="float:left;">
Invite to Discord (Administrator)
</button>
</a>
<a href="[redacted for brevity]">
<button class="hlink iabInviteLow hButton">
Invite to Discord (Lower)
</button>
</a>
<a href="[redacted for brevity]">
<button class="hlink iabInviteAdmin hButton"
style="float:right">
iab Discord Server
</button>
</a>
</div>
.setURL('My-url') I guess ?
Is there any way to run multiple "setIntervals" at the same time?
I want to run things almost like cron jobs but much more often, like a couple times per minute
but ya know JS is single threaded
return new Promise(resolve => setTimeout(resolve, seconds*1000));
}```
Inside a loop?
I've got a <div> in between two other <div>s, is there a way I can automatically center it?
please learn how to use css flexbox that snippet is a disaster
yeah I just offloaded most of that style garbage to css
I think disaster really defines my command reference lmao
but I'm getting there
I want to run setIntervals like these simultaneously```js
setInterval(async () => {
await fetch('https://an-api-here/', { method: 'POST', body: { blah_blah_blah } })
console.log('(1): Done again or whatever')
}, 1000 * 30)
setInterval(async () => {
await fetch('https://another-api-here/', { method: 'POST', body: { blah_blah_blah } })
console.log('(2): Done again or whatever')
}, 1000 * 15)```
@vocal phoenix
I use this site way too often
depends on which browser versions you need to support
and text-align: center on parent
you're very welcome
@opaque eagle
while(true){
//use globals or outer scope variables to break the loop if necessary
functionHandle();
await this.wait(secondsBetweenCalls);
}
}
async wait(seconds){
return new Promise(resolve => setTimeout(resolve, seconds*1000));
}```
Try defining those functions then pass them into a function like this one.
Come to think of it, you should be able to pass in an anonymous function as well.
#LambdaGang
is there a function that shows when your bot joined the guild the command was fired on? I want to have it in the info command
Yo do you guys think this looks good? https://iabbot.github.io/
I want something like message.member.joinedAt but for the client, and not the user
Yo do you guys think this looks good? https://iabbot.github.io/
it looks like my old myspace page
@earnest phoenix Why is the header font size smaller than the bulk text font size?
@tight mountain Not sure what you're asking.
For the parameters and description headers?
Yeah.
They're not really supposed to stand out as much as the information
I feel like having them be like h3 size or something would be emphasizing the header a bit too much
Looks odd to me.
@tight mountain get the bots member and get the join time of that
@vocal phoenix message.member.joinedAt would return a time and date for when the person who sent the command joined, but I want to have the time and date for when the bot joined the server
o
This is a question that will make or break my bot: so I need this to be before the bot permissions check, how do I do this?
Why do you want it before the permission check?
Jaylon why
is it possible to make the check in wait_for in discord.py async, when I try to await the function it returns an error
return true```
@golden herald whats that on the bottom line of your screenshot?
just wondering what elliotid, jayid etc are, and why theyre hard coded into the source code 🙂
@green kestrel probably ids for the owners/developers of the bot
considering the first one says kiyanid
i figured, i was dropping a not so subtle hint that it's not really a good coding style and that there may be better ways
😉
Trying to make bot send a message every few hours or so. I keep getting this error when trying to find a guild/channel. ``` client.guilds.get('627296126537564162').channels.get('627296126537564164').s
end("test")
^
TypeError: Cannot read property 'channels' of undefined
at Timeout._onTimeout (C:\Users\Kerigan\Desktop\Hello\bot.js:95:44)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)```
Still get same error
i was wrong fuck me
I copy pasted it from my other bot, i dont see why it isnt working
try to check if the guild exists when u get it
How to JavaScript kick Command please help me
@tulip tundra bro please provide clear massage command in discord.js in prefix change😭 😋 😅
search how bulkDelete works
is help command better in DM or just straight up text in server?
But not working command
All command fake not real command in online
Please provide me real command
@winter basalt your bot won't get approved if its dm
yes
@tulip tundra smh it will
25 fields is the limit.
@winter basalt both work but i prefer help commands in-server
im sure its down to personal preference
🤷
mm ok
@dusk cargo we do not spoon feed code here
thanks for the asnwer
np
my bad then
https://discordjs.guide/popular-topics/embeds.html @winter basalt
A guide made by the community of discord.js for its users.
wrong ping
Why is my bot taking a lot of time to upoad my imgur link ?
Is this because of me ?
Code?
anyone here use Dart?
I use a dartboard
😂
error:
(node:94466) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'avatarURL' of undefined
code:
.setAuthor(member.displayName || message.author.username, member.user.avatarURL || message.author.displayAvatarURL)
member.user is unedfined probably (just a guess tho)
lmao
done
.setAuthor(member.displayName || message.author.username, member.user.avatarURL || message.author.displayAvatarURL)
it works with @mention but comes with error for no mention
Well that just means you have to redefine member if it’s not in a mention, make sure you’re getting member again rather than a user cuz user.user doesn’t exist
displayName is never not defined. Unless member isnt defined. So no point in having the other cases
any one can give me idea how to store users previous nick names ( last 10 nick names )
?
an array list?
You'd have to update a database on name change
if i use array list ,then i need 2d array ?
why would you need a 2d array. If anything it should be an object with an array of nicknames mapped to their id
👍
im currently working on a web dashboard for my bot
is there anything obvious that most people overlook when doing this, that i should watch out for and avoid, or do?
heres what i have so far:
My question is why that top bar takes up a quarter of the screen
that's kinda different tho
dbl's has multiple useful functions
with that one I can see a single button in the top right
hmm
Maybe if the header had something a bit more going on aesthetically or something, it would look a bit more alive, similar to how dbl has that little image on the right
^
Google has an extensive api
hi
hello
i have a bit trouble with the mongoose
the bot can't write to database
idk if the url is right

is there anyone who can help me with the mongoose?
just used it for the first time and idk how that works
I would recommend mongodb over mongoose as it's the native driver, but that's more of a preference
I write !7Caresse at 7:46 Am
you spelled attachment wrong in your code
ok
then
that's not a direct link to the image
visit the link in your browser, right click the image and copy the image url
Ok tx 😄
It works ! 
Im Not Sure If This Is The Best Channel To Do This, But On The Website For The Discord Bot List, It Is Making Me Sign In Through My Old Account. And I Cant Seem To Sign In Through The Website Through This Account. Is There A Way To Fix This?
Ok
Hello, do you know any anime API for Discord bots?
Thx bro
Skipper, the best answerer of questions
@tulip tundra ```setInterval(function(){channel.send("test")}, 10000);
^
TypeError: Cannot read property 'send' of undefined```
get different error
heres the code var channel = client.channels.get('630431103051890701') setInterval(function(){channel.send("test")}, 10000);
the channel wasnt found
But why? It's on the server, and it has permission to send to the channel
i was browsing a1 vpss bcause i live in austria
lemme check galaxygate
@slender thistle does galaxygate support python
They're literally your usual machines
they are not limited to a certain programming language
@slender thistle does galaxygate support mac
or linux
when it comes to deploying and running apps
@cold canyon most providers support linuz
i give up on vps
you shouldn't host debug builds on your vps anyways
compile them and then host
you can even dockerize
Vectors is just a fancy name for arrays?
{a1,a2, ..., an}
I would reccomend docker, it makes it so easy and quick to deploy. Worth the learning curve
wouldnt docker be overkill for a simple discord bot
i am using moment-timezone module to do this code, but when it logs, it does not use the timezone specified and the 24 hour is not working
https://downbeat.is-inside.me/a4Cvyfak.png
how could i rewrite this code to not use eval and still have the same result?
const render = (html, args) => {
start = html.search(/{{/)
end = html.search(/}}/)
between = html.substring(start, end + 2)
evalThis = html.substring(start + 2, end)
html = html.replace(between, eval(evalThis))
console.log(html)
}
render('<h1>Hello, {{args.user}}!</h1>', { user: 'Cyber28' })```
.... parsing html with javascript
my god
I am reminded of... the post.
https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
is there any way to attach a database connection to the sharding manager so that each instance of the client can access the database connection without having a db connection per shard
@crystal saffron @west spoke i know there are better ways to handle the parsing, but what about not using eval?
each client needs a database connection because they are seperate processes
unless you use something like ipc to tell the master process that you wanna do X and wait for Y response, it isn't possible
does not matter...
same as for ban
^
BAN_MEMBERS
ooh ok thanks
or in number 4
number 4?
how to add role to all ppl in the server without getting rate limited in discord.js?
@earnest phoenix sry for ping but can u help me?
respect the rate limits
but theres for sure a way
There is no way to do it
Expect getting banned from discord for adding a role to like 20k users at once
in antispambot they have it
@mossy vine Have you tried nested template literals?
5 sec should more than enough
i wanna respect the rate limits thats why im asking
@vocal phoenix wdym
5 sec between one user?
yeah
ok
how do i make a for loop and wait 5 seconds before im sending the next request?
like im doing .foreach
how do i wait 5 seconds
Or just use setInterval
@mossy vine
I was thinking something like this:
html = String.raw`${ `${html}` }`;
return html;
}
var x = render('<h1>Hello, ${args.user}!</h1>', { user: 'u' });```
but that doesn't work. If you only have keys that don't have subobjects
```const render = (strings, ...keys) => {
return (function(...values) {
var dict = values[values.length - 1] || {};
var result = [strings[0]];
keys.forEach(function(key, i) {
var value = Number.isInteger(key) ? values[key] : dict[key];
result.push(value, strings[i + 1]);
});
return result.join('');
});
}
var exampleClosure = render`<h1>Hello, ${'user'}!</h1>`;
console.log(exampleClosure([], {user: 'username'}));```
from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals will work.
@earnest phoenix
https://discordapp.com/channels/264445053596991498/272764566411149314/634130347826872331 just replace the while loop with a for loop.
Hey, why it tells "message" is not definied?
All commands work
S
But this idk, won't get "message"
Help
when I try to add the smoogle translate bot to my server, it doesn’t show the “Authorize” button. Any one have insight on why this happens / how to fix?
<@&265158261945270273>
- this isnt the support server for smoogle translate
- if this was the right server, this would be the wrong channel
- smoogle translate doesnt have any control over the authorization page -- that would be discord
- dont ping the website admins unless stuff is on fire
to answer your question though, you sometimes need to scroll down. its a bit finnicky sometimes
@lusty ridge
still get ```setInterval(function(){channel.send("test")}, 10000);
^
TypeError: Cannot read property 'send' of undefined```
when i try to use var channel = client.channels.get('630431103051890701') setInterval(function(){channel.send("test")}, 10000);
I have tried different servers and different channels, still get same error
When I run it in glitch.com or something (i know glitch is a big no no), it works, but when I run it on local machine, it gives the error.
the channel does not exist with that id or is not cached
@tight mountain that is gonna send "test" to the channel every 10 seconds.
Would anyone know a solution as to why this is showing up while launching my bot
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/getlimits.py:499: BytesWarning: Comparison between bytes and string
self.dtype = numeric.dtype(int_type)
running python 3.6 with discord.py rewrite
By the looks of it, you're comparing an array of bytes to a string. It's probably giving you a warning because one is being implicity cast to the other, which can be a bad thing. Pic semi related.
@manic basalt
How to give an output of a link in discord dot js using markdown? Im trying to have the link be shortened down to a string, and i have already tried [SiteName](url)
Hyperlinks only work in embed contents
it is in an embed
this is my code:
if((args.includes('https://google.com'))) {
site = 'Google';
url = args[0];
}
//Output it in an embed using [${site}](${url})
this didn't work
Use the author field of the embed.
Which field is that
if((args.includes('https://google.com'))) {
site = 'Google';
url = args[0];
embed.setAuthor(site, null, url);
}```
Hyperlinks can be done in field values and descriptions
Does it display the whole link though or can you have some alt text that appears instead of the full link?
smh no shitposting
I didn't realize embeds have markdown. Why is it limited to embeds?
Imagine rick rolling someone
they wouldnt be able to know
[Free robux111!1!](some link)

links are spoopy
that also shows up in embeds as a redirection warning
why cant humans use it as well smh
It looks correct, but it gives 2 errors.
if(!message.member.hasPermission("MANAGE_GUILD")) || if(!message.author.id == "596879758244053002")
return message.channel.send("You do not have permission to run `setprefix`.");
Combine the 2 conditions in one if statement
Using ||
and it wouldn't be a bad idea to use === instead of == because the id should/will always be a string
fixed, thank you :)
also
a more efficient way of running permission checks like these is to have a message handler
sits in between your message event and the command, and does stuff like verify permissions etc
export a prop in your help object like permissions: ["MANAGE_GUILD"]
whenever i try to install an npm package, i get this error
by the way, i tried installing "canvas"
https://pastebin.com/NEhqJ0QY
raspberry pi, latest raspbian if that helps
and also i tried discord-leveling
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp```
Make sure pixman-1 is installed and location is defined in PKG_CONFIG_PATH.

Idk
It failed to get prebuilt binaries, so it needs to be built from source
Building from source requires all packages listed in their npm/github page in the building from source section for your operating system
For example, for ubuntu, you need to install the following packages (in ubuntu using apt, not on npm) build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
does someone know a good vps hosting provider?
You know I always find it funny
Has a hacker/coder pfp
Can't even code their own shit
^ ikr
So no, @modest remnant
We will not be giving you links or code for a music bot in python
Is there a way to get bots with a prefix in the api?
(javascript / node.js)
Like to get all bots with a specific prefix
(The api = dbl api)
i think you can use this
problem is
oh wait
the problem is i cant find a option to get the bots with a prefix
yeah iirc there is no way for regular users to access all bots with 1 endpoint
yup, there is
there are 2908 bots with ! prefix
example searching for a! prefix:
you can get up to 500 bots per request (but you get a number showing the total amount of matches regardless, and you can navigate them by offset)
and you can search by several fields
and how can i?
I tried to find but i couldnt
@quartz kindle
so what sorting method do i have to use
you have to make an https GET request to top.gg/api/bots with the query parameters you want, and your dbl token in the authorization header
for example https://top.gg/api/bots?limit=50&search=prefix:a!
Thanks
so on the api this would be
wait
dbl.getBots({ prefix: 'a!', limit: 100 })
no...
im dumb
Ok
i saw that and i tried to do it with query prefix: 'b.'
but
it returns
all
bots on dbl
give me complete guide on dblapi
dbl.webhook.on('vote', vote => {
let upvoteLogChannel = client.channels.get("634779916575178762");
upvotesDB.add(vote.user.id, 1)
upvoteLogChannel.send(`**${vote.user} upvoted the bot.**`);
console.log(`User with ID ${vote.user} just voted!`);
});```
Nothing?
happens
thanks
@pliant iron is your webhook configured correctly?
I believe so
did you configure it in your bot's edit page?
what link did you give it?
The webhook link I made in the server
which is?
Wait I think I defined it wrong
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
ok, and what url did you put in the website?
Do I put the bot's api token there and the second underlined thing as the webhook token?
ohhh
Oh
i mean, you can do that
but that will send it directly to a discord webhook
not to your bot
and probably is not compatible with discord webhooks
What am I meant to do?
the webhook needs to find your bot
your bot opens a webserver in port 5000
so depending on where and how your bot is hosted
you probably need to put "http://YOURSERVERSIPADDRESS:5000/webhook"
or something similar
Hold up
if you're running in glitch or heroku, or you have your bot running behind some proxy, you will need to use something different
It logged this http://0.0.0.0:5000/dblwebhook
yes, 0.0.0.0 is a null adress, its the same as saying "this machine"
its not an actual address
oh
you need its public ip address address
I use glitch
where is your bot hosted?
glitch is different
they have their own way of doing things, something along the lines of "yourusername.glitch.com/yourprojectname"
or something like that, i dont remember
Is it the project link?
or
https://exvay-bot.glitch.me```
For uptime robot I use https://exvay-bot.glitch.me
then try https://exvay-bot.glitch.me and set up your dbl.webhook with port 3000
gtlch only alows you to use port 3000
afaik
{ webhookPort: 5000, webhookAuth: 'password' });
webhookPort 3000
right
that is correct?
Because I get this error
const dbl = new DBL('token', { webhookPort: 3000, webhookAuth: 'authpasshere' });```
```events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at DBLWebhook._startWebhook (/rbd/pnpm-volume/b8b6183b-9298-4f5f-8951-dee24b437c0c/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/rbd/pnpm-volume/b8b6183b-9298-4f5f-8951-dee24b437c0c/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/rbd/pnpm-volume/b8b6183b-9298-4f5f-8951-dee24b437c0c/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (
:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)```
@quartz kindle That error comes when the port is 3000
This is just a question, but how would I return a value if say someone loaded nbapi.neko-bot.net/api.html eg a number.
Perhaps rerouting to a self-hosted site and return that with node?
Or maybe force a reload through the http request?
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermission(muterole, {
MANAGE_CHANNELS: false,
SEND_MESSAGES: false,
ADD_REACTIONS: false,
CONNECT: false
});
It says channel.overwritePermission is not a function in console, what's the error?
It's overwritePermissions
Is it possible to stop a user from editing his/her message!
@pliant iron try webhookPort: 80, and in dbl https://exvay-bot.glitch.me:3000
wait, no
that wont work either
do you have anything else running in port 3000?
oh wait, you have the uptime bot on port 3000 no?
thats the problem
you need to remove the uptime robot
or you need to connect dbl to the existing server that uptime robot creates
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });```
aight
What's perfered Linux or Windows for running my bot?
linux
to legally run a bot on a windows server you would have to buy a windows license
I already have Windows server
Licenses
Regardless why would Linux be better?
it is safer
linux has standardization, no bloatware, it's more common in the general career path of a developer and many deving systems are designed to run on linux
system usage headroom
and linux also has awesome developer tools
i do deployments to a dokku instance on a debian server which means deployments and database linking etc. is just a single command
Are you a developer?
Linux Better
Are you a gamer?
Windows Better atm
that's dumb logic
dumb logic but pretty accurate
you use a platform for what you need it for, not on what you are
i am a human
I am a gaming youtuber, I will use Linux which has less gaming support
that's what all AI say, teemaw 👀
i am not an ai
there are also quite a few youtube channels that do linux gaming
ye
👀
I will not move fully to Linux until my main games work on linux
fair
i couldn't imagine my main machine being linux
I could
i can
kk
as it is for office work not for gaming
ya my laptop has macos for that reason
i switched to linux only a few months ago
yeet
not regretting it. if i have any ms office work to do, i borrow my moms laptop which is running windows. otherwise, linux is perfect
Office Online
lol exactly
yeah office online exists
also Libreoffice works with docx
although i use office on my ipad
nah third party docx support is yikes
same with pptx
I mean Libreoffice works fine for me
i actually need to import pptx into powerpoint then export to pdf for it to work
the license we get for free as students dont seem to work with office online, and parents have licenses from their schools so whatever
lol weird my student license works fine
Login to your account and it will work
office online is just prompting me to bUy PrEmIuM
i actually just dont think i would enjoy using linux on my primary machine from all the extra work i would have to do
and all the sacrifices i'd have to make running third party software
Libreoffice is normally preinstalled so there is your office
my school email comes packed with licenses for a lot of microsoft products
hell even on my macbook i miss windows lol
Thunderbird is preinstalled on some distros
which is an email client
if I remember correctly
yes
does adobe creative cloud work on linux?
lol it's also a hassle trying to find alternatives for software you're already accustom to and then becoming fluent in the alternatives
ye
also works the other way though cause i do a lot of dev on unix environments
anyone proficent at discord api
Gimp is good for a photoshop copy if I remember correctly
i wanna know every type format thats allowed in discord embedding
@unique nimbus ya problem there is having to learn a whole new image editor
you are only allowed to use standard image formats
true
mildly dissapointed but its good enough smh
you're not allowed to put videos in embeds for obvious reasons
what reasons?
ear rape/nsfw
cant you abuse it just as easily outside of an embed
you could just send a video link then right?
idek what their decision is well
no video it is 
i'll bypass it by making the bot send it outside of embeds
Lib: Discord.js
Has anyone a idea how i can change the guild icon the command was executed in?
Because i cant happen to find anything releated
stable or master?
v12
Thanks
hello all
how to make code to read every last messages from a guild?
if (msg.content === 'Julia')
for example like if message contains anything
Do you want to check if a message ends with a specific string? @restive light
no i want to check every messages about anything
i want deliver last messages to my another server with my bot
I'm confused about what you mean by "last messages"
basically if someone sends a message then send same message to x server
message event -> get the channel you want to forward the message to -> send the message's content to the channel
no, you can't
browse the docs and try to logically connect what i just said to the terms in docs
every method, event and property is thoroughly described
why im the only one who cant get any sample codes here
still everybody gets samples when they wants
where did you get that fact from
i see many ones asked and people wrote samples to them
ok, you saw
this server has a no spoonfeeding rule, so no, not everyone will get spoonfed the code
people are encouraged to do their own research because it will stick with them more than just giving them the premade code to copy paste
man i didnt say "can you write corrected code for me?" i wrote sample code
with explains
lmao
-Can you show me a sample?
go search google
That would be incorrect
learning is showing some basic samples
You were given the logical actions to apply in order to get the desired result
for an average developer willing to at least learn, that should be enough by itself
maths is not comparable to using a programming library
maths is a term comparable to a language
Not sure why you would need an example to get a channel from cache
Oke i solved my problem: if (receivedMessage.content.includes(""))
Why would you need an if statement
?
not you
Not me oh ok
@restive light you dont need that lol
if you want to process all messages, just remove that if block all together
// before
if(message.content === "something") {
message.something
}
// after
message.something```
Conditional algorithms be always true 
@lofty hamlet you would need to change that loop from string building to array building. another way is to create a position variable and fill it up if the user id matches
@quartz kindle ok ok you can explain me or send me and explain ? :d
for example ```js
let content = ""
let position; // this
try {
for (let i = 0; i < 10; i++) {
let user = bot.users.get(lvl[i].ID.split('_')[1])
if(user.id === message.author.id) { position = set position here } // this
if(position) { user has a position in this list } // this
content += `${i + 1}. __${db.get(`MV3_${user.id}.pseudo`)}__ - **${lvl[i].data.nombre}**\n`
}
} catch (err) {
console.log(err)
}```
Mmmh
Hey, I'm using Eris with TypeScript and when I'm trying to import Eris using import Eris from "eris", I get the following error for the Eris constructor:
This expression is not constructable.
Type 'typeof import("eris")' has no construct signatures.
I'm relatively new to TypeScript and also tried looking for open source projects that use TypeScript in combination with eris in attempt to solve this issue myself, sadly without any luck.
Any idea what I'm doing wrong?
I do change what @quartz kindle ?
@stable pollen did you try import { Eris } from "eris"?
🤔
that gives me Module '"eris"' has no exported member 'Eris'.
position = set position here
user has a position in this list
I do change this for what ?
@lofty hamlet whatever you want to show, i dont know what data do you have in your database
This :
if you want to show only the number, you can probably just use the loop index
@quartz kindle Got help from people on another server, apparently I need to do import { Client } from "eris"
@stable pollen how about import { Client } from "eris"?
🙂
Me ?
no, marvin
Oh ok :issou:
where do you want to write the position?
ok, so then do what i said
let position;
in the loop, if the current user is the same as the author, define the position
Mmh
You can edit my command and send and explain i'm tirtred and i'm backa man when i'm tirred
im not gonna do it for you
:issou:
// this is a loop. on each step of the loop, the user is different. you need to check if the user that is currently being processed in the current step is the same as the author
for (let i = 0; i < 10; i++) {
let user = bot.users.get(lvl[i].ID.split('_')[1])
//
if(user.id === message.author.id) {} // this will check if the user is the same as the author. if this is true, then you need to set the position in the variable outside, and use it in the footer
//
content += `${i + 1}. __${db.get(`MV3_${user.id}.pseudo`)}__ - **${lvl[i].data.nombre}**\n`
}```
But the author is not on the top 10
if the author is not in the top 10, then you need to get its position from the database
How ?
🤔
Lvl.find mmh ok
or .findIndex() assuming the array is already sorted, which it should be
I want just add in footer the position in the classment
You can just send me what i do make ?
The .find or loop ?
lvl.findIndex()
Yeah but with quick db and my database
you have lvl, thats your array
anyone can help me ?
Does StreamReader.ReadLine in C# include a \n at the end?
@manic light db.fetch must not return a promise then.
@amber fractal so whats i need do ?
idk what db your using so you'll need to read your db's docs
quick db
how do you add button thingy?
me ?
button thingy you gotta be more specific than that lol
How to delete a sent image in a specific channel using discord.js?
if(message.channel.name === "testing") {
if(message.attachments.size > 0) {
if(message.attachments.every(attachIsImage)) {
let Attachment = (message.attachments).array()
Attachment.forEach(function(attachment) {
Attachment.delete();
});
}
}
}```
This doesn't seem to work
it stops working at Attachment.delete()
would just message.delete() work?
for discord.js
is there a way to set a specific userID for command permissions?
i might have missed it
I saw stuff about setting roles that can use three bot commands, but I only want a specific user to be able to use it
check to see if: javascript if(message.author.id == userID) { //if sender is userID, then run this code. }
thats for a specific command
no problem
Is anyone here experienced with loading a bot onto heroku? I keep having error messages
Hey my bot uses search results to play song I was that it plays first song of search result
Like rythm
Can anyone help
I won't be much help, dont have much experience with that, but id love to hear the answer. Trying to make a bot that does webscraping on a specific site to output data, so this might help
this is similar to what i am trying to do: https://blog.miguelgrinberg.com/post/easy-web-scraping-with-nodejs , which will obviously not include the ability to play the song.
I have a question, if my Bot Contains 2-3 Copy and Pasted Commands, is that ok?
I have 20 Selfmade Commands rn
i think that is the wrong channel but yes, i think it is
Ok ty
If I'm not mistaken everything in client.guilds.(guild).members.(member) is already cached?
?
how to make bot?
How to make it show the number of players in the game?
have you bothered to read #502193464054644737
show the number where? in which game? @earnest phoenix
Game SCUM number of players on the server
whys that?
on chrome book?
Download vs code
Make a bot
with programming it
and then 3.
stop giving dumb instructions
Node index.js
@earnest phoenix stop whatever you are doing
not helping
stop living? i would if i could ngl
mailchain is terrible to read
If he asks basic stuff like "How to make a bot" and then after reading faq still asks how to then i give him instructions how to
because they didn't read the faq
anyways
@earnest phoenix #502193464054644737 last entry
i um.. i not even how programming-
search up how to code js or python or whatever you want to learn
or if your a alpha male you could read docs
help yourself





