#development
1 messages ยท Page 645 of 1
It also has a very detailed documentation that you can follow
Don't use a sample-database. They're not exactly meant to be used :P
i can create multiple tickets, why?
code => http://paste.dapper.codes/qaduzulomi.js
im using typescript btw
you shouldn't rely on discord as your data source, especially not on the user's username and discriminator
Use ID at least
someone can change the channel name anytime, the channel can get deleted, the user can change their username/discriminator
for tickets it's best to store the channel id in a database
^
that's fine...?
The ID is gonna be the same length as normal
imo using id in the text channel looks bulky an unappealing and it still doesnt solve the issue of someone changing the channel name and your thing breaking
ID always remains the same
for my mod bot which has a case system i rely on id saved in a database only, you're proofing your bot that way
i could put the id in a map
and remove it from the map after the ticket gets closed
better, but presents a problem of not being persistent
the map'll get reset if the process gets closed
yes
although being c#, this is my model which is being saved to a sqlite database https://github.com/strangenesX/quiccban/blob/master/quiccban/quiccban/Database/Models/Guild.cs#L14
What's the problem? I know C#
nah it's nothing with me, they had a problem with text channels and i suggested a database system instead of relying on text channels
Ah okay
i have a problem though
i can't figure out how to add permissions to created channels
im not using hastebin btw because I can't click save :( https://gyazo.com/69b5fa106e41f5a271cc61cfaede4b29
hastebin often breaks, there's clones like https://paste.mod.gg
What's the easiest way to make a chart out of values in a postgres db?
rn my bot is recording the # of players in a game into a db once each minute, but I'd want to make myself a dashboard where we see the values per month/year in sort of a dynamic way where u can scroll and move around the graph
well I used the word "bot" cuz this is supposed to be about bot dev or so I think
If the users are not informed
how can i tunnel local ports? so like if i have something hosted on :25565 (joke but fr) and i wanna make it able to be connected by localhost:123123 is there some sort of command line something thatll let me do that without using nginx or something like that
non http btw
temporary too
make a redirect on the second webserver?
all local
but yes the redirect. theres no way i can find to do this properly tho
without something bulky and uneeded like nginx
Can't you just tell whatever's on port 123123 to connect to Minecraft?
It's local anyway. No port forwarding needed
yea
Is a message link just guildId/channelId/messageId?
yes
thank you
Would 500ms be a good delay between messages for a bot?
what for
Depends on how many messages in total you're sending
What are some good node modules to use for creating an image like mee6 or some other bots?
hello! what programming language do i need to know to create a bot?
Depends on what ya want. I recommend js
@hardy wing any language that can do http requests really
yes..
ohh I can use C# for discord?
yes
yes
is there a specific software that I can use? for creating discord bot?
you mean IDEs?
so I can use Visual Studio?
yes
of course
thats just basically what we are using in school
for C# development, visual studio is probably the best ide
i mean i see
uh
npm WARN tar ENOENT: no such file or directory, lstat '/app/node_modules/.staging/rxjs-8e24fc07/_esm2015/internal'
npm WARN tar ENOENT: no such file or directory, lstat '/app/node_modules/.staging/rxjs-8e24fc07/_esm2015/internal'
npm WARN tar ENOENT: no such file or directory, lstat '/app/node_modules/.staging/rxjs-8e24fc07/_esm2015/internal'
npm WARN tar ENOENT: no such file or directory, lstat '/app/node_modules/.staging/rxjs-8e24fc07/_esm2015/internal'
npm WARN tar ENOSPC: no space left on device, write
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npm-cache/8.15.1/_logs/2019-06-28T21_29_30_798Z-debug.log```
what did mean
yeah dont use glitch. if builder is right and it is indeed a storage issue, youre screwed
then what should I use
a proper vps
such as?
check pins
there are a few pinned in this channel
Looks fine to me.
Alright ty.

yeah, doesnt look like theres much/any css + not very detailed
also the short description isnt very useful
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.
One message removed from a suspended account.
do you genuinely have like... issues? you seem to have extreme reactions to literally everything and I'm beginning to doubt that it's a meme.
One message removed from a suspended account.
One message removed from a suspended account.
Seems like it
@inner jewel i need it for windows, i found a bunch of those but only for linux
One message removed from a suspended account.
One message removed from a suspended account.
You don't need to ping me in Dev
One message removed from a suspended account.
@slim heart http://woshub.com/port-forwarding-in-windows/
Why do you use Async/Await with Accounts but a callback with Gold?
Also, you completely Butchered the callback
You have a callback function in JSON code
right perfect ill just set up a batch script around it ty
@sage bobcat
You also put a callback INSIDE of a callback that leads to nothing INSIDE of JSON code
what code for player online ? 
One message removed from a suspended account.
No
One message removed from a suspended account.
That's not the wrong server
One message removed from a suspended account.
on server
One message removed from a suspended account.
One message removed from a suspended account.
yes
@rugged kelp client.user.setActivity('whatever')
no
Oh. I can't help you there bud
offline and online members
Haven't done anything like that by myself. Just server user count
Guild.memberCount is for the amount of member in the server, online or not
for online ?
Again, not so sure about that
Yeah. Not that I could see. Unless somebody else can help you with that, I can't see anything about checking online vs offline status
Just the total amount of member in the guild
nvm. found it. lmao
just for context .members will only be thing presented to the client meaning some members may be uncached so use .memberCount for the total number of members
GuildMember.presence.status has that info
There you go
Now I don't think it's a good idea to check this all at once due to maybe being rate limited, but doing so for like a single user's status at a time is fine
na you can filter through it no requests needed
something like js Guild.members.filter(x=>x.presence.status === 'online').size
I keep forgetting collections are a thing
:/
@sage bobcat You may just want to scrap that code and do it again, but this time use await like you did with accounts, since I know you can at least do that
jesus derp moment, .size*
I was about to say, it may be .size
my brain went 
message.guild.online.memberCount It's good ?
message.guild.members.filter(x=>x.presence.status === 'online').size
That's what you want. lol
Just change online to offline for offline people, dnd for dnd people, etc
It's documented
thnaks
np
and how to define ?
This is code
You probably meant to use channel*
https://discordapp.com/channels/264445053596991498/272764566411149314/534107507220807695 Also, this for debugging
:/
@rugged kelp on line 8 you spelled mentions wrong
But yes thatโs the only help youโll get you need to learn how to read error messages yourself
=] thanks
Why did I think that was a custom class? I need to do normal js again
const client = new discord.client();
^
TypeError: discord.client is not a constructor
What does it mean it's not a constructor? Never had this issue ever
capital c
I use capital D so that could also be it, but regardless you need a capital C for .Client
const discord = require('discord.js');
const client = new discord.client();
client.on('ready', () => {
console.log('Online!')
client.channels.get('594346571450155008').send(`I am online!\nIn ${client.guilds.size} servers and for ${client.users.size} users!`)
client.setActivity('In Development', { type: 'PLAYING'})
});
client.on("message", (message) => {
if (message.content.startsWith("ping")) {
message.channel.send("pong!");
}
});
client.login('token')
Yeah ok so then it is just new discord.Client()
Sorry about that then, some just do capital D so I figured that I would ask
So capitalize c?
yes
Wait client.setActivity isnt a function?
Make sure you capitalized the .Client not the const client
i did
I think it's client.user
what linguine said
Yeah he is right
You can't change the activity for Client, you change it for ClientUser
I see
client.user, please read the documentation.
If something doesn't work, you can always try googling it with the keyword discord.js. But in the case of "setActivity" just type it under search in the d.js docs.
Half the time it's quicker just to ask lul
Yes, but that's not how you grow. Keep the comments constructive and helpful please.
I mean I have read the documentation, all I did was forget user.
For someone who doesn't read things like that very well its difficult so I ask if I dont understand the docs.
It's all good Boss, continue coding your heart away. ๐
Anyways, ty for the help
Parmesan LinguineToday at 4:12 AM
Half the time it's quicker just to ask lul```
by the time you get an answer in chat you could've already read it in the docs ๐
>> #memes-and-media for any responses
How ?
I do not speak Romanian, but I assume you want a mail feature.
No how to create system :))
what library do you use?
Yes I saw the image above
you have to tell us which library you are using.
What?
what computer language are you using?
Programming language and bot library.
so you want everything sent to the bot's DM to you?
and send messages back?
This is the discord.js documentation
https://discord.js.org/#/
?
(the second link is current)
@rugged kelp Nu vฤ vom da codul. Trebuie sฤ รฎnvฤศaศi sฤ citiศi singuri.
Google translate is trash xD
Yes it is.
refer to the documentation above for reference
Im noob

