#development
1 messages · Page 839 of 1
How do I make the client go on mobile btw
Can I put there my yt link? @earnest phoenix
Nope
You need a twitch link I think
Only twitch
Np
Hi, I'm making a fast-food bot thing. I'm wondering how to get random characters for order ID's like. 1HssA
?
@subtle yoke u can make an array of letters and words and then math floor randomize them
hmm
@finite bough i don't think so he needs to randomize it
why not
um
Because it's order ID
:/
ID for any order
yes
Or i get it wrong
random characters
he is not asking for 1 single order type
he means like
something like our discriminator
randomize
if you know what discord fast food is if your order ID is like L23d
Then what
ye
u will know its pizza?
Then it'll not randomize
^
You need to specify it
Random order id
yeah
u need a db for that
Then you can use random but check the id isn't already in db
mhm
OH
var numberOrder = "1";
numberOrder.padStart(5, 0); // 00001
parse and iterate numberOrder to ++
I guess that could work
You just judged which language he is using :)
I'm using JS btw
ok tysm
Np
I don't know the issue here
(node:29345) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null
serverQueue.connection.dispatcher.end();
heya! im making a economy bot for that im making a register cmd, so im using json, i want to check if the user data is already in the json file
easy -> dont use json
is a webhook
let collection = mongo.db('sunucu').collection('ozelkomut')
let komutt = await collection.find({id: message.guild.id})
let komuttt = komutt.map( function(myDoc) { return myDoc } );```
How can I print these objects in mongodb?
Discord.js version? @golden condor
v12
Can you send the code?
yes
client.on("ready", () => {
//the rest of my ready event
client.user.setStatus('dnd')
client.user.setActivity(`c!help | ${client.guilds.cache.size} servers | ${value.toLocaleString()} users`)
});```
Yes
I found an example
client.user.setPresence({ activity: { name: 'with discord.js' }, status: 'idle' })```
Can you try?
setActivity
Umm
It didn't work for me either
I have tried everything
Ok
Thanks
would glitch have anything to do with it by any chnace?
I don't think so
Because it works for other people
Just updated to 12
My head hurts after updating the code
client.user.setPresence({
activity: {
name: "support@iamdesu.com",
type: "WATCHING"
},
status: "idle"
})
Status works for me just fine
setStatus and setActivity works
@golden condor if you do it through command, it would 100% work
i bet it's the eval command
@pale vessel wym through command
like .setstatus idle
oh
@pale vessel wdym?
make a command that does it for you
Like
I am gonna make one
hopefully it works
Like this?
const Discord = require('discord.js');
const config = require("../config.json")
module.exports.run = async (client, message, args) => {
//only I can use this command!
if (message.author.id != config.ownerid) return message.channel.send("You cannot use this!");
await message.channel.send("ok")
client.user.setPresence("dnd")
}
yes
oof
new Discord.Client({ fetchAllMembers: false, disableMentions: "all", presence: { status: 'dnd' }});
Trying this
you shouldn't make a new client
my bot doesn't loginn
no error
and the code isn't needed
I want to ask if it's just for me
or it's something with Discord
I want a specific role what can run some commands what should I do?
what lib
I want to read minds too
Don't have to if you look at their message history
My bot should say "I'm up"
after it's ready
but it doesn't say that
and it gets online
was it working before
yes
did you change anything
then you did something wrong
Can you add this thing next to the status on discord.js?
Ok
bots cant have rich presence, jacob
anyone here know discordrb?
I used to use server_delete to know when the bot left a server, and it used to work, but now I suspect that Discord may have changed things so that "server was deleted" and "bot was kicked from server" events read differently?
Check their docs
or join their support server or Server invites:
Discord API (this server) — https://discord.gg/discord-api
Discord Bots (@meew0, @abalabahaha) — https://discord.gg/0cDvIgU2voWn4BaD
Anyone know how to fix UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji, I am using message.react('396548322053062656');
Oh thanks
I tried message.react('
'); and got UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
emoji_id: Value "693092944537976913>" is not snowflake.
did you do the entire 
if you want you can try fetching the emoji
const emoji = client.emojis.get("id").toString()
Is there any way of checking what channel a bot is active in?
do you mean voice or text channels
text
well not really but you can check where the bot sent his last message
I don't think that will work for what I'm trying to do, but I will look into it and see, thanks.
@earnest phoenix what CF8 ^^
ohi found how to fix it
is this best way to do this, i think not, so i would want to know how else i would read all cmds at directories once, not multiple times, but here's my code: ```js
let categories = ["dev", "useful"];
for (let i = 0; i < categories.length; i++) {
fs.readdir("./cmds", (err, files) => {
for (let i = 0; i < files.length; i++) {
if (!files[i].endsWith(".js")) return;
let props = require("./cmds/"+ categories[i] + "/" + files[i]);
props.name = files[i].split(".")[0];
console.log(props.name);
}
})
}
(as you might see, doing cmd handler)
I could be wrong but you are reading the directory 2 times
also you can try it and if it doesnt work you have your answer
That code doesn't do what you're attempting to do
The first for loop basically causes you to execute the thing twice and that's it's only purpose
You're overwriting the index variable in the next for
so in js you can do something like this for the right grammar: ${count} server${count > 1 ? 's' : ''}
does python have a sort of alternative to those inline statements
(node:551) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
How to do it?
you've got an event in event @charred jetty, don't nest events
Lemme check then
(https://discordapp.com/channels/264445053596991498/272764566411149314/693107573955625001)
@crimson vapor yes you are right, so thats why i even did post it here, cause i want to read it only 1 time, so how i would do it with hierarchy like this
- cmds
- dev
- test.js
- useful
- echo.js```?
ok so that command handler you have made so far
wont do anyting except console logs
Couldn't find it
yes.
why are you only logging them?
cause i was testing it out does it find the files.
my system is obviously suited for myself but it scans categories (so /commands/general/help.js would be loaded)
might give you a rough idea
I never thought of just doing a readdirSync.forEach
it makes sense that it would work
mine reads the commands folder, then for each command folder reads the commands in them, then loads them
but I never thought to do it like that
readdirSync works well
done it for a year plus now with no issues
scaled to 100+ commands easily
whats diffence of readdirsync and readdir?
You just have to fix your logic, so it matches his
Read the commands dir, read each dir inside that, require each file in there
readdirSync team
is there a function or library that allows for recursive searches of folders?
so readdirSync reads everything first, then returns them, and readdir returns immodely, am i right?
im used to for, so that i will keep, but ok ill try tonys way.
and tony, commando? cause this.client?
He created his own command framework probably
commando is really annoying to work with and honestly you would need to change just about everything to make it pretty
@sick cloud so basically a nested command handler since it reads folders in side of the command folder
i use my own custom client @restive furnace
okay
and @zenith terrace i guess so, the concept is simple though
after using both, class allows for a bit more functionality and exports is just easier to understand tbh
const Command = require('../../structures/Command');
module.exports = class Ping extends Command {
constructor() {
super({
name: 'ping',
description: `Pong!`,
extraDocumentation: null,
aliases: [],
devOnly: false
});
}
async run(client, ctx, args) {
const m = await ctx.send(`Ping?`);
return m.edit(`Pong! ${Math.round(client.ws.ping)}ms heartbeat, ${Math.round(m.createdTimestamp - ctx.msg.createdTimestamp)}ms roundtrip`);
}
}
that's how my commands generally look
again fairly specific to my use
nice
const { MessageEmbed } = require("discord.js");
const Command = require("../../src/Command");
class pingCommand extends Command {
constructor() {
super({
name: "ping",
memberName: "Ping",
description: "Find out my ping",
usage: "ping",
silent: true,
cooldown: 0
});
}
async run(client, message, args, GuildData, time) {
let lang;
if (message.guild) lang = client.lang.get(message.guild.id);
else lang = require(`../../languages/English`);
let ping = client.ws.ping;
let delay = Math.floor((Date.now() - time) * 100) / 100;
let clientPingTime = Math.floor(ping * 100) / 100;
let pingEmbed = new MessageEmbed()
.setAuthor(client.user.tag, client.user.avatarURL())
.setColor(0)
.addField(lang.PING_PING, `\`\`\`${lang.PING_PING_NUMBER("?")}\`\`\``, true)
.addField(lang.PING_CLIENT_PING, `\`\`\`${lang.PING_CLIENT_PING_NUMBER("?")}\`\`\``, true)
.addField(lang.PING_COMMAND_DELAY, `\`\`\`${lang.PING_COMMAND_DELAY_NUMBER("?")}\`\`\``, true)
.setTimestamp()
.setFooter(`Ping`);
let m = await message.channel.send(pingEmbed);
let timeNow = Date.now();
let pingTime = timeNow - m.createdTimestamp;
let xpingEmbed = new MessageEmbed()
.setAuthor(client.user.tag, client.user.avatarURL())
.setColor(0)
.addField(lang.PING_PING, `\`\`\`${lang.PING_PING_NUMBER(pingTime)}\`\`\``, true)
.addField(lang.PING_CLIENT_PING, `\`\`\`${lang.PING_CLIENT_PING_NUMBER(clientPingTime)}\`\`\``, true)
.addField(lang.PING_COMMAND_DELAY, `\`\`\`${lang.PING_COMMAND_DELAY_NUMBER(delay)}\`\`\``, true)
.setTimestamp()
.setFooter(`Ping`);
m.edit(xpingEmbed);
}
}
module.exports = pingCommand;``` mine is a bit longer tbh
That's a lot of code just for the ping command
delete message
oh ok
its cuz its an embed
imagine having each command in a new file
thats how most people do it
is that bad
That's how i do it too
embed builders are a pain
^
its nicer to use the object
in .net we like to have modules which allow us to contain commands in one group, taking up a single file
@crimson vapor it's cuz you made it big embed

ctx.send({ embed: {
title: 'Hello',
description: 'World'
} );
fair nicer imo
ig
personal opinion at least
i know the api in and out so i prefer raw uses
flat out could go ditch discord.js and be fine
then I assume I would have to just let xEmbed = { embed: {}}
good ubuntu vps host any1?
Idk
instead if doing console.log() is there another way to print to console?
you're not giving much to the discussion. if you don't know, just don't say anything
@crimson vapor there's loggers out there like winston
i use console.log with some modified things
console/log is easier
and append to file same time
this is how typical commands look like in .net libs
tbh... look into console.log, console.table and other loggin methods
so it looks neater
@modest maple here, it's a zip because there's a couple files, hope that's ok
the code is mainly in main.py though
lemme grab a pic of the issue
it runs win() fine but seems to go on playing
i currently have sys.exit in that code to stop it so remove those and you'll see what i mean
aight
it workes if you enter the correct letters completely without any misses
if you miss it then doesnt exit
trying to make event handler, now it just wont recieve events...```js
try {
for (const e of fs.readdirSync("./src/events")) {
if (!e.endsWith(".js")) return;
const event = require("./src/events/" + e);
const eventName = e.split(".")[0];
logger.log("Loaded " + eventName);
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./src/events/${e}`)];
}
} catch(err) {
logger.error(err.stack);
}```
How would I go about doing this?
var array = ["userid1", "userid2"]
array.join("<@ userid >")
// Output => <@userid1>, <@userid2>
@sick cloud I have fucking no idea how you're recursivley calling yourself
array.join connects whole array, so if you do js let array = ["a", "b"]; array.join(","); // Output => a,bthat happens, but if you want to select userid1, then just use array.find or array.filter
me neither
it's making no sense tbh
might ends up just recoding how i handle everything
@snow urchin look my message, and if you want like that, just use array.join(", ")
They want to convert the IDs into mentions, no?
tony, recode that next_state def pls
i mean the entire thing would work much better in a class
soon
but meh
I am doing something weird now.. So I get this error that
ReferenceError: RichEmbed is not defined
Even though it is defined in my index.js as const { Client, Collection, RichEmbed } = require("discord.js");
Is there a reason why it can not read the RichEmbed from index.js to random.js ... everything else works except the RichEmbed O_o
Here is the random.js
const embed = new RichEmbed()
.setColor(0x2C2F33)
.setDescription(`:underage: This is not nsfw channel`)
messge.channel.send(embed)
depends on his version
yeah its v12
Ok
I recently updated to it xd
Then ye its MessageEmbed
change richEmbed to MessageEmbed
or define rich embed as messageembed so you don't have to rewrite your bot
I am rewriting it anyways to fix some stupid mistakes I made on it :(
I still get the same error even with the MessagEmbed
dammit
@peak dirge They changed basically every module and voice dependency
So have fun like re-writing your entire bot
most things like guild size is only avaible through the cache property
but it does allow some new features like dinamic image url options or custom sizes
so its not completely the same
With bulkDelete why can’t I delete messages older than 14 days? Is there anyway to change that?
I would just do it as
const discord = require ('discord.js');
const embed = new discord.MessageEmbed()```
Its a *little* bit more coding but I find it more easier to do
if you use vs code you can also replace RichEmbed with MessageEmbed in all files
idk about other code editors but that would be a fast option
@zenith terrace in such case you're importing all of discord.js
@heavy anchor discord api limitation, no you can't change it
I’m using a bot that can delete Messages older then 14 days
is there another way to do it?
without hacky abusive methods no
That sucks
I suppose its just to prevent you from bulk deleting every single message in the channel
as that would be api spam yes
That makes sense
but im just assuming
Thanks for ur help guys
np, when u need something just ask!
Ok thx
i need help making a bot i dont no what to do its saying iinvalid server format
have you coded your bot yet
ok then close the website
and read #502193464054644737
specifically the part about making a bot
-faq 3
I have a question, so if a certain parameter of a command that I have is a Ping of a user, for example
!command @vernal basin ,
my code stores the ping in membername.
When I check membername.roles, it says it's undefined. Do I have to manipulate membername somehow because it doesn't have the private field roles?
(discord.js)
Is a ping stored differently than a normal ID?
What version of djs are you using
how do I find that?
in your package.json
require("discord.js").version
or that
im still confused can i screan record with someone to show them
oh i just have this const Discord = require("discord.js");
?
Do you have an eval command?
?
?
@fervent tiger how old are you 
Eh, just check your package.json then
@mossy vine not answering
BRUH
oh interesting
version": "",
my version is empty
a
is having an empty version an issue?
not really
im just asking how do i get the thing to stop saying invalid server format
you said you havent coded your bot yet
erm im sure there are plenty of guides out there
and yeah you would want to have text in the code first

i dont no how to do them stuff thats y im asking for help
there are lots of basic guides on how to boot up a simple bot
?
{
console.log(`claim activated channel:${message.channel}`);
const membername = args[0];
const teamrole = args[1];
if (membername.roles.has("693129872129917029"))
{
client.channels.get("692947490470625360").send({embed: {
color: BLUE,
description: `${user} wants you on their team! \n Tag: ${teamrole}`
}})
client.channels.get("692947490470625360").send(`${membername}`)
return;
}
message.channel.send({embed: {
color: RED,
description: `${user} isn't looking for a team.`
}});
return;
}
so this is my code so far, RED & BLUE are constant integers, and the code crashes here membername.roles.has("693129872129917029")
i dont no how to code tho
what did you input as args[0]
i assume it looks something like this: @slim hill
the command is intended to be !claim @role @role
wait !claim @earnest phoenix @role
wait shoot that pinged someone sorry 😦
You have to get the member object from the ID first
You can't call .roles on just the ID
Alright yw
how do i code the bot??
...
-faq 3
i dont no how to code or program tho
Then learn that first
that might be an issue just saying
You can't code a bot without any knowledge about coding
this is not scratch :thonk:
@vernal basin ```js
const membername = message.mentions.members.first()
okay ty

Spoonfeeding is bad
ugh js is so deceptively close to java but its actually not in so many places 
only its name will fool people
wait so message is the text, mentions is the attribute that I assume returns some List of <@numbers>, and members is the attribute that is the glob of numbers, and first returns the first of the list?
also out of curiosity why does .first() exist
doesn't .get(0) work or something
message - Message Object
.mentions - (object iirc) of stuff that is mentioned in this message (e.g. channels, roles, members)
.members - (collection iirc) of Member Objects that are mentioned in this message
.first() - first of the Member Objects
So message.mentions.members.first() returns the Member object of the first mention member in that message
if that makes any sense
okay ty
wouldn't it suffice to then just do message.members.first()?
or is this just a JS thing
message.members isn't a thing
if mentions is an array why tf does it have .members
iirc
headUsed is what the process uses?https://lumap.is-inside.me/1Cp0aT0g.png
k
My dependencies are dead
maven?
Yea
We know JS and Java are different
But nobody brought up JS
So I don't know what point you were trying to make
would doing:
Channel c = new Channel({{
"id": "channelID"
"guild_id": "guildID",
"name": "channelName",
"type": 0,
"permission_overwrites": [],
"topic": "topic",
"parent_id": "categoryID"
})
successfully create a new channel under the category with categoryID as an ID?
u cant allot channel an id
or did I just terribly misread the docs
I dunno what was up with my dependencies
It was 404 for a second
But the dependency is working again
prob some network error/outage on site
guys are you blind
that's fucking java
not fucking javascript
don't you see Channel c = ...
That channel is the datatype
@vernal basin you obviously misread the docs, just scan through them again and try to understan that constructor
I've never used it so idk
what lib r u using?
jda?
wait
then why are they using java syntax
what the fuck were they even trying to accomplish
they sent this
would doing:
Channel c = new Channel({{
"id": "channelID"
"guild_id": "guildID",
"name": "channelName",
"type": 0,
"permission_overwrites": [],
"topic": "topic",
"parent_id": "categoryID"
})
successfully create a new channel under the category with categoryID as an ID?
ok?
I want to make ram usage with my bot, but google is gay and dont work(can't find anything)
not my fault they're trying to use java syntax lul on js
https://nightmare.is-inside.me/4SyWShUK.png @tight plinth maybe that?
Ping wont work
@tight plinth
so os-utils = bae
Ug
when using createOverwrite, what does one put to overwrite the everyone permissions
guild id?
The guild's id and the id of the everyone role are the same
ye
Also Ninja'd
oh okay thanks
I have to deal with Reactor, disk, and logic
Shouldn't take too long, but not fun
message.channel.awaitMessages(message => message.content.startsWith('!confirm'), {time: 120000, errors:["time"]}) should default to the .catch block after 2 minutes right?
I gotta write this big ugly system
I have to access some data about a message, check whether it is Message 1 or Message 2 from a group, if it is Message 1 and Message 2 does not exist, I must create Message 2 and save some data, otherwise (if the message is Message 2) I have to figure out which message is Message 1, I then have to set some AtomicReferences to the messages id's. I have to go into Message 1's data and do some processing with that, and then go into Message 2's data and do some processing with that, and then I have to edit Message 2.
Uk
Yuck
teamname = args[0];
hexcolor = args[1];
if (message.member.roles.has("692955330283569203"))
{
message.channel.send({embed:{
color: RED,
description: `You already have a team!`
}})
return;
}
message.channel.send({embed:{
color: BLUE,
description: `**Are you sure?** This action is irreversible. Type !confirm if you really want to create a team.`
}})
var roleid;
message.channel.awaitMessages(message => message.content.startsWith('!confirm'), {max:1})
.then(
message.guild.createRole(`[TEAM] ${teamname}`).then(role => {
role.setColor(hexcolor);
roleid = role.id;
})
)
.then(
message.guild.createChannel(`[TEAM] ${teamname}`).then(channel => {
channel.setTopic(`${teamname}'s Team Channel`);
channel.createOverwrite(guild,{
READ_MESSAGES: false
})
channel.createOverwrite(guild.roles.get(roleid), {
READ_MESSAGES: true,
});
})
)
.catch(message.channel.send({embed:{
color: RED,
description: `Command cancelled.`
}}))
Okay nevermind about the timing stuff. Here is the code that I've made so far, and when I run !createteam test, I believe it creates a blank new role and that's it.
So I'm pretty sure the first part works, but my awaitMessages then/catch block is a bit sketch
would you mind adding syntax highlighting?
v11?
uh i don't have a version
discord.js version, sorry
i checked my package and it doesn't have any version
where do I put that?
anywhere
ok
on ready event
wait nevermind, it doesn't even create a new role at all. it just gets stuck at the point where it asks for the !confirm
@pale vessel 11.3.2
that's old
upgrade to 11.6.3 at least
if you don't mind upgrading to v12, then upgrade to 12.0.2
are there any significant changes?
okay ill just do 11.6.3 then
all right
hey flazepe
heya
wait
const bot = new Discord.Client()
const moment = require("moment");
const scarew = new Discord.ShardingManager('./server.js', {
totalShards: 'auto',
token: 'TOKEN'
});
scarew.spawn();
scarew.on('launch', shard => {
console.log(`${moment().format("HH:mm:ss YYYY/MM/DD")} | #${shard.id} started.`)
});```
does this help? https://github.com/discordjs/discord.js/issues/3956
The library I use makes sharding so easy
Literally that's all
I switched from Non-Sharding to Sharding with minimal changes
@pale vessel thanks, I'm trying. I will say result.
Oh my God.
Thanks, works now!
@slate oyster where can I find this library?
It's a different language though
looks like scala so uh
No. Not Scala.
:thonk:
But it is a different language than theres
oh k
@pale vessel once I've updated, what do I do?
or it's same 🤔
@slate oyster java doesnt use -> does it?
Any recommendations on command handler tutorials?
what language
Js
@west raptor
?
have you tried troubleshooting at all?
Nothings works ye
@west raptor It uses it
Does D.js just have stupid sharding or something?
Why does everyone need help in js?
i dont know
but its almost ez as jda or in didcord4j
prob cause java has experienced coders and js newcomers
im not taliing that all are
I'd say it's mainly that yes^^
just. mostnof them
Probably
oof keyboard
because all stupid people use js
The majority of new people won't pick a language like java
Could somebody make me a bot
for free? nope
its already hard enough to make one for ourselves 
serenity makes it super easy to shard lol
not free @quartz kindle
@west raptor so python too
From what I saw in my courses, a lot of people struggle with just getting a simple java program to run 
something that does this https://gyazo.com/9fc448c7dde9154f84710b02c3f56689
what even is that
good luck!
else if (command == "createteam")
{
console.log(">>> CREATETEAM");
teamname = args[0];
hexcolor = args[1];
if (message.member.roles.has("692955330283569203"))
{
message.channel.send({embed:{
color: RED,
description: `You already have a team!`
}})
return;
}
message.channel.send({embed:{
color: BLUE,
description: `**Are you sure?** This action is irreversible. Type !confirm if you really want to create a team.`
}})
var roleid;
message.channel.awaitMessages(message => message.content.startsWith('!confirm'), {max:1})
.then(
guild.createRole(`[TEAM] ${teamname}`).then(role => {
role.setColor(hexcolor);
roleid = role.id;
})
)
.then(
guild.createChannel(`[TEAM] ${teamname}`).then(channel => {
channel.setTopic(`${teamname}'s Team Channel`);
channel.createOverwrite(guild,{
READ_MESSAGES: false
})
channel.createOverwrite(guild.roles.get(roleid), {
READ_MESSAGES: true,
});
})
)
.catch(message.channel.send({embed:{
color: RED,
description: `Command cancelled.`
}}))
so the goal is, once the user does !createteam test, it should ask for confirmation (!confirm) and if there is confirmation, create a role named [TEAM] test and a channel called [TEAM] test that only the test role can access. The denial works fine, if I have the role it will just return the rejection message, however if I don't, the bot will just stop working.
version is 11.6.3
node.js
discord.js*
how can I connect to my server with private key via vscode? I am using private key for connect with putty/filezilla
does vsc support sftp out of the box?
prob some extension?
@restive furnace yes ik. I am asking for how to add private key to that extension
copied straight there: ```
Install VS Code or VS Code Insiders and this extension pack. On Windows, be sure to check Add to PATH when asked to Select Additional Tasks during installation.
Remote - SSH: Install an OpenSSH compatible SSH client.
Remote - WSL: Install the Windows Subsystem for Linuxalong with your preferred Linux distribution. (Note that WSL2 support is experimental.)
Remote - Containers: Install and configure Docker for your operating system.
Windows / macOS:
Install Docker Desktop 2.0+ for Mac/Windows. (Docker Toolbox is not supported, but Docker does not need to be running if you use a remote host.)
Right-click on the Docker task bar item and update Settings / Preferences > Shared Drives / File Sharingwith any source code locations you want to open in a container. See tips and tricks for details.
Linux:
Follow the official install instructions for Docker CE/EE 18.06+. If you use Docker Compose, follow the Docker Compose 1.21+ install directions.
Add your user to the docker group by using a terminal to run: sudo usermod -aG docker $USER Sign out and back in again so this setting takes effect
and @tight plinth has done so on vsc
ask him
@summer torrent
ty tim
https://discordapp.com/channels/264445053596991498/272764566411149314/693172741372772363
I'm getting this error can someone help?
client.ws.connection.triggerReady()
},30000)```
not works.
when is sharding recommended?
in the Role constructor, the docmentation says this: new Discord.Role(client, data, guild);. How do I set both the color and the name in this?
My bot have 1.080 servers
that's fine too ig
But i'm getting error
ty
Back to my computer
Guess I'll go back to writing that ugly, yucky system
@west raptor sorry for the ping, but
guild.roles.create({
data: {
name: teamname,
color: hexcolor
}
})
guild.channels.create(`[TEAM] ${teamname}`, {
type: 'text',
permissionOverwrites: [
]
})
after making the role, if I want to create a permissionOverwrite, how could I use the role I've just created?
store that into a variable since Roles#create returns the role
oh right, im dumb, ty
Could use a little help with my bot. I am trying to make a type of /me command, but I can't get it to work the way I am after sadly, what I want it to do is delete the above message, and repeat the text with the users display name and what they did, an example of what I want it to do is something like this:
//me Yeets Can
Bot Return:
Cody D. C-741: Yeets Can
what is your code so far?
client.on('message', message => {
if(message.content.startsWith(${prefix}/me)) {
message.delete()
message.channel.send((message.author.displayName) + ": " + (message.content.replace('/me ','')));
}
})
have you tried using the ` symbols
instead of double quotes, sometimes that's helped me
client.on('message', message => {
if(message.content.startsWith(${prefix}/me)) {
message.delete()
message.channel.send((message.author.displayName) + ": " + (message.content.replace('/me ','')));
}
})```
Thats what I have so far, have to do double slash because one slash is a discord command, wont work with my bot.
what is the problem?
The bot is doing this.
of course it will work, cody
you aren't filtering out your messages
filter out bots and dms
I want it to do the following text with the command.
also titan, don't spoonfeed code
Like if the command is this:
//me Yeets Can
I want the bot to respond with this:
Cody D. C-741: Yeets Can
displayName is a guildmember property
you got told how
you need message#member for that
const myrole = message.guild.createRole({
data: {
name: `${teamname}`,
color: `${hexcolor}`
}
})
const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
type: 'text',
permissionOverwrites: [{
id: `${myrole}`,
allow: ['VIEW_CHANNEL']
},{
id: `${message.guild.id}`,
deny: ['VIEW_CHANNEL']
}
]
})
for some reason, this creates a blank new role in the role list and nothing else, no channels, nothing.
discord.js, 11.6.3
I tried that website it no longer makes sense to me.
do you have any prior coding experience
@stable nimbus ^
i'm guessing no
I'll ask later because none of you guys are making sense.
I-
displayName is a guildmember property
@pale vessel
@stable nimbus Have you programmed before
if not, then you shouldn't faceplant into making a discord bot - but rather starting out with language basics; if you don't want to learn, ask someone to make it for your instead
Discord Bots shouldn't be your first project
so the discord.js docs are all v12 right
not all
you can select a version which you want to browse
okay
const myrole = message.guild.createRole({
data: {
name: `${teamname}`,
color: `${hexcolor}`
}
})
const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
type: 'text',
permissionOverwrites: [{
id: `${myrole}`,
allow: ['VIEW_CHANNEL']
},{
id: `${message.guild.id}`,
deny: ['VIEW_CHANNEL']
}
]
})
this is 11.6.3 right?
Ye
because for some reason it's not reading in the color or the name
its just creating a blank role named new role
no colors either
teamname and hexcolor are predefined constants btw
message.guild.roles.create is v12
okay i think im on 11.6.3 so im not sure why this isn't working
there's no such thing as data: in v11
do you understand?
oh oops
i thought i was on the 11.6.3 docs lmao
okay so the role works now
but its stlil not making the channel
I'm fairly certain I adhered to the 11.6.3 docs this time
const myrole = message.guild.createRole({
name: `${teamname}`,
color: `${hexcolor}`
})
const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
type: 'text',
permissionOverwrites: [{
id: myrole.id,
allow: ['VIEW_CHANNEL']
},{
id: message.guild.id,
deny: ['VIEW_CHANNEL']
}
]
})
new djs version has been relased https://github.com/discordjs/discord.js/releases/tag/12.1.0
nice

