#development
1 messages ยท Page 923 of 1
k
replace in files would be better
how lol
what IDE are u using?
visual studio code
it doesn't have rif afaik
on each file do Ctrl + h
write in ==
in the replace field
put ===
and then click replace all
also what is the significance of message.mentions.members.first()
why does it have to be chained out so much
if your waiting on an input
yes
message.mentions.members.first() gets the first mention
yes
you should've called it only once
i know
then?
but i have differint roles i want to give
what is the name of the perm to mention @everyone?
what is the name of the perm to mention
@everyone?
@earnest phoenix MENTION_EVERYONE
thanks
but don't, please
@lyric mountain what do you mean i should of only called it once?
lol I had a much different solution when I was grinding away
I just got an idea to change my input filter
yes, but you're getting a member from the guild
if you're gonna use a value in 2+ places, just store it somewhere and call that var
it does lmao
coders fighting with coders
whatever the function returns gets stored in a var
uhc watermark in the bottom left bois
lol
yes
DBL UHC CHAMPIONS
in this case the function return will be the same every time =p
wot does half of this mean?
I got wrong that loaf said
can somebody just help lol
I thought you meant 'sTorIng iT iN a VaRiaBlE doEsn'T dO aNytHing'
just fetch the member once and store it in a variable
WDYM LOL
function returnsOne() {
return 1;
}
if(returnsOne() === 1 || returnsOne() === 2 || returnsOne() === 3)
console.log("lol");
no shit that returns 1
you see why those function calls are redundant
fix those fuckers
how
function returnsOne() {
return 1;
}
const ret = returnsOne();
if(ret === 1 || ret === 2 || ret === 3)
console.log("lol");
lol
jokes on you, you don't need them for if statements
still no curly braces
they're optional
your almost there
as long as what you want to do is on one line
well how the fuck was i supposed to knoww that
every dev should know
because curly braces are for multi-line code
how?
if()
console.log();
else if()
console.log();
else
console.log();
just be careful with your spacing
hi
hi
instead of writing the code many times, and wasting memory
cache a member
and then add the role on that member
so
let mem = message.mentions.members.first();
and then call the addRole method on the mem object
that's not the fix lol
but I say this so they stop doing that shit where they don't follow the DRY convention
I can't wait for his first refactor party
lol
@digital ibex no
@earnest phoenix check for guild events
ive replaced everything with mem var now wtf do i do
first of all calm down
it isn't that hard
i have been trying to get this for over a week
next make a bool table of your code flow
ik
Your swimming against the tide hardcore here
Your focused on solving a problem without solving the logic of your code
make a bool table
this:
boolean values
like an array
no
nO
he'll show you I guess
KuuHaKu will show you
ok
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
think diagnostics
there
"why doesn't this work"
fixed
hell yeah dude
"what part of my program isn't giving me the correct result"
lemme google google in google
everything
Hey.
Ok so I have two files:
// file 1
module.exports = {
async execute() {
return await new Promise((resolve) => {
// do things
resolve(result);
});
},
};```
```js
// file 2
const file1 = require('pathToFileOne');
const result = await file1.execute();
// continue code```
Is there a way to stop execution in `file 2` if `file 1` had a certain result, like an error happened there? I could insert this to `file 2`:```js
if (result == 'err') console.log('error occured');```
But is there a nicer way, for example stop the second file from execution in `file 1`?
"what is the first variable to fail in my code"
then you ask "why isn't this variable producing what I want"
member.has(ownerRole) -> TRUE || member.has(adminBotRole) -> TRUE ====> TRUE
member.has(ownerRole) -> FALSE || member.has(adminBotRole) -> TRUE ====> TRUE
member.has(ownerRole) -> TRUE || member.has(adminBotRole) -> FALSE ====> TRUE
member.has(ownerRole) -> FALSE || member.has(adminBotRole) -> FALSE ====> FALSE
something like that
i mean
it'll help u brainstorm why it's not working
work means it gives the result you want
is this supposed to be valid code or just plain text to keep track
k
is this supposed to be valid code or just plain text to keep track
@royal laurel plain text
k
as in
let regex = "//[.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)]//g"
if(String.match(regex)) return message.delete().then(message.author.send(nolinkswarn))```
it's actually a lot more helpful than u think to put it like that
this is the only way i saw i could use
@earnest phoenix check for guild events
@lyric mountain is the event roleUpdate
lol it's too busy now I will wait with my question
because it helps you check if your logic is right
we're trying to tell you that you have to be a little creative in diagnosing your problem
this is the only way i saw i could use
@earnest phoenix correct
but it wont delete
this is programming 101
@lyric mountain is the event roleUpdate
@earnest phoenix probably
k
String.match is not a function
if your code doesn't throw an error but doesn't do what you want
that means the logic is wrong
String.match is not a function
...
k
but it wont delete
@earnest phoenix if (message.content.match(regex))
so start retyping it and console log everything
forgot to add this
lemme look at it close
make sure everything has the values you intend it to
oh
if your logic (your if conditions) aren't producing what you think
your whole program falls apart
also, use .match(regex).lenght > 0
(node:2916) UnhandledPromiseRejectionWarning: SyntaxError: Invalid regular expression: ///[.*?(?:^|[\W])((ht|f)tp(s?)://|www\.)(([\w\-]+\.)+?([\w\-.~]+/?)*[\p{Alnum}.,%_=?&#\-+()\[\]*$~@!:/{};']*?)]//g/: Unmatched ')'
at String.match (<anonymous>)
because match will return an empty array if it doesn't match
mem.roles.add(adminRole) do i still reference this?
(node:2916) UnhandledPromiseRejectionWarning: SyntaxError: Invalid regular expression: ///[.*?(?:^|[\W])((ht|f)tp(s?)://|www\.)(([\w\-]+\.)+?([\w\-.~]+/?)*[\p{Alnum}.,%_=?&#\-+()\[\]*$~@!:/{};']*?)]//g/: Unmatched ')'
at String.match (<anonymous>)
what do you think the error is KuuHaKu
i dont get why its wrong
no
remove the "" from the string
oh
and then remove the first / and the last /
but then its like invis
so it looks like this
/[.?(?:^|[\W])((ht|f)tp(s?)://|www.)(([\w-]+.)+?([\w-.~]+/?)[\p{Alnum}.,%_=?&#-+()[]$~@!:/{};']?)]/g
show your code
invalid regular expression
the regex shouldn't be a string
let regex = /[.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)]/g```
it isnt
okok
me
from him
LMAOOO
https://gyazo.com/1d19a3b327760bf81d12255406e4a27b
how i do that?
discord broke the regex
oh
i ran my bot to see if anything has changed
nothing changed
i can still not give anyone roles
here /.*?(?:^|[\W])((ht|f)tp(s?):\/\/|www\.)(([\w\-]+\.)+?([\w\-.~]+\/?)*[\p{Alnum}.,%_=?&#\-+()\[\]*$~@!:/{};']*?)/g
fixed regex
alien language
yes
the secret language
is
regex
tbh
if i just smashed my keyboard a couple times
i could prob get the same result
lol I love that regex's work but to be literate
that regex checks for any kind of url
ooof
const flake = flakeID.match(/^\d+|\d+\b|\d+(?=\w)/g);
I made that like 8 months ago
wait
and couldn't tell you why it works
/(https|http):\/\/(.*)\/?/g
this one
I could change the (https|http) to https?
but meh
anyway
tumbleweed
I'm pretty sure I could spend the rest of the year refactoring my gamebot
but it works
discord.js v11?
Anyone want me to make a discord bot for em or like help em to create one or help with something specific? Cause need some money :/
wise boi
Anyone want me to make a discord bot for em or like help em to create one or help with something specific? Cause need some money :/
@gaunt blade not the right place
@lyric mountain oh okay, u know a right place?
embed remotes I think were the only thing I had to recode
with v12
partials etc Tim helped me a ton
@gaunt blade maybe some freelancer site or reddit
okay, I did post on fiverr tho xD
then just...................||wait ||
@sullen portal what is the error?
Wait let me copy and paste
okay
Its incorrect type
Expected "array"
in " "bundleDependencies": false,"
It says that line has an error
@gaunt blade
can you put ur whole package.json to hastebin.com?
I don't use pastebin
JSONLint is the free online validator and reformatter tool for JSON, a lightweight data-interchange format.
it cant be boolean (so it cant be true or false)
try that site NarutoFan
^^
just paste it in there and validate
so it must be a string (a "text here" string, by replacing text here with the needed value)
wait i put "" around the false
too
["false"]
and it worked
theres no error anymore
ok
how would i make a dashboard for my bot that shows the ping of the bot?
like an html dashboard on a web server?
discord <-> database <-> website
would be my first thought
oh wait you literally meant ping
I think most bots are reliant on the status of discords servers for ping
but they seem pretty fast
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters How can i resolve this problem with special characters? (JS)
Ok perfect, thanks
if the bot is not allowed to send messages to the server
and
You send a message to the channel I set
can you help me?
@earnest phoenix no
Eror:
at item.request.gen.end (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/11.6.4/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:7473) 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: 65)```
@earnest phoenix
@earnest phoenix no
You did not understand
or I couldn't explain
if the bot is not authorized to write on any server
Send a message to the channel I set on my own server
Can you help me?
if the bot is not authorized to write on any server
send a message to the console
ew
and this is currently silenced
it fails the console because it can't message to this channel
can someone help me?
@honest perch sure i know
ask to ask?
just post your question
There keeps being an error with the message embed
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.```
can someone help me fix it
MessageEmbed field values may not be empty.
how do you fix it?
you.. give the field a value..
bruh
its in node-modules
yes but its triggered because your code is trash
it said theres an error in that code
it doesnt say that my code crashed
it said that there was an error in the messageembed.js
yes, because your code failed there
the error originated there because of an invalid input you gave it
the library threw the error
it doesnt say where
you made it throw the error.
but where did i make the error
show the full error
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
at Function.normalizeField (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:418:23)
at C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:438:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:437:8)
at MessageEmbed.addFields (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
at MessageEmbed.addField (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
at Client.<anonymous> (C:\Users\kethy\Desktop\Discord Bots\index.js:453:18)
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\kethy\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
index.js line 453
erm
.addField('You guessed...', msgargs2)
@modern sable
ok
ty
ok ima see it
let msgargs2 = args.slice(1).join(" ");
@quartz kindle this is msgargs2
it can still be empty
make sure args[1] exists
console.log args and you will likely see the problem
also just as a tip making a command handler will ease your life if you havent made one already
@quartz kindle thank you
Do u need Help ? loaf
Nah just saying the online examples work good
You don't have to fully understand it to get started
Considering I'm only just starting to get used to C#, should I play around with Winforms or WPF first?
Reading about differences and seeing that WPF is more complex compared to Winforms ๐
... unless I'm confusing their actual purposes?
that's vague
Once post is posted on Instagram, post it on auto channel
again, so like a feed?
ex: i share instagram post my account
for example someone posts something on Instagram, that post would get posted in a specified channel?
so a feed...
for example someone posts something on Instagram, that post would get posted in a specified channel?
@earnest phoenix yep
the legacy api will be disabled on June 29, 2020.
so i'd suggest using the second one
best of luck 
that's vague
@lyric mountain what?
I couldn't find the post related category and there is no api๐ฅบ
if you want to have it fully automated https://developers.facebook.com/docs/instagram-api/guides/webhooks/
using google might help you too
i know how to actually do it, but i wont tell you exactly, because that would be 
are you sure string is a string?
try doing just a test string
use it on an array you could get an error like that https://img.thaun.dev/7574a.png
show us
(node:8964) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `channel` of 'undefined' or 'null'.
for this
const { channel } = message.member.voice;
message.member.voice is undefined or null
is the user connected to the voice channel?
how could i define it
down in the code i solved it with if (!channel) return message.channel.send('I\'m sorry but you need to be in a voice channel to play music!');
I think ik why
hello i wanna ask can i set a bot in my server that only delete a specific user's message
if (message.user.id === "someid") message.delete()
but where should i type it because i am new on making a bot
well, first of all you gotta setup a basic bot code
google "discord.js bot tutorial"
When sharding, if I want to send a direct message to a user, not knowing which shard the user's guild is on, what's the best way to do this?
discord.js
returns false, but i voted
well the function please ^
When sharding, if I want to send a direct message to a user, not knowing which shard the user's guild is on, what's the best way to do this?
@glass crag fetchClientValues.
@restive furnace thanks ๐ฅฐ
how i can do e!play but with out url?
python
just the name of the video
check if the command has any arguments containing a url
oh that
@earnest phoenix for fetching a video through a query, use https://developers.google.com/youtube/v3
especially this one https://developers.google.com/youtube/v3/docs/search/list
ok
and for getting a api key for authorizing these requests: https://console.developers.google.com/apis/dashboard
Google Cloud Platform lets you build, deploy, and scale applications, websites, and services on the same infrastructure as Google.
how would i make a music bot i have been trying but i keep getting errors
code
i tried
whats the error
it gives me some stupid error
whats the error
something like Unhandled Expression
user.permissions.toArray().map(p => permisos[p]).join(", ")
```this work in 11v?
dont watch tutorials, they're always outdated @livid falcon
oh
@earnest phoenix it should
ok
:v
thats the motto
hey @everyone
toArray is undefined
[2020-05-12 18:02:07]: [Error]: TypeError: Cannot read property 'name' of undefined
const logger = require("../utils/logger");
const Discord = require('discord.js')
const client = new Discord.Client();
const fs = require("fs")
const ms = require('ms');
module.exports = (bot) => {
const load = dirs => {
const commands = readdirSync(`./src/commands/${dirs}/`).filter(d => d.endsWith('.js'));
for (let file of commands) { //for each of these files
let pull = require(`../src/commands/${dirs}/${file}`);
bot.commands.set(pull.config.name, pull);
if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name));
};
};
readdir(`./src/commands/`, (err, directories) => {
if (err) logger.error(err);
var dirArray = [];
directories.forEach((f, i) => {
if (lstatSync(`./src/commands/${f}`)) {
dirArray.push(f);
}
});
dirArray.forEach(x => load(x));
});
};
At
bot.commands.set(pull.config.name, pull);
why is this happening?
pull.config is undefined
In Discord.js how do I get the shard id of a Client Spawned by a ShardManager? There's client.shard but that appears to be a ShardClientUtil instead of the actual Shard, and it doesn't appear to have the id as a property.
https://discord.js.org/#/docs/main/stable/class/ShardClientUtil
found it: ```typescript
client.shard?.ids[0]
channel.updateOverwrite(guild.roles.cache.get(role_id), ...); How do I set more permissions on True? (Connect and move members)
how do you get total memory usage of your bot?
library?
Idk I use PermissionOverwrites for js
channel.updateOverwrite(guild.roles.cache.get(role_id), ...);How do I set mor permissions on True? (Connect and move members)
@balmy knoll
@wild plover But i have to use channel.updateOverwrite
What lib?
@hardy vector what library are you using?
discord.js
https://www.valentinog.com/blog/node-usage/ might be old, but still useful
Learn how to use a Node.js builtin method for investigating the memory usage of any given process.
memory usage doesnt even depend on library
just use process.memoryUsage.rss / 1000 / 1000
if the lib u use caches a lot it does
and this will give u approximate usage in mb
asking for the library still gives me the info of what language they're using
well i mean fetching it is independant on library
asking for the library still gives me the info of what language they're using
@earnest phoenix
ok but u could have just asked what language it was
dont ask to ask, just ask
@wild plover But i have to use
channel.updateOverwrite
@balmy knoll
https://discordjs.guide/additional-info/changes-in-v12.html#guildchannel-updateoverwrite
Hope this helps
ok but u could have just asked what language it was
welp doesn't matter
i remembered it but took a bite of my sandwhich and then forgot it
Also ask for this help in the official DJS server
Lel
it will pretty much
once the error is caught the code stops in that file after you handle the error
and the easiest way is indeed a try catch block
Yes but I want to stop in the other file. If there is an easy way to do so
you mean file 1 too
the thing is that you dont have to do anything extra apart from adding try catch like
try {
await command.execute()
}
catch (e) {
// handle
}
Hmm but will it also catch an erorr caused by a MySQL query (in file 1)?
yeah
it's sort of a catch all
i havent really seen anyone return an entire promise before eiter
client.shard.client.shard.client.shard.client.shard.client.shard.broadcastEval(`this.shard.id === -1 ? -1 : this.shard.id`)
why doesn't this return shard id? Discord.js ShardingManager
what the fuck are you trying to do with client.shard.client.shard.client etc
Just trying to make it look interesting 
client.shard doesn't work as well
circular dependencies lmao
v12 doesnt have shard.id
it has shard.ids
which is an array of shard ids managed by that shard
because internal sharding exists
Oh, I'm trying to get the master shard id.
what master shard id?
Well, the id of the current shard (for the client).
for the person using the bot?
sure
client.shard.ids[0]?
Would that be guaranteed to get the current shard id? I'm still kinda new to sharding so it's harder for me.
using the default sharding settings yes
the manager will create 1 shard per process by default, so each shard will only have 1 item in the .ids array
however if there were more than 1 shards per process, would that still work?
no
in that case you would use message.guild.shardID
assuming the sharding manager properly assigns those
That's what I want, thanks 
Didn't know guild had a shardID property.
wat
ok so I have this code
const gIDs = bot.guilds.map(g => g.id);
for (const g of gIDs) {
const gInDB = await bot.db.query(`SELECT * FROM serverInfo WHERE serverID = ${g}`).catch(console.error);
// console.log(gInDB[0]);
if (gInDB[0].serverID) {
if (gInDB[0].serverID.length < 1) {
await bot.db.query(`INSERT INTO serverInfo (serverID) VALUES ('${g}')`);
console.log(`Added ${g} to database as it was not in it`);
} else if (gInDB[0].serverID.length > 1) {
return console.log(`${g} is already in the database`);
}
} else if (!gInDB[0].serverID) {
// await bot.db.query(`DELETE FROM serverInfo WHERE serverID = '${g}'`).catch(console.error);
console.log(`Error with \n ${gInDB[0]}`);
}
}```
and it does only 1 entry, then it stops
the idea of the code is for fault-proof to check for guild ID's and if they exist in the database
but it does only one check and that's it
because you return it
ah, i wasn't expecting return to cancel out the for
as I though it was for the if statement only
if you want to skip a for iteration, use continue
so this is my config json file { "token": "my token ovbiously", "ownerid": "id", "specialid": "id" } but how do I make it so I can do like "ownerid": ["id", "id"]?
























can bots use animated emojis
yes
@earnest phoenix they can
aight I'm slow
then from that array u access whichever id u want
good to know
@earnest phoenix to access the emoji you gotta do \:emoji:
ok so, apparently there is something in my bot.guilds.size
that provides undefined
and it gives this error when i'm trying to access the database
i have completely no idea what is a guild, but also is not
bot.guilds.size? What version of d.js are you using?
11.6.4, bot.guilds.size is 37
basically the guilds has something
in it that isn't a guild
bot, holdup i think i gotta do some adjustments
mby my fault proof code is not so fault proof

fault proof code doesn't exist

If a code is fault proof then that's the fault. 
there's always gonna be some random error that'll kill it
inb4 Error: true cannot be assigned to true
TypeScript for the win 
the idea of that fault proof code is, if the bot spazzes out and doesn't add the guild ID upon joining to the database it will do that on restart to add it
However I hate the "sharding" development process with TS...
"scripts": {
"start": "ts-node -r dotenv/config ./src",
"dev": "nodemon -r dotenv/config -e ts --exec \"yarn build\"",
"build": "tsc && node -r dotenv/config dist/src/index.js",
"lint": "eslint --ext ts,tsx src/**"
}
glad i will never get to the point of sharding, im too bad at making bots

hhmmmmmmmmm
just ask
then ask @limber flume
Isn't the point of asking to get an opinion from someone who has more experience (therefore is "smarter")?
How were existing servers deleted? 1500 server down 790 server wtf this ???????????
erm
i mean you asked for help, we're here now sooooooooooooo
ok
@earnest phoenix you made a sharding mistake or discord has a stroke
how to change the color of this
hol up
@bot.command(pass_context=True)
async def servers(ctx):
servers = list(bot.guilds)
embed = discord.Embed(title=None,description="Connected on " + str(len(servers)) + " servers")
await ctx.send(embed=embed)
this
how to change color
me dum dum
color=""
i tryed
i think
What is colOR
erm
@earnest phoenix will this problem be solved in the coming hours?
It's colour (eww)
i tryed this
@earnest phoenix i think so yes
yo guys i tried to make a rock paper scissors command but my bot doesn't react with any emoji (so i can play)
const { MessageEmbed } = require("discord.js");
const { promptMessage } = require("./functions.js");
const chooseArr = ["๐ป", "๐", "โ" ];
module.exports.run = async (bot, message, args) => {
const embed = new MessageEmbed()
.setColor("#C8A3FF")
.setFooter(message.guild.me.displayName, bot.user.displayAvatarURL)
.setDescription("Rock Paper Scissors game has started, React to one of the emojis to play the game!")
.setTimestamp();
const m = await message.channel.send(embed);
const reacted = await promptMessage(m, message.author, 30, chooseArr);
const botChoice = chooseArr[Math.floor(Math.random() * chooseArr.length)];
const result = await getResult(reacted, botChoice);
await m.reactions.removeAll();
embed
.setDescription("")
.addField(result, `${reacted} vs ${botChoice}`);
m.edit(embed);
function getResult(me, clientChosen) {
if ((me === "๐ป" && clientChosen === "โ") ||
(me === "๐" && clientChosen === "๐ป") ||
(me === "โ" && clientChosen === "๐")) {
return "You won!";
} else if (me === clientChosen) {
return "It's a tie!";
} else {
return "You lost!";
}
}
}
module.exports.help = {
name: "rps"
}```
i don't get erros (discord.js)
what
it must be in lower case
-_-
i dont understand u
@limber flume embed.color=0x<hexcolor>
3124214 or 0xfffff
you didnt
I D K
(1) isn't a tuple
(1,) is a tuple
let me try ;|
@rough walrus you aren't reacting with the bot as far as I can see.
no
Without the <>
remove the <>
ok
@bot.command(pass_context=True)
async def servers(ctx):
servers = list(bot.guilds)
embed = discord.Embed(title=None,description="Connected on " + str(len(servers)) + " servers")
embed.color=0xfffff
await ctx.send(embed=embed)
that will be white
Depends on your promptMessage function.
@nimble escarp my bot doesn't react with any emoji, after that it edits the message with result, and i can't play because there are no emojis
You heard of discord.Color?
E R M
^ Less customisability but good presets also a rgb converter
The bot has to react with the emoji first @rough walrus so that they show up.
yes, but it doesn't react
It's mentioned in the docs
Where are you reacting then?
show me the promptMessage function @rough walrus
Putting tab instead of space or vice versa
python
IndentationError
loL
If you have a proper IDE that doesn't mix tabs with spaces, indents are not an issue
better discord?
or am i tripping?
They could steal ur acc 
EDIT: getting a malware is not really something that should be counted
more
Sounds like a topic not for this server
yo, is anyone aware of a bug like this?
/root/server/node_modules/discord.js/src/util/Util.js:32
);
^
SyntaxError: Unexpected token )
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/root/server/node_modules/discord.js/src/index.js:3:14)
at Module._compile (module.js:571:32)
i believe it's caused by something else but i can't find what
it's happening i think because i'm trying to require it in an existing node process (?)
@nimble escarp lmao i just didn't set a function for promptMessage,i do stupid mistakes i'm just still learning js
hi
so how come
this dosent work
"token": "my token ruihriweghekrjg",
"ownerid": [ "279116778246766593", "528353078672490507"],
"specialid": "528353078672490507"
}```
the owner id
dosent let both of us use the commands
only me
You need to change the checks since ownerid is now an array instead of a string.
how would I do so?
What library are you using?
d.js 11.6.4
Then you need to find your check (something like this)
if (message.author.id === config.ownerid)
and do something like this
if (config.ownerid.includes(message.author.id))
i have it as this
if (message.author.id !== ownerid) return;
would that work for both of us?
then just use .includes and negate the expression 
@bleak agate the error literally says unexpected token
so requiring a an existing node process creates a syntax error
cute
It says unexpected token, meaning it thinks that there's something that shouldn't be there.
Many stuff can cause that error, like a missing comma.
@bot.command(pass_context=True) async def help(ctx): await bot.say("no") with discord.py i made a help command like this and when i run it i get an errror message sent to the console saying the command is already registered
you need to remove the inbuilt command
how do i do that? sorry if its easy im just stupid
bot.remove_command('help')
How do you remove the default help command in discord.py? Or at least change the format. But I think changing the format would be nice, I don't really like the format at all. And I've been looking ...
bot.remove_command(command_name) right after declaring bot
One second of using google 
ovxrfl0wToday at 4:51 PM
It says unexpected token, meaning it thinks that there's something that shouldn't be there.
Many stuff can cause that error, like a missing comma.
so, this is true but
it runs fine when i'm trying to run it from just the console
but if i try to run it from within this game server i'm using, it throws the error
i can replace all of the game server's code with var Discord = require("discord.js"); and return; and it still throws the error
which is weird
A game server? That's a new one to me.
Well, anyway, are you sure it's the same version?
Are you really trying to run what you want to run?
how do you mean?
explain
Since I don't know what your development environment is I can't really provide a better explanation.
Let's say you'd be running it on a vps.
What I'm asking is: is the code you're trying to run on the vps the same as the one you are running locally?
oh
i meant that it runs fine on the server's console
the only instance where it doesn't run correctly is when i bundle it into the game's code
are you trying to run the bot on a webserver?
yeah
i'm open to any suggestions because i've been trying to figure this out for 8 hours or so now
This one is new to me. ๐
so
i'm not even running the bot at this point, i only have a single line of code i'm testing
alright
one sec
The thing is, we need to see how you're trying to run the code that fails (e.g. how you're bundling it into the game, etc)
yeah, for sure
We need to know what there's to work with to diagnose the issue.
yeah
Since it runs in the console it most likely is the way you're trying to run the bot when it's bundled.
the platform: vylocity, a js-based engine that runs in your browser
the goal: a discord bot that scrapes messages from my discord server and serves them to the game server (so i can run commands from my chat, etc.)
the issue: var Discord = require("discord.js"); keeps tossing the above error when it's run inside the code, but not when it's run from my code
it's difficult to show the code because it's like
obfuscated i guess
just
the ide compiles it- one sec
it doesn't matter
var Discord = require("discord.js");
console.log('Vylocity v0.0.1 https://www.vylocity.com/');
this is the only code that is running
everything else is commented out
ok
and it provides the above error
Also why would you run it in the browser, don't you want the bot to be available all the time?
Running it in a browser would mean that the code would run only when someone visits the location.
go to this file
/root/server/node_modules/discord.js/src/util/Util.js:32
that's where the error lives
how i disconnect (voice channel) the bot in python?
it's running on the server end of the browser game, so it's hosted on the server (and can communicate w/ the game server directly rather than having to send post reqs and etc.)
kk
sec
@earnest phoenix https://stackoverflow.com/questions/44612538/python-discord-bot-disconnect-from-a-voice-chat
static flatten(obj, ...props) {
if (!isObject(obj)) return obj;
props = Object.assign(
...Object.keys(obj)
.filter(k => !k.startsWith('_'))
.map(k => ({ [k]: true })),
...props,
);
this is the section in question
line 32 is );
my first assumption was it's my node version fighting with the ... spread operator
but i updated node to 14 and it still has this issue
what's your version
12.16.3 is the best node version to run as of now 
best is subjective
Yes but best in a sense of support for existing libraries and other stuff.
@bleak agate so ur literally running these 2 lines and its erroring?
It might be the "obfuscation" bit.
If it touches node_modules it most likely is causing the issue.
this is past that, so i edited what the ide outputs
and commented out everything but those two lines
dude you can't just do that
and show us 2 lines that are separates by god know what
show your entire thing
maybe there's conflicting code
that's what i mean though
did you close the function?
I am using Discord.js and I want to poll the user with a reaction, for instance to confirm they react with โ to deny they react with โ, is there a way to wait for a reaction and then after a certain amount of time cancel the action?
this is all of the code i am executing
do you get a line number where this erorr is being thrown
yeah, i posted the code snippet it's complaining about up above
@fallow quiver https://discord.js.org/#/docs/main/stable/class/Collector
https://oliy.is-just-a.dev/ledojg_3910.png yes it's syntactically valid
Didn't anyone check the path the error is referencing? it's in node_modules/discord.js
You shouldn't under most circumstances touch anything in node_modules 
i was using the command nohup ./node server.js & before
using nohup node server.js & fixed it
They may, however you shouldn't really go around poking inside the module itself.
cant u just do node server
you can just install the module again
Then that's solved, no?
messing with modules is the best way to learn new practices
yeah @white anvil, this is just how i've done it for a while and i didn't think to change it
yep
bruh
do you know what ./ is?
wait, you'd need the node executable in the cwd to be able to run that
parent folder right
no
no
parent is ../
parent is ../
./ is current folder
but still node is a path variable
what's the diff between ./node and node then?
so you don't need ./
./node would try running node executable inside the current folder
do you have a binary called node in that folder?
node will try to use the path variable node
show the files in that folder
I wonder what it'd output in nohup ./node -v &
could be, might be non-existent as well but that wouldn't really output a js error 
@bleak agate run the following ./node -v
for science
that explains it
that explains- yeah
Well, never would've guessed that... 
thanks guys
lol
truly you are adept at jumping through the retarded hoops i've set for myself
This gotta be pinned somewhere tho lmao, it's a hilarious situation.
yeah
man
i was like
man
of course it's that
so much time trying to figure out my syntax issues
var tab= "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN0123456789_-"
function random(rdm){
rdm[Math.floor(Math.random() * rdm.length)]
}
console.log(random(tab))```
someone can help me ? it does not work
yes xD
eww
i'm french
In an IntelliJ product, is it possible to setup a model DB so I don't get syntax warnings like
https://images.vinniehat.com/i/aedirpfs1ezgjx8.png
they play with zasd
@wicked pivot you are not returning the value
do you know what a return is?
that function is missing the return value
that's the most basic thing on a function
the function executed the code
and then what?
it's not returning anything
it returns me "undefined"
Yeah, the realization of "wait, that's wrong"
Yes, you need to return a value in the function
function random(rdm){
return rdm[Math.floor(Math.random() * rdm.length)]
}```that's all?
yes
yes
yes
that's literally it


