#development
1 messages · Page 1284 of 1
Ohh!
shall i put this on top of my index.js?
bot = new Discord.Client({
presence:{
activity:{
name:"my status",
type: "WATCHING"
bot.user.setActivity(`my status`, { type: 'WATCHING'}).catch(console.error);
}
}
})```
like this?
oh wait
Don’t think so
bot = new Discord.Client({
presence:{
activity:{
name:"my status goes here?",
type: "WATCHING"
}
}
})```
like that?
yes
The logic behind it is to use
member.remove_roles(...)to remove the role.
@sudden geyser remove_roles accepts eitherdiscord.Objects ordiscord.Roles (basically any object that has an.idproperty
ah then that too
One workaround when you don't want to bother getting the roles is to create discord.Object yourself ¯_(ツ)_/¯
How can I get the image (URL) of the bot?. I have tried with message.author.bot.displayAvatarURL...
@lucid wharf the link?
Yess
I have succeeded but the user, what I need is the bot Q_Q
ok go to 0auth2
there is a checkbox
choose 1 that is bot
copy the link
enter it into hte searh
@lucid wharf client.user.displayAvatarURL i think
just read the documentation, it won't kill ya
@golden ingot i love you
const m = await msg.channel.send(mainembed);
await m.react('🚫');
await m.react('🧱');
await m.react('⚛');
await m.react('📏');
const filter = (reaction, user) => {
return ['🚫', '🧱', '⚛', '📏'].includes(reaction.emoji.name) && user.id == msg.author.id;
};
const removeReaction = async (m, msg, emoji) => {
try { m.reactions.find(r => r.emoji.name == emoji).users.remove(msg.author.id); } catch(err) {}
}
awaitReactions(msg, m, options, filter);
const awaitReactions = async (msg, m, options, filter) => {
const { min, max, page, limit } = options;
m.awaitReactions(filter, { max: 1, time: limit, errors: ['time'] })
.then(async (collected) => {
const reaction = collected.first();
var extembed = await getExtClutcherStats(args, msg);
var bridgeembed = await getBridgeClutcherStats(args, msg);
var omniembed = await getOmniClutcherStats(args, msg);
if (reaction.emoji.name === '🚫') {
return await m.delete();
}
else if (reaction.emoji.name === '🧱') {
await removeReaction(m, msg, '🧱');
await m.edit(bridgeembed);
}
else if (reaction.emoji.name === '⚛') {
await removeReaction(m, msg, '⚛');
await m.edit(omniembed);
}
else if (reaction.emoji.name === '📏') {
await removeReaction(m, msg, '📏');
await m.edit(extembed);
}
else {
awaitReactions(msg, m, options, filter);
}
}).catch(() => {});
}
Im trying to create a reaction menu but every time it says it cannot send an empty message even before clicking on any of the reactions
i know the functions do return the embed
it seems like im not sending any kind of message before the if statements, but it dosen't even get to them before erroring out
It's adding the first four emojis before the error occurs, correct?
Since it's erroring out, does the stacktrace point to anything useful in your source code.
yes i debugged that the emojis are being sent before the error
no the stacktrace just says discordapi error. no line is specified
in my source code
(node:18187) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/bardia/3d4hbot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:18187) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:18187) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
How do I make it so if my bot is the only user in a VC that its in, it would leave in discord.py?
hello? is there a way to make images from api using any package (like canvas) and make them gif?
what
@ripe wyvern lmao u copy
hello? is there a way to make images from api using any package (like canvas) and make them gif?
@viral iris no
u must have an gif
or I think if u put the newest link to it when u made it to a gif but I dont think so 😦
@sudden geyser no nothing useful and yes error happens after emojis
What you could do is try adding debug statements before each m.edit (aka use a debugger or just plop console.log in there). That should give you an idea of where the error is occurring.
What you could do is try adding debug statements before each
m.edit(aka use a debugger or just plopconsole.login there). That should give you an idea of where the error is occurring.
@sudden geyser I put console.log before every m.edit put the program dosen't get to any of them
it errors before i can even choose a reaction
after awaitReactions is const awaitReactions = async (msg, m, options, filter) => {
i just split them up bc 2000 char limit
ok did that same issue
But it couldn't throw an error as it's being ignored with .catch(() => {})
put more console.logs and see until where it works
ok
also is there more to the file you could share
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
yeah this is the entire function
i have promises in each of the *ClutcherStats which reject strings
i changed the try/catch in the pastebin
Also over here: js const removeReaction = async (m, msg, emoji) => { try { m.reactions.find(r => r.emoji.name == emoji).users.remove(msg.author.id); } catch (err) {} }
You need to await the statement in the try block as it won't catch the promise.
await m.reactions.find(r => r.emoji.name == emoji).users.remove(msg.author.id); ```
so like this?
Yes, but that's a minor bug. It's not the exact issue you're having.
ok
ok i moved awaitReactions(msg, m, options, filter) to after const awaitReactions = async (msg, m, options, filter) => {
it dosen't error anymore but now the reactions don't do anything
if you need it to be recursive, declare it as a function
async function awaitReactions(...) {
...
}
ok did that
i followed this tutorial if that helps
ooh ok so i got it working, but the removeReaction function dosen't work the reactions don't get removed
thats probably v11
VBA
How do you get only the float part of a decimal number? As in, get 0.9 from 6.9.
https://alebot.is-inside.me/gNdTkTRI.png
any idea why this happens every single time?
Hmm...
guys i wonder how the first coding language was written
Maybe I could convert to integer and subtract
Oh right
And then abstracted into higher level languages
I think it was ENIAC
is there a way to get all attachments in a message (images, etc.) and then display them in an embed in d.js?
similar to #starboard
asm was second one :)
@restive furnace ASM came a few years later
(ping me if you have close to a response)
Then fortran maybe?
@restive furnace ASM came a few years later
@faint prism Jacquard machine seems to be first according to wikipedia, then ENIAC. But most compilers compile into ASM/Binary.
I mean, if you consider a loom in 1804 to be a computer, sure lol
yes
is there a way to get all attachments in a message (images, etc.) and then display them in an embed in d.js?
@karmic compass Iterate through<message>.attachments
Also you can't attach more than 1 image
Attachments returns a collection
LMFAO U DONT SEND ANYTHING OUTSIDE BRO!
But most compilers compile into ASM/Binary.
Yep, pretty much.
Some Higher level -> ASM (instructions, registers, and opcodes) -> Binary representation
LMFAO U DONT SEND ANYTHING OUTSIDE BRO!
what
what
@slender thistle ||I just did what Cry did||
bro what the hell is that on top.gg
can someone tell me why is that COVID-19 shit there do u like to have it like others?
@humble gyro llmao srry for ping but u needa explain for us
Did you read it
yes
People kept complaining about long bot review times and that disclaimer is there to explain why
People kept complaining about long bot review times and that disclaimer is there to explain why
@slender thistle bruuuh
And no it wasn't added there "just because it's nice"
there is always a reason
Does anyone have experience with pug?
I haven't touched web dev stuff for over a yr im lost
Does anyone have experience with pug?
@hearty wren no, but I have experience in pubg
That won't help
why are you using pug?
why not a more popular framework like Angular, Vue, or React?
Its not as complicated and idk those frameworks
I think ill just do it in flask and save me this bs
I dunno about php
hello, can anyone help me to make a embed?
Vue.JS i've heard is a good mix of the other JS frameworks
I'd recommend that one because how easy it in to add on to a website
Im usually working in flask but i heard its "cool" to use a js framework so ik express alrdy but pug is not recognized by the script
hello, can anyone help me to make a embed?
@drowsy kite Yes, discord.js?
hello, can anyone help me to make a embed?
@drowsy kite If Discord.JS https://discordjs.guide/popular-topics/embeds.html#embed-preview
yes i guess so i don't understand ".addfield"
yes i guess so i don't understand ".addfield"
@drowsy kite It's two strings, a title, and the content
.addField("Title", "Topic", "true/false")
Just replace the things I want with what is there
.addField(<Title>, <Content>, <InlineBoolean>);
Just replace the things I want with what is there
@drowsy kite Well you put the strings you want there
haha = new Discord.Client({
presence:{
activity:{
name:`${bot.guilds.cache.size} with ${bot.users.cache.size} users | c!help`,
type: 'PLAYING',
}
}
})``` my bot's status not appearing
Just like any other function in Javascript
okay
haha what
okay
OMG ty to whoever told me to use vue im on their docs and it looks so simple
just tell me if something is wrong with that code
@drowsy kite Well you put the strings you want there
@faint prism thanks for support me 😉
It's a function that accepts 3 arguments iirc
@hearty wren thanks to Auger
haha = new Discord.Client({
presence:{
activity:{
name:`${bot.guilds.cache.size} with ${bot.users.cache.size} users | c!help`,
type: 'PLAYING',
}
}
})``` status not appearing
please help
please help
@sly dawn Hey you sent that already https://discordapp.com/channels/264445053596991498/272764566411149314/760921344786694176
Be patient
ik but they ignored it lol
ik but they ignored it lol
@sly dawn https://discordapp.com/channels/264445053596991498/272764566411149314/760921721380798514
stop pinging?
k
You waited 1 minute
Fine
@faint prism is this basically?
I mean, you copy and pasted that, but yeah
okay
Straight out of the example
yeah
@drowsy kite lemme guess it, you got it from discord.js.org
@sly dawn 🤯 REALLY? 😂
@drowsy kite yeah
mean like, u make ur own
i guess
not to copy from websites
i wil make my embed
please help
@sly dawn https://discordjs.guide/popular-topics/common-questions.html#how-do-i-set-my-status-to-watching-or-listening-to
Try calling it outside where you're instantiating the Client object
that wont work cuz ur not exporting it lol
k
to watching or listening
🇵🇹
i mean, my status is not appearing, first it worked then it didnt work
bruh have ur eyes open..
😒
someone help ^^^^^^^^^^^^
haha = new Discord.Client({
presence:{
activity:{
name:`${bot.guilds.cache.size} with ${bot.users.cache.size} users | c!help`,
type: 'PLAYING',
}
}
})``` status not appearing
@sly dawn
@sly dawn this is my bot
what language is that lol
portuguese
hello from china
for music bots how do i get a non laggy api key any answers?
translate?
non-laggy API key?
I have some portuguese friend
espanol
cuz all the api keys i've used
I have some portuguese friend
@open rune i have a irish friend
were hella laggyy
...
me no Irish
im saying i got alot of latency in my api keys
i wanna know how i can get an api key with less latency
API key for what though.
The key is just a key. It probably doesn't have any effect on latency.
Unless the API doesn't like you
lol
does Discord's API count
It counts a lot of things
with this code where is split the values into an array js cmd --text yes lmfao --text jsnfnrn".split("--text");
is there a way to only get the value after --text and before any other tags
so like
ban 551854789990940699 --reason yeah cool reason --time 4d
reason would be yeah cool reason
yeah
and time would be 4d
just split it, and loop over each -- prefix and check if it's a known argument like, text or reason or time, and do the appropriate stuff with the index+1
member.user / i want get badge user how?
See .fetchFlags(): https://discord.js.org/#/docs/main/stable/class/User?scrollTo=fetchFlags
It doesn't contain every badge.
thank u bro
Lesh go!
now for the 7 week wait yeah?
now for the 7 week wait yeah?
@obtuse jolt ... yeah 😔 ✊
@obtuse jolt Is this what you're looking for
i want the things individually
Individually?
yeah so like
ban 551854789990940699 --reason yeah cool reason --time 4d
const reason = the reason
const time = the time
Individually?
@earnest phoenix bro tf u cooded that shit
Yes
use .trim instead of doing all those slices
tr yetkili varmı
e.startsWith(" ") dont do this
@obtuse jolt is this weird having ur pfp like this?
"Everyday and week" wut
its clearly stock
@obtuse jolt wdym
"Everyday and week" wut
@hazy sparrow lmao Im gonna fix that
Yeah you should probably
@obtuse jolt wdym is it weird to have the bot pfp like that
no
same
@stiff orbit start here https://discord.js.org/#/
no discord.py
ew
its easier
Hi
oof
How i can change my nickname in the server
U CAN'T
you have to boost the server
lul
Would it be something like this?
When I do
channels.create(name, {position: positionNumber});
I get different results, most of the time wrong results, in comparison to
channels.create(name)
.then(async channel => await channel.setPosition(positionNumber));
Can someone explain me why? Is this a bug?
Discord.js
@obtuse jolt What you wanted?
With that you can do
const reason = optionsObj.reason, time = optionsObj.time;```
how can I remove a user's reaction right after they click on the bot's reaction?
else if (reaction.emoji.name === '🧱') {
await m.edit(bridgeembed);
await m.reactions.get('🧱').remove(msg.author.id);
awaitReactions(msg, m, options, filter);
}
i have this
static void UpdatePresence() { DiscordRichPresence discordPresence; memset(&discordPresence, 0, sizeof(discordPresence)); discordPresence.state = "Playing Solo"; discordPresence.details = "Competitive"; discordPresence.startTimestamp = 1507665886; discordPresence.endTimestamp = 1507665886; discordPresence.largeImageText = "Numbani"; discordPresence.smallImageText = "Rogue - Level 100"; discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657"; discordPresence.partySize = 1; discordPresence.partyMax = 5; discordPresence.joinSecret = "MTI4NzM0OjFpMmhuZToxMjMxMjM= "; Discord_UpdatePresence(&discordPresence); }
oh look a secret
tell me your secrets
Ok
no, don't lol
$argsCheck[>1;Please mention somebody to mute.]
$nomention $unmute[Muted]
$onlyPerms[manageroles;:error:You don't have enough permissions to run this command.]
$title[Mute]
$color[#FF0000]
$footer[Muted by $username.]
$description[
Unmuted: <@$mentioned[<]>
Unmuted by: <@$authorID>
]
tell me your secrets
ok . . . , , don’t tell anyone . . .
one time in kindergarten. . , ,
i stole a stuffed bear . . . ,
i still have it though , , . .
the police have been notified

no clue what the use for
i believ tokens are part of your token date it was made and some thing else
123123
I can’t remember
How do I make a disable/enable command? As in discord.py
rude
youll need to have a database
Ok
Haahha
what does the command need to enable/disable
How do I make a disable/enable command? As in discord.py
@leaden rover you can make one on mobile
I will send you the app
No
???
They literally asked for discord.py
joinSecret char* unique hashed string for chat invitations and Ask to
you aren't helping with your app
S M H
No
@leaden rover yes
Yes
yikes
not bot builder
They literally asked for discord.py
you aren't helping with your app
._.
what does the command need to enable/disable
It's not my app
@leaden rover Idk much for py, but I can give you the logical aspect,
Check if database has true/false, if it’s true, run command, else, don’t
idk
jesus
tried to help in anyway I could
please dont do that
dunno py ¯_(ツ)_/¯
advertiser

did everyone did say I'm live

nitro flexing?
py surely has a a memory way to order or map guilds like that
:v
at the minimum, use redis
^
🧃
lol redis
do NOT do database queries on EVERY command

thats simply stupid and inneficient

And you token
no #general-int or shitpost 1337.69
And you Bot username
no
Yes
fight me

You
you said fight me
ok
or even better, DMs
^^^^
Language: Clojure
Library: JDA
Code:
project.clj
...
:dependencies [[cheshire "5.8.0"]
[clj-http "3.7.0"]
[net.dv8tion/JDA "3.4.0_320"]
[org.clojure/clojure "1.9.0"]]
:repositories [["jcenter" "https://jcenter.bintray.com"]]
;:jvm-opts ["--add-modules" "java.xml.bind"] ; if using Java 9 uncomment this
core.clj
(ns dbl-server-stats.core
(:require [cheshire.core :as cheshire]
[clj-http.client :as client])
(:gen-class)
(:import (net.dv8tion.jda.core AccountType JDABuilder JDA)
(net.dv8tion.jda.core.hooks ListenerAdapter)
(net.dv8tion.jda.core.events ReadyEvent Event)
(net.dv8tion.jda.core.events.guild GuildJoinEvent GuildLeaveEvent)))
(defn update-server-stats
"Sends a POST request with the new server count for the bot-id."
[bot-id token stats]
(let [api-url "https://discordbots.org/api/"
body (cheshire/generate-string stats)
headers {"Authorization" token}]
(-> (str api-url "bots/" bot-id "/stats")
(client/post {:body body
:headers headers
:content-type :json
:accept :json}))))
(defn bot-stats
"Create stats map from the JDA api object"
[^Event event]
{:server_count (-> event
.getJDA
.getGuildCache
.size)})
(defn listener-adapter [bot-id token]
(proxy [ListenerAdapter] []
(onReady [event]
(let [stats (bot-stats event)]
(println "onReady:" stats)
(update-server-stats bot-id token stats)))))
(defn -main
[& args]
(let [bot-token "discord-api-bot-token"
bot-id "dbl-bot-id"
token "dbl-api-token"
jda (-> AccountType/BOT
JDABuilder.
(.setToken bot-token)
(.addEventListener (object-array [(listener-adapter bot-id token)]))
.buildBlocking)]))
why paste that here
Codeblocks exist
Bins exist
please bins
but seriously we need a rule implemented about walls of code
I can’t tell what that is
is that his code, docs?
error?
idk
he did post a bot designer link when someone asked for py help
Language: Clojure
Library: JDA
clojure is elixir on crack
He told us the language, lib and code but not the issue
Very helpful indeed
How do I get json files of 5 people separately
const derece = [];
for (var i = 0; i < canli.participants.length; i++) {
if (canli.participants[i].teamId === 100) {
const mavitakimderece = `https://tr1.api.riotgames.com/lol/league/v4/entries/by-summoner/${canli.participants[i].summonerId}?api_key=${apikey}`
let res;
res = fetch(mavitakimderece).then(url => url.json())
derece.push(`${oh[res.tier]} ${res.rank} (${res.leaguePoints} LP)`)
}
}
embed.addField('Derece', derece.length ? derece.join("\n") : "Yok.",true)
5 people "seperately"?
"json files"
no trace of json files
url.json()
yeah that's not a json file lol
that's parsing the response body as an object
Yea it's kinda of object
Hi I have a question
embed.add_field(name = "I choose " + random.choice(choices),value = "")
If I put the field like this
Will it display a blank space in second line
no
why not use title or description or author instead of blank field value
insert a zero width space, both the field name and value have to have a value
not sure it allows that
it does
\u200b for life
\u200b right
discord allows zwsp or any char for that matter as long as there's just something
Oh I see thank you very much
I think discord allows almost every unicode char possible
The scariest one such as \u202B
luckily zalgo text gets normalised
lol
Guys can u edit embed color ?
yes
Please VBA tell me in which living God's name Sqr(b * WorksheetFunction.Power(x, 2)) is 0 where b is 2.07 and x is 2.3
how ?
same way you'd edit any embed
<MessageEmbed>.setColor()```
@earnest phoenix but how to edit
<message>.edit(<MessageEmbed>)
Get the message embed instance and edit
^
you need to rebuild the whole embed
Ok
Not really
let sendEmbed = await message.channel.send(embed);
sendEmbed.embeds[0].color = "#0033ff";
sendEmbed.edit({
embed: sendEmbed.embeds[0]
});```
Something like this can be done also
uhh
this is a map ^ but client.reactions.get(reaction.emoji.name) is not working idk why
How's it not working exactly
it return undefined
it's a reaction handler
Can i see it's structure?
i think it doesn't matter it's a map right? it works like this client.reactions.get('⏹') but i don't know why it doesn't work with variables
Maybe you're using different unicode emojis?
if (reaction.emoji.name === '⏹️') {
console.log('test')
}
i add this to check and it should be the same
Hm, wondering if it's normal to see 500 errors during API performance testing
yes.
Here is what I want to do.
const derece = [];
for (var i = 0; i < canli.participants.length; i++) {
if (canli.participants[i].teamId === 100) {
let mavitakimderece = `https://tr1.api.riotgames.com/lol/league/v4/entries/by-summoner/${canli.participants[i].summonerId}?api_key=${apikey}`
let mavitakimderecesi;
mavitakimderecesi = await fetch(mavitakimderece).then(url => url.json())
derece.push(`${oh[mavitakimderecesi.tier]} ${mavitakimderecesi.rank} (${mavitakimderecesi.leaguePoints} LP)`)
}
}
embed.addField('Derece', derece.length ? derece.join("\n") : "Yok.",true)
${canli.participants[i].summonerId} will return 5 users.
I want to pull users' information from json
besides that there's nothing stopping you from using fetch in a for loop, aside from the fact that you might get rate limited from many fetches in quick succession
its not that
why declare a variable
and then assign it right after?
let mavitakimderecesi = await fetch(mavitakimderece).then(url => url.json())
How do I use node-fetch in a for loop?
@earnest phoenix push promise of the fetches to an array, thenPromise.all(...arr)
yeah that's just
have you tried reading the docs
i am so utterly confused right now
here's my code
const message = await channel.send('test');
const deleteReaction = await message.react('🗑️');
console.log(message);
console.log(deleteReaction);```
and these are the beginnings of the two console.logs
how in the world is the reaction's channel a DMChannel?
uh
now i get
(node:15044) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
channel_id: Value "undefined" is not snowflake.```
actually wtf im on about? i knew about it
12.2.0
i'ma update d.js and see if that's the issue
try uninstalling then reinstalling djs
What is the best website for coding?
what do you mean by that
"what's the best tool for fixing my car"
Should I use discord.js lol
Alr
untill it isnt
Is there a chat channel?
literally look a few channels single channel above this one
Thanks G
read the docs
okay
fairly certain thats spanish
Nope, thats definetly portguese
Hello, can you explain to me how to publish my bot, I don't speak English very well
I know I already published it p...
but another thing, because my name is white
So, the bot is coded in Python @midnight blaze
because my name is white
Fairly certain that's a 5head
Hey guys
I'm hitting the quota on searching for youtube videos
Actually playing videos by URL works fine though
I was wondering if there was an alternate API for searching for youtube videos that does not have a quote?
What do people here do?
i dont fuck with youtube, or music at all at that, but i'd say check spotify's api
Oh
~~if it is then one more reason to not make a music module ~~
This is where not having a credit card really hurts me
If I had a credit card, I could just pay to increase my quota
In fact, Google gives a free $200 to people with credit cards
Somebody has got to have made a knock-off web scraper API, so I'm going to search for that
*help
@slate oyster scraping youtube is your best bet
tools like youtube-dl can do that but there's probably an existing library for your language already
The scraper I found requires in my language running a webserver
But I wonder if it can be modified to work without
Java
Means a syntax error
idk how to fix it tho
Get your syntax right
Whatever you put is unexpected, so check the code around that statement.
i tried didnt work
i tried didnt work
@unreal solar So you're saying your syntax is perfect and the error about syntax persists?
can you show your code
||I'm starting to think speedy was on to something, tbh
https://discordapp.com/channels/264445053596991498/502092022740418560/760620664419123260
||
LUA?
oof my friend did the music i guess he copy pasted xD
i didn't ask
Well, at least the ratelimits are not preventing people from using my bot (:
I'm going to go onto Google Console and look at what that quota was even set at
(I'm on my computer now)
can't you use lavaplayer?
Google is hosting your bot?
@earnest phoenix It's searching songs that is the problem, not playing songs. LavaLink works great for playing songs
@hasty mulch No. I just use it for music, but I am getting ratelimitted
i'm aware
i also mentioned lavaplayer, not LL
lavaplayer has a youtube scraper built in
you can use that
Oh, gotcha
I'll check it out
Thanks!
@faint prism he was already right when he said that. It's well known this server serves more as a place for beginners
@earnest phoenix Also, since I think LP is just a wrapper around LL IIRC, and the API looks similar, it should be easy to port
other way around
LL is wrapping around LP
LL is just a webserver, LP is the brains
@earnest phoenix Wait no I got it mixed up lol
I'm already using LP not LL, oof
Embarrassing
I can't even remember which libraries I am using
So I just gotta figure out the API used for scraping
(EveryOS is stupid)
if you're already using LP you can just let it search for you, no?
Yea
I'll have to look for the API to do that
I'll continue to use the official API as my main approach, and use the web scraper as a fallback
Thanks, did not realize LP had a web scraper
That's not Lua, that's JS. There's some similarities though.
Man discord.js is really neat
I had no idea they had something called MessageCollector
Not an ad(this is not a discord bot)
but what you guys think of this idea https://github.com/SwitchbladeBot/bastille
im working on the project 
how would one go about checking if a user has a Specific role in a discord to be able to use a command in another ?
would that need a check for the user in the guild and has_role?
wait what?
errrr
roles ids are unique iirc
so doing that wont work in the first place
you cant compare two different guilds roles
unless you using name, which is tbh not a very good way of doing things
though if you just want the target role in a guild
and you are not comparing
do you mean a main guild?
like your bots home guild?
yes
so, ID > Name
then get the member object in that guild(if it exists)
then check the role in that guild
and check role
thats it
command in guild 1 => get user id => get guild 2 => get member list => get member by user id => check role => //do stuff @earnest phoenix
Thank you ❤️

means at least one of the bot s we submiteed got approved @lost forge
how long does it take usually for your bot to get approved?
5+ weeks
oooooof
like port forwarding?
@opal plank its 6+ weeks btw
“Before using the webhook provided by this library, make sure you have the specified port open.
webhook_port must be between 1024 and 49151”
I think thats referring to port forwarding.
https://portforward.com/
it depends on your router this site lists a ton of methods for specific routers
So, I can’t get a server count then?
Not my internet plan
f?
I don’t have access to the credentials @opal plank
^ its probably factory password or written on the router
If I can figure out how to proxy, maybe
you dont need the webhook for server count
why
?
do u have node js installed
?
yes
do u have it added to ur %PATH%
wait
C:\Users\USERNAME\AppData\Roaming\npm
hm
did u use the installer
from the node website
cause im pretty sure node adds it self to the path var
yes
hmmmmmmmmmmmmmmmmmm
well
idk on this one
watch him downloading it from some sketchy website
@earnest phoenix join #commands
why?
to help me
i mean really this is a pretty simple situation
either ur node install f'ed up
or
it just didnt get added to the path
C:\Program Files\nodejs\
u should also check there
and now how do you add
well u should add C:\Program Files\nodejs\
to ur system path enviroment variable
HERE?
yeah u have to add that folder to ur system path
find a video on how to do it online because i dont feel like explaining the full thing
PLS LINK?
In this tutorial, I share how to add to the PATH environment variable in Windows 10. For this example, I'm adding Python 3 to the PATH so that I may begin writing code (and executing it) using Python 3 as I had forgotten to add Python to the PATH when I installed it. The metho...
i found this in 2 seconds
enjoy
TY
also please turn off caps lock
await message.guild.channels.create("info", {
type: "text",
topic: "Information",
})
``` how can i add permissions to this so that way the everyone role can't see it?
the folder I have to put it as you say because he does it for python while I want it for python?
just change what he puts to the node js path
that i sent
i mean if u want python put python if u have it downloaded
how do you make a csv editor that looks something like
yes but I write it in js it will not work fail?
python <> nodejs
can anyone answer my question above?
check your docs
i can't find anything useful for discord.js.org
https://github.com/LemonUnit/csv-editor-online interesting
(node:23296) UnhandledPromiseRejectionWarning: TypeError: permissionOverwrites.map is not a function
at GuildChannelManager.create (C:\Users\email\Desktop\coding\KrossBot\node_modules\discord.js\src\managers\GuildChannelManager.js:109:51)
at C:\Users\email\Desktop\coding\KrossBot\index.js:271:46
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:23296) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:23296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
``` ```js
await message.guild.channels.create("kross-logs", {
type: "text",
topic: "KrossBot Logs and Information",
permissionOverwrites: {
READ_MESSAGES: false
}
})
@fluid basin any ideas?
how so?
array: []
i know what an array is
using []
so use it ?
i'm a bit confused on what i put there
you know what a variable is?
yes
(jk)
god
Do you know what an array is?
yes i know, how do i define the permissions inside of it
permissionOverwrites: [{
READ_MESSAGES: false
}]
might be wrong but
aah
https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=create explains what is necessary.
that makes more sense
[{"json":"here"}]
(waiting for the mofo to start talking about associative arrays and the guys head explodes)
[{"json":"here"}, "etc", null, 123]
@shy turret please never refer to an object as "JSON" 😛
nu kk
you ok two?
JSON is a string, Objects are Objects. There is no such thing as a "JSON Object"
man that was 3 mesages deleted as once
node:19552) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
permissionOverwrites: [{
"READ_MESSAGES": false
}]
ok what are you overwriting?
umm hate to say it
hcannel perms
what role or user?
Json objects do exist
await message.guild.channels.create("kross-logs", {
type: "text",
topic: "KrossBot Logs and Information",
permissionOverwrites: [{
"READ_MESSAGES": false
}]
})
everyone
Ok so you need to tell it you're overwriting the everyone role
lemme guess
its ID is the same as the guild's id
permissionOverwrites: [guild.roles.everyone, { etc..
@earnest phoenix no, W3Schools is source of that shit and they're wrong. JSON objects are not a thing in javascript.
@karmic compass how about you don't guess and you look at https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=create instead
i never said json objects are a thing in java script
i just said that json in general has json objects
No, JSON is a string which contains javascript data structures.
guild.channels.create('new-voice', {
type: 'voice',
permissionOverwrites: [
{
id: message.author.id,
deny: ['VIEW_CHANNEL'],
},
],
})
u know what im not going to start this lmao
It confuses the noobs to talk about JSON Objects because those 2 words are different concepts in javascript.
lvl 100 when enters a lvl 1 arrea
objects are different in most langs?
We are specifically talking about JavaScript.
yeah ig
lvl 100 when enters a lvl 1 arreaa
p0wn3d
the everyone role has the same id as the guild
ah
(node:24524) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
permission_overwrites[0]: List item values of ModelType are required
at RequestHandler.execute (C:\Users\email\Desktop\coding\KrossBot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:24524) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:24524) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
``` ```js
await message.guild.channels.create("kross-logs", {
type: "text",
topic: "KrossBot Logs and Information",
permissionOverwrites: [, {
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
}]
})
wait a sec
why is that extra , in there
[,
you just need to pay more attention to details ¯_(ツ)_/¯
also your ide will generally highlight close to the cause of the error
{"thingy": [],}
is valid?
json requires that a hanging comma be removed
I didn't
oh hey, looks like tims right 🤔
The error is because each array element needs to be an object which specific values, and [, {}] creates a null value
u are right u didnt call it json it was the other guy
why did that guy bring up json here lmao
¯_(ツ)_/¯
Q_Q help
plzz
How could you turn multiple embeds into one?
https://streamable.com/p33b38
need to see code
instead of building an embed in each loop in the for loop, do one embed and add the respective data in that loop.
u can edit embeds after they have been sent to the channel
so u can also do it that way
@solemn latch Tried adding the 'embed' before the for and the message.channel.send(embed) also when terminating after the for
editing would add more api calls for no real reason though.
just define const embed outside the loop
then set its fields inside of it
though, watch for the limits of embed fields.
And overall embed limits
OH
dont need to set the title color thumb thumbnail and author in each loop i dont think.
would be more efficent to do those outside the loop.
only do the things you need to loop over in the loop
Ok now it does it right, the problem is that now it doesn't print every .setThumbnail and I only get 1.. what could I do?
only one thumbnail per embed afaik
make an embed with reactions that edit the embed 🤔
if i am searching for somehthing using a regex
and i get four results
one is an array and the others are null
how do i get just the array
using .filter just says cannot read property of null
if (object === null)
So it return an array?
Did it return
"[]"
or
[]
You lnow what
@charred geyser show me your code
k one sec
fromDir(dir, /\.txt$/, function (filename) {
fs.readFile(filename, function (err, data) {
if (err) throw err;
let regex = new RegExp(
"example"
);
let str = data.toString();
var res = str.match(regex);
console.log(res);
});
});
this is the bit where it is searching each file in the directory
for a folder with the .txt extention
for an "example" regex
and the result is:
null
null
[
whatever string it finds
]
null
Show me what res is
How can you make a Simon says bot
bruh
How can you
this is not the place to ask
...
this is for help with specific development issues or challenges
not just telling people how to make bots
Seasnail
I dont understand what youre trying to say
You mean if the file doesnt return anything, it will return []?
okay so for each file it is searching for a string that fits the regex and if it doesn't find anything it will return null for each file and if it fiinds something in one file it will return with an array for just that file but still null for the other files
so if i have
example1.txt
example2.txt
example3txt
example4.txt
it searches the four files
and it will console log what it finds
so
example1 2 and 3 will be null
So
and 4 will be [the string that it found]
yeah
if res = null then what though?
Remove {}
this will just log the array
as its one line
Np
you have been very helpful i appreciate it
another way you could do it is
if(res) console.log(res);
if your only goal is to log it
I want to make my embed show my bots total servers and total members in all servers...
The servers line works.. but users doesnt..
Whats an easy way of doing this or do i have to loop the guilds for member counts?
embed.add_field(name="Server Count", value=f"{len(self.bot.guilds)}", inline=True)
embed.add_field(name="Users Watched", value=f"{len(self.bot.guilds.member)}", inline=True)
@earnest phoenix bot.guilds.member?
yeah that didnt work
@earnest phoenix the embed just didnt send.. i got it to work by makeing a for loop but wanted a simpler way
not used to python but pretty sure members without the s means the member object for the bot
having good grammar always helps
I want to make my embed show my bots total servers and total members in all servers...
The servers line works.. but users doesnt..Whats an easy way of doing this or do i have to loop the guilds for member counts?
embed.add_field(name="Server Count", value=f"{len(self.bot.guilds)}", inline=True) embed.add_field(name="Users Watched", value=f"{len(self.bot.guilds.member)}", inline=True)
@earnest phoenix i used a loop yes for the total member count
@earnest phoenix .guilds returns the bots List of guilds and members will return a List of members for a guild but the problem with running .guilds.members is thats its trying to sort a List of a List and it freaked out on me
you didn't put the s
i had tried it before
sorry didnt say that
ok
its fine
i just ran a loo
loop and all is good
no links ?
he deleted
the message sender deleted
@earnest phoenix sum([guild.member_count for member_count in self.bot.guilds])
so thats looping the count in .guilds and saving to variable guild.member_count?
@slender thistle
It creates a list with member_count of all guilds the bot is, and gets sum of it
@slender thistle guild isn't set.. sorry i am still learning and trying to wrap my head around how this is working.
it needs to loop the bot.guilds to get the guild.id
people will respond when they can
i wouldnt ping people unless they ping you first
ok
@earnest phoenix for guild