Version 12.1.0 has been released!
This release fixes an issue in the RequestHandler concerning the global ratelimit, several typings fixes and additions of AllowedMentions to control which types of mentions your bot is allowed to do (@everyone, @here, roles etc.) and GuildPreviews.
The full (read as: same) changelog is available on GitHub: https://github.com/discordjs/discord.js/releases/tag/12.1.0
Oof
const myrole = message.guild.createRole({
name: `${teamname}`,
color: `${hexcolor}`
})
const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
type: 'text',
permissionOverwrites: [{
id: myrole.id,
allow: ['VIEW_CHANNEL']
},{
id: message.guild.id,
deny: ['VIEW_CHANNEL']
}
]
})
so the role works now but not the channel creation and I'm very confuzzled
v13 when 👀
in 5 years
have you tried reading tocs
Never
tocs
yes
yes i have read the docs :thonk:
I don't see any discrepancies between my code and the docs
what happens if I see one?
@vernal basin those are promises, you need to await them
wut
oh no
how do you have green role?
createRole() returns a promise
can help me?
yea
oh i understand
yes, either await the createRole or use .then()
oh okay
Tim tim, am I correct or wrong
@steel orbit what version is your discord.js?
@quartz kindle 12
okey thanks
Guys, guilds is not worked
you didn't even send the full error
Here, client is a bot returned by dbl.getBot
Lol flaz
I need to read more too oof
I thought I was bad 😂
So it's normal that it doesn't exist
but not like the actual guilds
I still havent completed that college work I talked about earlier
yeah i guess
so .length
maybe he should try debugging client
How Do I Do When Somone Vote My Bot The Bot Give Credits
Have You Tried Reading The Docs
HYTRTD
Is there any way of detecting when a user enters (not joins) a text channel?
I don't think so
No
Unless you mean "gets access to a text channel" instead of "opens a text channel"
no, I'm trying to write a bot that will display messages randomly when a user is actually viewing the channel as I don't want it constantly doing it
that's not possible
you can check if the user is typing..., that would be better ig @plush quail
not an event is it?
it is..
hmm
i have that event disabled in client object cuz it uses more resources when it sees people typing in every active guild
ye
alright, I might have to do that then, unless I can figure out something else, thanks
np
My unicode is being encoded as "?" marks
I'ma have to set file encoding until I can find a json-like database with nested collections.
Or I can always use MongoDB and emulate nested collections
But not a fan
alright i know im retarded but can someone sorta give me the link on where to install this and the link to install it
Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\Cools\dog1bot\node_modules\websocket\build\validation.vcx
proj]```
You need VS if I'm correct
can someone help me?
try installing windows build tools
i dont know how to make a embed in Discord.js?
link? @quartz kindle
.setAuthor(message.author.tag)
.setColor("#FFFC00")
.addField("Question", question)
.addField("Answer", responses[randomIndex]);```
@wet iron at the top of your code put const { RichEmbed } = require("discord.js"); if you have it installed
it says that discord rich embed is not a constructor
@astral yoke npm install --global windows-build-tools
Discord.Embed is not even a thing
have you tried reading the docs?
Just saying
then { MessageEmbed }
ok
then { MessageEmbed }
@pale vessel Thanks it worked!
i don't have an advice but tim might do
actually, read the docs https://discord.js.org
@zenith terrace I have seen people with bot dev who doesnt even know how to send a msg
below qt? 🧐
coz
we help people after looking at their role
example
if someone asks how to check if a message has been deleted
i mean, all you need is to have a bot on the website. you can do that with discord bot maker
But then it would be funny if the code didnt work for people
@wet iron at the top of your code put
const { RichEmbed } = require("discord.js");if you have it installed
If you installed v12 just use const Discord = require(„discord.js“)
const Discord = require("discord.js");
V12 or below?
and idk how to set prefix to blyat for the commands not to overlap
bc if i type in blyat ping
it will activate 8ball command at the same time
does anyone know how to fix that?