so you already have an existing bot (with features)?
We will not spoon-feed you code. You must learn via documentation and guides. http://discordjs.guide/
A guide made by the community of discord.js for its users.
If you know how to send messages, it shouldn't be too hard to make a mailing system
On message, have your bot check if a channel is a DM channel and have it send you the same copy of the message including User ID or something to reach back. Then, make a command that only you can use with the User ID and the message to send back to the person which would appear in their DM.
Try setting up a code and if you still need help, feel free to ask questions here ๐
hii
any one there online
any one know hindi
i have a qustion
then ask it
you know @earnest phoenix hindi
no
@earnest phoenix
you see the icon of this group
when we tap the icon is rotating how?
nitro boost perk
@earnest phoenix
-> https://support.discordapp.com/hc/en-us/articles/360028038352-Server-Boosting-
@drowsy sentinel
what is this
An article explaining the features of server boosting by Discord themself.
@drowsy sentinel plz you setup in my server
That's not how that works. Read the article buddy.
how you setup in this servee
We have been boosted by 34 people. You need a minimum of 2 to have a animated icon.
Read the article, if you have any questions DM me.
i nees 2 people in my seever
Stop
Move to #memes-and-media please.
You are spamming, and in wrong channel, in addition to that
there's no problem, you need 2 nitro users to boost your server. even if you manage to get two nitro users the question is whether they'll boost the server, you should really read the article
Are there any downsides of running two bots locally on my computer--as in, one for testing and one for public use?
Local hosting isn't bad especially for the development process of the bot. You can host your bot locally even after releasing shortly until it picks up momentum. As long as you have the memory for the bot including a strong connection for low latency, you'll be just fine. You won't have strong protection or customer support, but if you can keep stable uptime it'll work just fine.
@muted ridge ^
Ah, I understand. Thank you for answering, Duane. 
Anyone have any good tutorials/insight for a sticky mute? I want the user to stay muted even if they leave and rejoin the server. (JS)
Save user ID in database, on user join, see if the bot is in DB
@slender thistle so within the event?
On the user join event, check if the user is still muted /shrug
Fair enough
Anyone here knows a good image manipulation library for JS? More specifically, I want to make profile pages with it, kinda like with Tatsumaki and other bots.
I think most people use canvas.
@hollow coral JIMP
Is it ok i DM you @brazen mulch ???
This isnt bot development, go to #memes-and-media ๐
- Wrong channel
- Details in #memes-and-media, as Epic said
the hacker is online!
hello
Hello everyone -- quick question. I'm trying to add command subdirectories to my handler but something seems to be going wrong. I'm using Klaw. Here is the code: js klaw("./commands/").on("data", (item) => { const cmdFile = path.parse(item.path); if (!cmdFile.ext || cmdFile.ext !== ".js") return; const response = client.loadCommand(cmdFile.dir, `${cmdFile.name}${cmdFile.ext}`); if (response) client.logger.error(response); }); But I'm getting the response: [2019-06-29 17:44:22]: LOG Loading Command: /Users/justinalexander/Downloads/guidebot-master/commands/Utility [2019-06-29 17:44:22]: ERROR Unable to load command /Users/justinalexander/Downloads/guidebot-master/commands/Utility: Error: Cannot find module '../commands//Users/justinalexander/Downloads/guidebot-master/commands/Utility'
I can't tell if I'm being stupid, or idk.
Nvm I got it I was being stupid
@earnest phoenix Wrong channel. Use #commands or #265156322012561408 and be sure not to run common prefixs.
okay, I am sorry
anyone know how I can host my own smtp server
so i can send emails from my own domain name under my own server
rather than using gmail as a host or something
nodemailer seems good but it uses an external smtp server
use something like sendmail or postfix i guess
dw i decided to just use roundcube php smtp server
@earnest phoenix I know man delovepers write on this they can help me
no, they don't
#memes-and-media or DMs please
One message removed from a suspended account.
Is there a way to access environment variables in browser JavaScript?
what do you think
:(
Say I have an image that I generated via PIL. How do I send that image?
1.2.3
Is it possible to send the image generated by PIL or should it be converted into discord.File though
so I just pass it into a discord.File object and send it normally?
๐
To pass binary data, consider usage of io.BytesIO. eh
discord.File("image")
One message removed from a suspended account.
Maybe (err => console.log(err)) because that would just return a function?
you have to if there is an error log it
if (err) console.log(err); // Use that
(err => console.log(err) // Don't use. Not there.
you add a bot to the list
i did
then wait for it to be approved
oh
yeah not sure what happened here, dont wanna restart it. think attaching visual studio debugger will help me?
it's funny though because the bot is fully functional, just no console access
nope, the console log is running on a different thread, and when it crashes (like this) it doesnt kill the bot
i think it's a weird glitch in my consoleIO class
help how unable my bot from responding to other bots
o uh
@earnest phoenix on_message right?
yes
but yes that if how you do it. I advice you to use d.py context manager thou @earnest phoenix
Depends on how much code you have written imo
https://discordapp.com/channels/264445053596991498/272764566411149314/594556534999220238
I wouldn't really call that severe spoonfeed but yeah
let size=0;
client.guilds.forEach((guild) => {
size +=guild.members.filter(member => !member.user.bot).size;
});
Does this function return the number of users on all servers where the bot is located?
Should
Doesn't d.js have something like bot.users 
@slender thistle that's only cached users
alright, noted
I couldn't figure out how.
but trying now
If the owner of a guild isnt cached and it is crashing the bot due to the guild.owner being undefined, how would i cache that user
discord.js
ah, idk why that didnt cross my mind, i always seem to forget about the various fetch methods, thank you
Is it a bot or webhook? ^^
it;s bot
wizzie what lang
What are you using rn to display the above?
a messag.channel.send([url]) and a messag.channel.send(embed) ?
let msgEmbed = new Discord.RichEmbed();
msg.channel.send(msgEmbed.addField("title", "name"));
This is code
remove line 9
Example:
const exampleEmbed = new Discord.RichEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addField('Regular field title', 'Some value here')
.addBlankField()
.addField('Inline field title', 'Some value here', true)
.addField('Inline field title', 'Some value here', true)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/wSTFkRM.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
channel.send(exampleEmbed);
More documentation: https://discordjs.guide/popular-topics/embeds.html#embed-preview
A guide made by the community of discord.js for its users.
๐คฆ
ah never mind im blind
XD
thought they wanted to hide the embed and keep the link
no
thats just wrong wtf
Wait.
so first of all you are creating an empty embed
const embed = new MessageEmbed()
.setColor('#dc3545')
.setTitle(`Something went wrong`)
.setDescription(`<@${message.author.id}>, you forgot to mention a user.`)
message.channel.send(embed)
Example ^
The channel doesnt exist
and then trying the embed.. to the embed
(node:2460) UnhandledPromiseRejectionWarning: Error: 403 Forbidden What is this error?
wrong token
Wtf
or something
what did you try to do?
Change my bot avatar
if its from dbl just reset your token
@inner spruce And where is link ?
oh lmao
wrong token is 401, 403 is not being allowed to do something
wrong credentials
TIL
const embed = new Discord.RichEmbed()
.setColor('#dc3545')
.setTitle('TITLE HERE')
.setUrl('URL HERE')
.setTitle(`Something went wrong`)
.setDescription(`<@${message.author.id}>, you forgot to mention a user.`)
message.channel.send(embed)
๐ฅ
Please use this: https://discordjs.guide/popular-topics/embeds.html#embed-preview
new Discord.RichEmbed()
Oh k
On master it's MessageEmbed
@earnest phoenix And how i can fix the error?
Ahh figured why ๐
you dont have access
Its a api error?
It's forbidden
You do that through discord
Changing my bot avatar with bot.user.setAvatar('link')
do it manually at https://discordapp.com/developers/
go to the bot section
there's 2 different places
๐
i'm dumb
What?
shoe? ๐ ?
bot.users.size
@rugged kelp check out the FiveM documentation of what you are using
And look for an API
@earnest phoenix he meant FiveM
Not Discord Server
setAvatar should be working fine, no idea why it isn't ๐ค
@earnest phoenix does the bot still run without .setAvatar?
It works for me
it's not me who has the problem
oops
client.user.setAvatar works for me
@modern sable #memes-and-media

look off topic
let size=0;
client.guilds.forEach((guild) => {
size +=guild.members.filter(member => !member.user.bot).size;
});
console.log(size);
console.log(client.users.size);
size result 14k but client users size 20k
Which one is right? Unique number of users required. and not bots
How to add proof ?
do you have code ?
Ok
What do you have
This
where ?
When you do the command
Or you can do this wait
.addField('Reason', `[${rreason}](${rproof}`)
Just define rproof
Ok
I write again, I apologize.
let size=0;
client.guilds.forEach((guild) => {
size +=guild.members.filter(member => !member.user.bot).size;
});
console.log(size);
console.log(client.users.size);
size result 14k but client users size 20k
Which one is right? Unique number of users required. and not bots
@earnest phoenix
Yes
how to define rproof ?
Help....
@rugged kelp you did $(bla bla) not ${bla bla}
Wdym jeff
variable names cannot have spaces in them either
It's not good look
The error is not that speedy
@rugged kelp const rproof = define
i see
Can any one look into this and tell me why it won't remove the users reaction upon changing the page or just straight up fix it for me? I've been stuck on this for like 3 months now. Here's the link https://pastebin.com/WAdkYepQ
it's good ?
@peak quail ../ in commands.js
hmmmm
In the index its ./
wtf no
oh
and how to define ?
You need to slice all text before a specific character
Like >report @user [reason] | [proof]
idk
do you have code please ? : (
But i can't spoonfeed
@earnest phoenix 
^
xD
Hmm weird
@peak quail have you tried ../../
.....
?
The link of the folder
In console ?
xD
@peak quail require path
const path = require('path');
// later in code
const pull = require(path.join(__dirname, '..', 'commands', dirs, file));
or use path.resolve(__dirname, '..', 'commands', dirs, file);
i need it also in line 5 lol
then add it.
Hey All!
I was wondering how to get vote webhooks to work!
@warm marsh
You missed a ")"
before .filter
after `
Also probably should change the name of the variable on line 6 from const pull to const commands
So you don't get an error for that.
Also, Before you had fs.readdirSync()
make sure you put that back
can you cange it? i dont understannd this xD
const { readdirSync } = require(`fs`)
const path = require('path');
module.exports = (bot) => {
const load = dirs => {
const commands = require(path.join(__dirname, '..', 'commands'.filter( d => d.endsWith(`.js`))));
for (let file of commands) {
const pull = require(path.join(__dirname, '..', 'commands', dirs, file));
bot.commads.set(pull.config.name, pull)
if(pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name))
}
}
["normal", "Owner", "moderation"].forEach(x => load(x))
}```
const util = require('util');
const fs = requrie('fs');
const path = require('path');
const readdir = util.promisify(fs.readdir);
module.exports = async (bot) => {
const load = async (dir) => {
const CommandDir = await readdir(path.resolve(__dirname, '..', 'commands', dir).filter(file => /\.js$/i.test(file));
if (CommandDir.length == 0) return console.log('No files found');
for (let file of commands) {
const pull = require(path.resolve(__dirname, '..', 'commands', dir, file);
bot.commands.set(pull.config.name, pull);
if (pull.config.aliases) pull.config.aliases.forEach(alias => bot.aliases.set(alias, pull.config.name);
}
}
['normal', 'Owner', 'moderation'].forEach(subDir => load(subDir);
}
But you should really learn how to do that yourself.
@warm marsh Try not to spoonfeed
client.users.filter(member => !member.bot).size
I wrote something like that. Why is the number of users constantly changing?
14-15k between each query has 200 users difference.
I'm doing an interrogation every minute.
thare are 4 misstakes lol
ok
If you ready the output bit on vsc
will tell you that expected ")"
just add them before ;
if you press ctrl + ' will open terminal then click
Will show you.
worker
Did you redeploy and sometimes it takes a second
Node bot.js: 217 })
Unexcepted token: )
217 means 217nd line?
Yes
@warm marsh mines out of date
This is the new one made by fishy
''' //voicechat
client.on('message', message => {
if (!message.guild) return;
if (message.content === 'join') {
if (message.member.voiceChannel) {
message.member.voiceChannel.join()
.then(connection => {
message.reply('I have successfully connected to the channel!');
})
.catch(console.log);
} else {
message.reply('join a vc channel man');
}
}
}); '''
Unexcepted token: )
just answer my quest
usually it means you might've put an extra )
with }) "Unexcepted token: )
when i remove it, missing ")"
Code missing a ) somewhere
When i put it, "Unexcepted token: )
Or why you shouldnt use notepad as your code editor
or have 1K lines of code in your main file
Then send the code
Okay looks like the repository was renamed from dblgo to go-dbl
Which broke all imports you use in Golang :((((
so im like fairly new to coding and im tryna make a mute command, but I can't get it to work. If you do "$mute" it responds with the please mention a valid user, but i can't get it to run any of the other lines of coding. if i do "$mute @user reason" nothing shows up.
https://i.imgur.com/GiwLQno.png
@edgy heart Hi I hope you're having a good day
.addRole() method accepts a snowflake or a Role. Right now you're feeding it a string
So basically a snowflake is either a role ID of a role, and a Role is basically an object
If you wanna search up a role by its name, "muted", you'll have to do something such as this to get the Role object
message.guild.roles.find(role=>role.name.toLowerCase() === "muted")
ohh
I only checked until there, didn't see your entire code yet but that's one key issue right there
I added toLowerCase() to make it case insensitive btw
thanks <3
Have a good day 
@edgy heart Oh BTW one more thing I saw was
In the mutereason, you literally split the string by a space to form an array, then had an extra line to join an array with a space again
It's not necessary to split and then join the same thing as it gives the same output
try option 1 https://github.com/nodejs/node-gyp#on-windows
if it doesn't work use option 2
idk, maybe im just being stupid but i can't get it to work. i've tried to mess around with the coding a bit and it hasn't been working, again im fairly new to this.
https://i.imgur.com/MSkkkaQ.png
What is the error? @edgy heart
you have KICK_MEMBERS on the first one, then KICK_MEMBER on the second one. also on the second one, you're checking if the member to be muted has that permission, not if your bot has it. you're doing some weird substring shanenigans, its better to use splits in this case. you dont need to redeclare mutereason, you can just replace it. ...roles.find() is not a promise, you can't use .catch on it
@edgy heart You need to make it give the Role object
Don't just copy and paste code please, spoonfeeding isn't an option..
Earlier on you had member.addRole('muted')
What I stated was 'muted' was a string and you need to feed it the role object
As a result you need
member.addRole(Role object or Snowflake)
Also please read this I sent earlier:
https://discordapp.com/channels/264445053596991498/272764566411149314/594619693495615536
I didn't look at your substeing stuff as it varies via prefix but it is not a good idea to do that
the snowflake would be the id of the role you want to add to the member
You should do something like this instead for reason
message.content.split(/ +/g).slice(2).join(" ")
Probs dumb question but can you use snowflakes when adding roles in async py
nope
you have to fetch the role
iirc rewrite is more snowflake oriented than object oriented
how can i add a cooldown to a command?
What language?
javascript
Make a set()
Add username to set if they ran it, settimeout to remove from set
And if they are in set() When using command , tell them to wait x secs
is it for all commands or can i make it work only on some specific commands?
You can make it for all commands or for only some specific commands.
ok, thank you
Extending on that you can also change the duration of the setTimeout to make different commands have different cooldowns
handler
how to do Auto Changing Statuses?
Please
lang and lib
I would assume d.js
as it's the easiest, but we need to know
The basic rundown is have something being done on an interval and change it inside tho
@desert iron there are plenty of guides online
@stray garnet with a interval
Set 10sec to 15sec
api abuse thou
not with 15s
120 is overkill
if your pushing it then 12 but rarely is there any good reason
12 is the minimum
yes
sounds right
depends on your lib but you can just directly apply the bitwise operator to it
Integrate your service with Discord โ whether it's a bot or a game or your whatever you wildest imagination can come up with.
uh express is a web engine
so iirc its just 0x00000008 & 37031424
and in case above they arent admin i dont think
0x00000008 & permission !=0
i think thats how it goes
been a while
*yes thats how it goes
Is there a way to redefine external variables inside of a promise?
As in:
var phrase;
jisho.searchForPhrase(args).then((r) => {
phrase = r;
});
console.log(phrase)
The above example doesn't work as the console.log(phrase) prints undefined.
how to set rich pre by discord.js
@muted ridge print the variable after the promise is resolved
oh yeah. promises are asynchrous, right?
var phrase;
jisho.searchForPhrase(args).then((r) => {
phrase = r;
console.log(phrase)
});
// console.log(phrase) This will execute first because the promise is async
it wont wait for the .then() callback if its outside tthe scope of that callback
unless its async await styled
๐ค
async function example() {
const phrase = await jisho.searchForPhrase(args);
console.log(phrase);
}
//
let phrase;
async function example() {
phrase = await jisho.searchForPhrase(args);
console.log(phrase);
}
or if you prefer old style what I sent earlier will work
async function is a wrapper around promises
by making a function async, you enable the usage of await syntax
but if the function is async, that function becomes a promise
why is typescript being stupid
You are using a capital C, try using channel. (All in lower case)
stipid qestion know but how dose hosting a bot work when it gose onto a discord is it copy or its own bot just wondering becase this is my first bot and i dont know how conplext to make the user acounts
come to think of it i have no idea how host a bot
You create a bot account and use it's token to log in
It's literally just client.channels.get(id). It returns a discord.js Channel object which does have a send method
It's just typescript being stupid. Or maybe it's just the fact that i have no idea how typescript works
i got that far i whant to share the bot
?
But it'll probably get rejected if you didn't make the bot yourself or if it has barely any features
its bot made for rp
https://discordbots.org/bot/new it's not that hard
text molsty im just worryed it will get a lot of users from difrent discords
There's literally an Add bot button on the dbl website
k
im good for now but thanks
im more confised how hosting works as it can only be turnred on threw vuslue studio
this is my frst bot and im realy confised by hosting the progam
what language are you using for the bot?
@carmine echo Channel !== TextChannel
c#
https://discord.js.org/#/docs/main/master/class/Channel
vs
https://discord.js.org/#/docs/main/master/class/TextChannel
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Thanks
Is the client.users.size affected when using Shard? nodejs
If internal sharding no
need broadcastEval?
uhh
You'd have to check if they are different users
Because one user can be on multiple shards
You can't just add them up basically
why does typescript do this? this is so unepic
Is there a brief example?
yes need user amount
all users
no only cache
and no bots
pretty sure client.users.size would only be cache
yes But I couldn't find another way.
Broadcast the eval to obtain collections of all guild members, filter them to remove bots, convert them to arrays of user ids using .map(), merge the arrays, remove dupes, get the length of the array
That's not representative either way
this should work
hmm
I've never worked with shards tbh
But I know that broadcast returns an array of eval outputs
so
// broadcast bot.guilds
output.map(response => response.map(guild => guild.members.map(member => member.id)).reduce((a, b) => a.concat(b))).reduce((a, b) => a.concat(b)).filter((e, i, s) => i == s.indexOf(e)).length
this may or may not work
Donโt use Enmap
hmm
var count={};
client.guilds.forEach((guild) => {
guild.members.forEach((member) =>{
if(!member.user.bot){
count[member.user.id]="1";
}
});
});
after broadcasteval count and
last console.log(Object.keys(count).length);
this?
hi
Thatโs so complicated for no reason lmao
It seemed easier to me. ๐
bot.users.size
not only cache and no bots
client.guilds.reduce((a, c) => {
a += c.members.filter(e => !e.user.bot).size;
}, 0);```
If the same person is in more than one shard?
Then we could add the IDs to a variable, remove duplicates, and then get the length
const totalMembers = client.guilds.reduce((a, c) => {
a.push(...c.members.filter(e => !e.user.bot).map(e => e.id));
}, []);
[...new Set(totalMembers)].length // removed duplicates```
And just broadcastEval the reduce method when defining totalMembers
It's like this is more complicated, but I'm gonna try it.
If it doesn't work, lemme know and we'll fix it
Several things could go wrong depending on how u incorporate broadcastEval
- it returns a Promise, so use async/await or put the Set in
.then() - it returns an array, so call
.flat()on the result in the set. - it works in the context of the client, so
guilds.reduce()instead ofclient.guilds.reduce()
if you want to get all the member count w/o bots and complete you will need to cache everything = higher memory usage
if thats ok with you then
for (const guild of this.guilds.values()) {
guild.members.fetch()
.then((cached) => cached.filter(mem => !mem.user.bot).size)
}
although this would run async so broadcastEval wont wait for that to execute
thats for you to fix
The same members should not be counted again.
this problem
only size insufficient.
Bot has started at Sunday, Jun 30, 2019, 10:47:56 AM
Bot is ready!
WebAPI: JSON Data values starting from [items[0].snippet.channelTitle] stored to: [channel]
WebAPI: Using previously stored json data from the initial store json action within this command.
WebAPI: JSON Data values starting from [items[0].snippet.publishedAt] stored to: [published]
WebAPI: Using previously stored json data from the initial store json action within this command.
WebAPI: JSON Data values starting from [items[0].snippet.thumbnails.default.url] stored to: [coverart]
WebAPI: Using previously stored json data from the initial store json action within this command.
WebAPI: JSON Data values starting from [items[0].snippet.title] stored to: [title] my music bot doesn't play some music
did you make that or are you selfhosting an existing bot?
While working on some music
You should ask the admins of that server instead
or search for these bots on dbl
It's very possible that these bots are private
@earnest phoenix
Found one
How does this belong in #development
it doesnt
@cursive gale here people are not rude
Please help me
is my code
but it won't add the user to the collection
@earnest phoenix what help do you need?
formatting your code properly would help a lot
me?
we did it just because it was still not working
Please give me link
@earnest phoenix right click the bot, copy id, generate an invite link with it, invite it
@mossy vine I'm mobile user
Huh
Diiscord.Collection is a map
what you do in map is what you do in Collection
press and hold, copy id
Which?
ok
collection.set should work tho
but it is not
collection.set does work as collection extends map
I didn't even know an issue like that existed, someone knows the reason?
so how do we add
Tell me @mossy vine
i told you
yes
yes
client_id=<id here>
when he uses .set and then log collection it does not add
with discord.collection
@mossy vine what is client I'd??
oof
I'm no understand
@earnest phoenix bot id
just press and hold
on the bot you wanna invite
then click copy id
@earnest phoenix ok press and hold on the bot click copy id then give me to me
https://discordapp.com/api/oauth2/authorize?client_id=(the id to copied)869&permissions=8
@cursive gale please send me. Process screenshots
permissions=8 
uhh
give me the id
i will give you the link
@mossy vine can you tell us how to add to the map?
not working
its not a promise
without await it doesnt work too
Map.set('yeet', 'foo')
Map.get('yeet') // > 'foo'
You don't have developer options enabled in your discord settings and this is not the correct channel to be asking this @earnest phoenix
@earnest phoenix you need to turn developer mode on
in the settings
go to user settings -> behaviour -> turn developer mode on
it still dosen't add
@carmine echo this is my code and it dosen't work
it won't add to the collection
format your code properly, likely a logic issue
use something like eslint
vsc has it inbuilt
sorry sir my pc is very limited
Sorry I not understand
wtf your pc is too limited to use eslint but you can use vscode and run a bot
This does not have anything to do with your pc being limited
@vague chasm it doesnt
You should install the beautify extension from the extension store, press F1, search for beautify file and click enter
eslint is very light
ok
@earnest phoenix
but can we not get helped before i format it?
No
then click Behaviour