y not?
Why can you activate 8ball with bylat ping?
idk
some me the 8ball code
name:'8ball',
description:'8ball',
execute(message, args) {
const Discord = require('discord.js');
const responses = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes – definitely",
"You may rely on it",
"As I see it",
"yes",
"Most Likely",
"Outlook good",
"Yes",
"Signs point to yes"
];
let question = args.slice(0).join(" ");
const randomIndex = Math.floor(Math.random() * responses.length);
const { MessageEmbed } = require("discord.js");
let ballembed = new Discord.MessageEmbed()
.setAuthor(message.author.tag)
.setColor("#FFFC00")
.addField("Question", question)
.addField("Answer", responses[randomIndex]);
message.channel.send(ballembed);
}
}
this is the index.js file
const bot = new Discord.Client({commandPrefix: 'blyat '});
const token = "NjkyNDgwMTg1MzM2OTg3NzE5.Xn5LAQ.JRlsWQhTBwvulOMqgC8p0BIDcSg";
const fs = require('fs');
bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}
bot.on('ready', () => {
console.log("The bot is active and ready to go!");
});
bot.on('message', message => {
let args = message.content.substring(commandPrefix.length).split(" ");
switch (args[0]) {
case "ping":
bot.commands.get('ping').execute(message, args);
case "8ball":
bot.commands.get('8ball').execute(message, args);
break;
}
});
bot.login(token);
Perfect
im watching your code rn
k
Why does „ping“ = case „8ball“?
Bot.commands.get(„ping“).execute...case („8ball“)
i dont understand your code at all.
Im sorry, but i cant help you out here.
oof
that's just a basic command handler
@pale vessel can you help?
when i input the ping command it activates the 8ball command
it first outputs the ping command and then activates the 8ball command

btw add break; on ping switch
ok
not needed but recommended
When you „execute“ ping it also activates 8ball because it wont stop on ping 
🤦♂️
or am i wrong rn?
you were right
because i didnt put break after ping
it continued to run commands
and it ran the 8ball command
thanks guys!

G
G
I still haven't said the word fucking
Ye
https://nmw03.is-inside.me/7HKzi9ox.png
I want connect my server via vscode but I get this error
I put a link to a discord comment into an embed message
My intent was that it would bring up the message in-app
Instead it opened the message in a browser window
Which is annoying
30 minutes since last post
Did you give https: // in front?
how do i add a role? its saying addRole() is not a function. ive tried msg.author.addRole('598610160113418253');
https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/understanding/roles.md
discordjs-bot-guide/roles.md at master · AnIdiotsGuide ... - GitHub
@grand iron Yes
I'll try it without the https
Because the problem is it opens in-browser
Instead of in-app
It's discord
What website?
Ok, they should fix that imo
Ok
It won't look as asthetically pleasing
'Cuz it will show the whole url
I have the URL hidden on the Author field of the embed right now
So it does not show the full link
Maybe we should contact Discord
and ask them to fix it?
the lib you're using doesn't really matter
links in embeds have target="_blank" in them
so it always opens in a new window in the default browser
Thats why i shouls him use message if want send link
although regular links also have target=_blank lol
so blame discord's client side js i guess lul
yup
🤷♂️
yo i need recommendations for a cheap cloudserver for my image gathering api
google compute engine, galaxygate, contabo, digitalocean, ovh, scaleway, hetzner, vultr...
Can anyone help me understand why I can't seem to get message timestamps?
.eval async function clear() {
let fetched = await msg.channel.fetchMessages({limit: 10})
await msg.channel.send(fetched.map(r => `${r.timestamp}`))
}
clear()```
https://frogmaster.xyz/okYxqgYID
stable or master?
because the function is now channel.messages.fetch({ limit: 10})
update your discord.js.
Welllll
That seems like I would need to change my code in a whole lot of Discords.
😦
timestamp of what
A message
that is createdTimestamp
Tried, same thing
show code
Wow, this whitespace is bad
i just need to find a better provider for my api
I just need to reduce whitespace
i set my whitespace limit to like 5 or so, so that this stuff doesnt happen
i'm probably changing to ovh or contabo once the bot has been approved
because my current fucking host cant even handle the uploads
who needs better downloads than uploads
I meant to close Opera and instead closed Eclipse
oops
big f
setInterval(function(test){message.channel.send(".").then(e=>e.edit(Math.random())))},5000)
How can i put the message.channel.send() outside of the function?
I can't use vars
(Please ping me since I am getting offline now (djs v.11))
uh, that wouldn't do what you'd expect it to if you put it out of the function?
like what do you mean
it returns e.edit is not a function if i put message.channel.send in a variable outside of the setInterval
and i dont want it to send each time
just edit
@sudden geyser
...
I'm not bullying
... from communist doggo always means bad
I'm on mobile
oh, now i understand.
wait


