#development
1 messages Β· Page 1982 of 1
you cant fetch message by content
what's that now , I thought you guiness know how to do that, where does your intelligence go now
noone said to fetch the message using the api
you must do it manually
thats why ben said it is not recommended
since you are checking through the whole message
you must fetch all of the text channel history messages and check if it contains the phrase
god i hope we dont meet again
the basics*
they have a snapchat pfp
daff ain't stupid
they just have an anime pfp
@dry imp privacy policy and tos should be in page footer
now you know basics of English || people who don't know didn't find that out ||
nice save
yea im lazy just put it there cuz noone gonna read it anyway
not in a mood to fix the website and the bot
@pulsar bone thought seriously bro you need to take a programming/python basics course, not to insult you but to set you up for future code
if you dont understand the basics you wont understand people trying to help you all that much
if you're motivated enough it wont take very long to complete and get a good grasp
he wont, instead he called others helpless person
DiscordAPIError: Interaction has already been acknowledged.
```whats this?
answer is in the error
JSON.parse(JSON.stringify(obj));
``` what does this do exactly?
yeah mb i forgot i was running two instances of my bot
It converts an object to it's JSON string representation, and then parses it back to an object, this is useful when you want to copy an object, to basically disconnect it from it's references
is there any other way to disconnect an object from its references
{ ...obj }
i have an object and the only way to call the keys is to stringify it then parse it again, otherwise its broken
It can also be done using the spread operator
the first thing they need to do is get an actual username
cron.schedule('* * * * *', async () => {
console.log("test")
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel('Primary')
.setStyle('PRIMARY')
)
console.log("other test")
});
it doesn't execute the script I put after the const row... can any1 help?
.addComponents takes an array
this is from djs guide
still takes an array
it should work without an array too tho, from the source code
where is your code hosted?
my pc, I am testing it
whats your node.js version?
thats not latest but its good enough, shouldnt be an issue
ye
does it log other test log?
I am adding a new one rn
where do you send the message?
wdym
ok it doesn't send
it's like the code after const row doesn't exist
do you send that row somewhere?
const msg = await client.channels.cache.get("941750305022947331").send({ content: "test", components: [row]})
``` here
ookay ππ»
so "other test" is never logged? do you have any code in between the row and "other test"?
cron.schedule('* * * * *', async () => {
console.log("test")
const row = new Discord.MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('primary')
.setLabel('Primary')
.setStyle('PRIMARY')
])
console.log("test2")
const msg = await client.channels.cache.get("941750305022947331").send({ content: "test", components: [row]})
});```
this is the code
and this is the log
also, did you import MessageButton? it seems youre using Discord. for one but not for the other
my god I am so stupid
that should definitely how thrown an error tho
do you have any global unhandled error handler?
I did the same error on actionrow (not used Discord.) and didn't gave error too
I am using a command handler package made by a friend, I think that's the cause
btw it sends the button now, thank you so so much
check if there is any process.on("unhandledException") or similar in the code
do you know if there is a way to search up on the code without checking every file?
on visual studio code ctrl f just searchs up into the file u are editing
on the left side, click the search icon
theres a search button in the "taskbar"
what she explained is *** logic *** behind how to fetch , not the basic of how to python (how to use in)
well idk what's up with you guys there's a difference btw knowing logic in python and knowing use of keywords
search for process.on
there isn't too
oh gosh hes back
weird
ctrl + click on the function or smth
is the handler in a separate package in node_modules?
wdym?
the handler is defined into index.js
the entire code is there? or is it a require()?
and where does Handler come from?
a node_modules package
i dont think the search button searches inside packages
try to ctrl+ click Handler
im pretty sure it redirects to the class
is this package public? can it be found on npm or github?
sure
sent
Just say ratio and end it
Or actually I'll send them my favourite gif
https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel.history
https://docs.python.org/3/library/asyncio-task.html
https://docs.python.org/3/reference/import.html
https://www.w3schools.com/python/python_for_loops.asp
https://www.w3schools.com/python/ref_keyword_in.asp
https://www.w3schools.com/python/python_conditions.asp
https://www.w3schools.com/python/python_variables.asp
Here is your links... Now pretend you never exist.
Now if for some reason, you still don't know what to do,
https://www.w3schools.com/python/python_intro.asp
https://www.python.org/about/gettingstarted/
https://www.programiz.com/python-programming
https://www.englishgrammar101.com/
https://www.talkenglish.com/grammar/grammar.aspx
https://www.myenglishpages.com/english/grammar.php
or, you know, https://www.google.com/search?q=learn+python
lol stop bullying him
i dont get it tho, the dude asks about how to fetch messages by content, and people start going on and on about the in operator and "learn python" lol
without touching the fetch subject
Eww you fucking capitalist
Do you also accept some flowers?
accomplishing the goal does involve the use of in
I think someone mentioned looking up messages but more people went on to talk about in
if I can sell it for $500
isnt that illegal
You saw nothing!
for 500
my soul for a few packs of those
dayum
yo how do you get so much money, i get negative numbers
Well without money you donβt have to deal with the question what to spend your money and you donβt need to pay taxes 

lmao
Ok enough of that
i have a certain dilemma i need to deal with now with my api
i have a file containing a list of entries, indexed by number like an array
however
updates to this file involve creating new entries
and the way they are sorted means all the ids get screwed up
Is there actually anything easy you ever deal with?
i dont know what entries there will be in the future, so i cant reserve space for them
i need to change the entire thing to not be sorted
but at the same time preserve the existing order because people are already using it
which will make it ugly
sorted until X, then everything else is appended to the end
lul
senpai are you using a file as a database
nah man who'd do that
And now Tim being bullied, oh noo
would rather write a source file and fill up some array with the actual values
db.js and write to that and fill up let entries = [...]
would be a fun weekend project
Does empty lines still count on file size?
deserves it
\n?
how would the system know that there is a newline if it isnt stored
but yes very negligible
Just use lines as index
doesn't look that bad
people used it by the line number, for example S4 would get the data for the star Arietis A
this is the updated file
how is s4 a number
Ahh ohh
what happened to your nitro months ago?
Canβt you just pick the name as index as itβs unique?
my options are, either i tell everyone the ids have changed, or i give up on sorting it, and put all the new ones at the end
:expired:
xd
the names can be complicated to remember, as they dont really follow any pattern
its so expensive for so little benefits
except that you can make discord your cloud database
and all other non-star objects already have the same numeric ids
but still
the same goes for mee6 premium
anyway i need to rework the entire star system
lmao
wait you could actually make discord your file database if you could upload multiple 100 mb files
because previously organizing it by lines was my only option, because thats what the C library uses as an input
but now i modified the C library into accepting manual string inputs instead of reading lines from files
so it doesnt matter anymore how i organzie the data
Why do you actually need the file to be sorted tho?
i dont technically need it, but i wanted a way to make it look nicer with some sort of predictability
to have for example star 453 and star 454 be related somehow
and not be completely random
And why is it important to not change the entry (line) order?
because people are already using the existing numbers
there are pinned messages in discord servers telling people which numbers are specific stars
its not a database, its a list of stars
its read only
until i manually update it with new stars
Ahh okay and instead of using line numbers, how about an unique key, a short not too long one?
ahh ok, so more like a static db file type deal π
ye
i guess i could try, but that would also change everything
i think im going for the second option, keep all existing ids as they are, and add the new ones to the end
Yeah but it would be future proof as long as the key has enough variations to deal with your list for the next years
yo how did you get where the console came from?
some people actually tried that
you can create custom instances of console
the one shown in my snippet above creates a console like object but saves the logs to a file! π
someone somewhere right now i bet someone is coding to do that
Well nowadays a chaotic storage system actually is the standard, so yeah why not
im just confused whered you get the file name, but i guess you could just define it in a function that calls the global logger
or isnt there no global logger?
As long as you remember where you did put your stuff, things are ok
nah, I could make one, but the way I use it, I manually require the module in each file I want to log things, and I pass the __filename, which is shown in the logs as [filename].
I use the module something like this:
// EXAMPLE USAGE:
// opts are OPTIONAL!
const log = require('logger')(__filename, {
file_options: {
filename: 'somefile.log',
options: {flags: 'a', encoding: 'utf8},
},
file_record: {
fatal: true,
error: true,
warn: false,
http: false,
info: false,
},
log_colors: {
fatal: 'red',
error: 'red',
warn: 'yellow',
http: 'green',
info: 'cyan',
},
});
log.info('my awesome log');
// => 21:22:36 PM [filename] my awesome log
// to extend class functionality:
class KustoomLoog extends log.Logger {}
stupid formatting.
lol, i was testing that errorrs would be thrown properly π
Remember not to add lookups
That isnt that hard right? You just upload a file to discord if its smaller than 8mb, then if not just piece it then name it filename_01/69.
im only logging errors incase they happen π
Yoo anyone know discord formatting supports Brainfuck?? The more you know!
yea, it can be fun to convert code into http://www.jsfuck.com/ π
I wrote a snippet to stop the context menu on webpages, so people couldnt view source, and converted it to jsfk. π
My 10 chars code turned into 12,000 chars of code...
maybe run it through a minification tool next? π
this site won't even show you the js used to render the page even if you use view source from the address bar
https://samy.pl
hhmmmm
that is a fairly impressive site
I can see why the person would want to hide its implimentation π
im determined to find the source code for that site.
i gotta go out atm, but im bookmarking it for later π
Hmm how can i run client.on("event") then
its already working
if you want it to show with your exact code, you need to add delays
because right now everything is sync
when working with sync code, you need to follow everything line by line
so what is happening there?
client = new Manager() -> constructor -> super -> eventemitter contructor -> back to constructor -> this.ready = false -> _init() -> this.ready = true -> emit event true -> console log seems ok -> back to constructor -> emit ready -> back to script -> console.log client -> create event listener -> end of code
those are not promises, adding await wont do anything
hence the ... on the word 'await' π
yes because you call it after you create the event listener
this is because it is called after the event listener is defined
My brain just blowed
events are used to process asynchronous code, but events by themselves are not asynchronous
you dont have any asynchronous code inside it
so everything is done before the manager is created
So how can i block everything is done after manager crated
you need to add a delay
for example setTImeout
if you want to force the init function to only run after the manager is created, you can add something like setImmediate
constructor() {
this.ready = false;
setImmediate(() => this._init())
}
basically, create the instance, then register your event listeners, then any time your object emits the event, it can be listened to. Its like, you plug in the radio, then tune it in, then you can listen ~ no? π
setImmediate is the only javascript function that is supported in IE but not in any other browser
lul
setTimeout(0) kek
No. Listen then tune in
That worked
yes
because instead of this
client = new Manager() -> constructor -> super -> eventemitter contructor -> back to constructor -> this.ready = false -> _init() -> this.ready = true -> emit event true -> console log seems ok -> back to constructor -> emit ready -> back to script -> console.log client -> create event listener -> end of code
you are now doing this
client = new Manager() -> constructor -> super -> eventemitter contructor -> back to constructor -> this.ready = false -> setImmediate -> back to script -> console.log client -> create event listener -> end of code -> check for pending operations -> imediate operation found -> _init() -> this.ready = true -> emit event true -> console log seems ok
let object = { user: "TuranGe" }
...
{ object.user } // undefined
let object = { user: "TuranGe" }
let user = object.user
...
{ user } // TuranGe
I'm using Svelte
how can you even display asd without it showing object Object
Turn json into string, then turn it back into json
Had this problem a while ago
Its frustrating when you know its there but code says no
what? I don't think I fully understand
so what could be wrong with my code
is that the full code?
_function() is meaning private function?
yep
people use it for that, but it doesnt have any actual meaning
its just a name
ive never used svelte, but it looks kinda like ejs templating
yes but much better
it's just an indicator that says don't run this code if you're not the guy who wrote it
lel
π ive never used ts either... please dont @ me π¨
@neat ingot
π
Do you get object from api?
Svelte doesn't know the object properties at compile time
When you turn json into string then turn it back to json, you are removing weird things about that json and receiving a normal json that i think you need
Jsons have personality you know
Yes
By cloning the json, you are creating a new json, but the old json will teach the new json when he learned from his mistakes
There's Good JaSON then there's Bad JaSON
Trust me, it'll work
my older brother is named jason and I can't get over it
give him a ball of string and see if he can parse it.
so why does it give the output at the top but not when I use it?
if it was, wouldn't it return undefined in both places?
Because bad json
But in technical terms, it has something to do with linking and virtual objects that is relative to another object
π€ What you said doesn't make much sense
Bro I just remembered this... this is so cringe. Im so dumb
if excitement means having to refactor every single line of your code then yeah
replaceAll doesn't modify the original string, it returns a new one
i got it thanks
are you still doing all your commands as messages, a year after interactions became a thing???
mod bots
What will it even change
Idk what even that is gonna do
lets you see message content
I see
I already have access to the message intent so yeah
you don't need the intent for processing commands though
forms are out? completely?
sort of

they suck, but they're out there
so yeah on v10 just send 1<<15 alongside other intents when you identify
Modals you mean
why do they suck?
i'd really want to use for one feature: suggestions
You can have like only 5 fields
and maybe embed building
because all it's useful for is multiline editing
they don't add anything else, like selection from a set
where on a screen are you going to fit more than 5 lol
desktop
yus, tbh i would be fine w/o them as well. buttons = cool
Besides you could make a modal scrollable
...which is still a very cool feature
is everyone's screen as big as your screen?
^
it has to work on the smallest
and from what I can tell discord don't believe in scroll bars
or handle relations, like if input x and y are mutually exclusive
Bruh
they still haven't added one to the server list in 2022
but that's not limited to modals
feature requests only been there since 2019
They should add one to modals so we can have more modal fields
just interactions in general
I can still scroll the server list tho
It is, but we deserve more than just that.
So we can use them like actual forms
lol
You mean a literal scroll bar?
with a scroll wheel sure try it when you don't have a 3 button mouse
skill issue
Skill issue
skull issue
err.stack.matchAll(/:(?<line>\d+):(?<col>\d+)/gm).next(1);
Argument of type '[1]' is not assignable to parameter of type '[] | [undefined]'.
Why is typescript complaining here π€ π€π€π€π€
the match is returning nothing
π
Except this is a typescript error
has it determined the regex will always be false?
typescript can't do that
the code's fine, next's signature is messed up
oh wait that's not how next works
Annoying js making me turn it into an array
is it possible
x.obj is a property that doesn't exist
Yes i know
try array.flat(1)
I want replace obj to x
For example if x.rand exist obj = x.ran
What do you want to know if it's possible?
Well you could replace the object key with the property if it exists
Object.keys(x).forEach(key => replace the key in text with the value);
or for...in
A for loop inside a for loop
noice
For(x of array) {
Object.keys(x).forEach?
}
forEach is also a for loop lol
Object.keys(x).forEach iterates through the object keys twice, in fact
no it's just basic logic
just look at it
get all the keys then do something with all the keys
Object.keys, then forEach
i see the problem now
but that distracts from the problem
Actually i am lazy too replace all text for translate so i want to do that
if(botName) data.text = data.text.replace("{botName}", botName)
for (const [property, value] in x) text.replace(property, value):
you can't iterate objects like that
I forgor it's in
How about something like this:
let text = "{rand} is a number, {me} is me"
for (const item of array) { // `item` is an object
for (const [key, value] of Object.entries(item)) {
text = text.replace(`{${key}}`, value);
}
}
note the use of text = text
since replace returns a new string
for (const key in item) {
const value = item[key];
}
Iterates only once
Can I respond a button interaction with nothing. I just want to ignore it.
how about just letting the interaction timeout
you can ignore it but it would show a timeout error on the user's device
can a webhook have a button? (like a url button)
yeah that what i dont want
iirc no
because the webhook can't respond to interactions
not sure about url buttons
well responding with nothing is questionable
you could respond like you normally would but with nothing changed
@wheat mesa does detritus allow responding to interactions on messages that were made like a day ago?
after a few minutes my poll bot stops responding to buttons
you cant respond to an interaction with a button, thats sure
maybe detritus kills the run function
It worked thank you very much
should i listen for the interaction on rest api instead?
You just saved my life lol
no
I think interactions only last for an hour for reply
i just realized i have a never ending event listener for EVERY poll
that's a party
I'd rather have a single event listener since the number of polls is arbitrary
An even better solution:
let obj = Object.assign(...array);
let text = `${obj.rand} is a number, ${obj.me} is me`;
discord is adding official support for multilanguage bots
now we can have portuguese support for astrobot
they already added region indicator to slash commands, both guild region and user region, and they will soon add localized names and descriptions for slash commands
I would love that so much
ngl
when should you use the guild or user region though
How I do it is; If the guild language is not en and the user's lang is en, then use the guild's lang, else use the user's
How do i host my bot and keep it online 24/7 with no downtime for free
You can't
depends on what you mean by free
If you mean that you're not paying for it, depends on what you're paying for. An old laptop that you'll leave in your basement running? Well, you need that thing to charge, so there's some electricity + keeping it on.
Or maybe you want an online host, such as Heroku, which does fit that "free"ness you want, but has its own problems.
lets not
that won't work
although this is defenitly not recommended
also using uptimerobot with replit breaks their TOS doesn't it?
Don't think it breaks thier tos
iirc they stated it did
[citation needed]
Ye
Let me see if I can find it, I might of been thinking of another service tho
Basically any host that is "free" is gonna suck
glitch ?
Ah yea you're right, I must of been thinking of something else
ye I think it was glitch
So you either pay or use a machine at home
yeah
Either way you're gonna pay
glitch doesn't run 24/7
they also try to kill the project if it's running for too long
even if you use pingers
Just buy a 3/month vps if the bot is small it will be sufficient
no way around it if you want to have a good hosting solution that doesn't suck and is actually 24/7
Its like asking to have food delivered to you 24/7 for free
its just not realistic
I mean link wanna deliver me food 24/7 for hugs?
Oh so klay wanna be friends?
π
just get a server yo, they are cheap af.
Or go work in the nearest mine and earn some cash 
this isn't 1919 why would I work in a mine
you can get a lot of money quick is easy
Just rob a bank and hope you don't get caught after
Alright rob the treasury
Err 2023 lol
You actually make more cash when robbing a drug dealer than a bank nowadays
Rob an NFT traderβs eth wallet
Jokes aside, things arenβt for free
You gotta pay for your server, Sir, now!
Besides a vps isn't expensive
There are ones out there for 4.99$
As much as nitro classic lol
but a bank puts you in jail, a drug dealer just kills you
Is there a de facto guide for creating a bot application on the developer portal?
hey, does anyone know how i can get all the real names from this site? https://worldofwarcraft.com/en-gb/game/status/eu
I tried the networking tab in the hope to find a json or api response, but unfortunately there was none
is it possible to create an interaction button that opens another text channel in the guild when a member clicks it?
By "open", do you mean switch the user's channel on their client?
Or something else, like unhiding a channel from the user.
Id imagine they mean the first option and I believe thatβs a no but i could be mistaken
i mean this, switching from #development channel to #general channel via a button click
yeah no
shucky dang darn
what if you use the in app links?
@quartz kindle does Discord have any API docs on how localized slash command descriptions will be done
Wut⦠World of Warcraft still exists⦠wow
WoW
anyone ?
get rid of those weird column things and use flexbox
i literally just added these 2 lines, and removed all of the column crap and the problem is gone
thanks
anyone mind doing me a favour please?
i'm after someone to write me an example program in discord.js that just registers a parameterless slash command called 'ping' and replies to it with 'pong!'. it'll be compared side by side against this, for updating my tutorial:
https://raw.githubusercontent.com/brainboxdotcc/windows-bot-template/main/MyBot/MyBot.cpp
my existing examples give an example of a message based comand, i'd like to move away from all that
What is this err
err:
/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/commands/moderation/timeout.js:30
if (member.permissions.has("ADMINISTRATOR"))
^
TypeError: Cannot read properties of undefined (reading 'permissions')
at Object.execute (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/commands/moderation/timeout.js:30:16)
at Object.execute (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/events/Message/messageCreate.js:54:17)
at Client.<anonymous> (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/Handlers/eventsHandlers.js:13:58)
at Client.emit (node:events:402:35)
at MessageCreateAction.handle (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/actions/MessageCreate.js:26:14)
at Object.module.exports [as MESSAGE_CREATE] (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
at WebSocketShard.onPacket (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/ws/lib/event-target.js:199:18)
member is undefined
const member =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]) ||
message.guild.members.cache.find(
(x) =>
x.user.username.toLowerCase() === args.slice(0).join(" ") ||
x.user.username === args[0]
);
whatever the output of this is, is not a member
console log it
member isn't cached then
i'm making timeout cmd if a mod run this cmd on admin i'm gonna return
Doesnβt change the fact you need to fetch the member as itβs not cached
Which probably requires the member intent
Could u tell me and example i don't understand
Well spoken trivial your bot doesnβt know that member, thatβs why it has to ask Discord about him
aight
Keep in mind you probably need the privileged member intent to fetch members if Iβm not wrong
you dont need the intent if you're fetching a member by id
Just if you wanna fetch all members?
Roger that
this is how i do it right ('Haven't coded in js in a while')
const member =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]) ||
message.guild.members.cache.find(
(x) =>
x.user.username.toLowerCase() === args.slice(0).join(" ") ||
x.user.username === args[0]);
guild.members.fetch(member);
if (member.permissions.has('ADMINISTRATOR'))
return message.reply("You cannot put admin on timeout").then((sent) => {
setTimeout(() => {
sent.delete();
}, 2000);
});
for a second i thought all of that was just to define membercause of the weird tab spacing at the first line lmao
try what
and if i do !timeout @[user] it does say u cannot put admin on timeout if i don't i give me the err
some are available for 1$ as well... My poor a* can't buy that as well cuz my mom doesn't let me use my OWN money.* (I am 17)
lmao why?
"You'll waste it"
Well technically you can, add a url button with the link https://discord.com/channels/<guild_id>/<channel_id>
But ofc, it only works if the user clicking the button has access to that channel
good idea
thanks!

well you could always run the script on your old neighbor's computer, turn off the monitor and disconnect the fans so it seems to be turned off. or tell em that you're working with the fbis and the world is gonna end if they shut it off.
either way, a laptop running in the basement costs only about $1-2 for about a month, if your laptop can handle the load
^
^
if !args.length return
what's wrong with it?
wait which is better? args.length or !args[0]
TypeError: Cannot read properties of undefined (reading 'permissions')
i added
guild.members.fetch(member).then(console.log(member));
args[0]
maybe get the guild first if you havent gotten it already?
const guild = message.guild;
can you log member?
fetch takes an id, not a member object
the command works if i !timeout @[someone] but it does not work when i do !timeout
can you send what youve got?
did you put the !args[0] return yet?
maybe do something with the response?
huh
youre not doing anything with guild.members.fetch(member)
its just sitting there
and put !args[0] return up higher
and please use async/await if you can
none still not working
whats not working
do you earn the money tho?
yeah
doesnt make any sense, still dont know why that is your mom's problem
Hi, why am I getting this error? https://sourceb.in/BAzqxe2NvC I am trying to connect to the top.gg api using the top.gg package.
top.gg is not the official module and you can use topgg-autoposter for posting your stats
The error itself means that youβre not giving it a parameter it requires
are you coding a website that has login or bot that logins to a website?
Would anyone know why this would be flip-flopping the result? It's a emoji check, probably trash code but just starting and trying out things.
const emoteRegex = /<:.+:(\d+)>/gm
findEmoji = (e) => {
console.log(e)
if(emoji = emoteRegex.exec(e)) {
console.log("yes")
return emoji
} else if(emoji = animatedEmoteRegex.exec(e)) {
return emoji
} else {
console.log("no")
if(/\p{Extended_Pictographic}/u.test(e)) return e
if(!/\p{Extended_Pictographic}/u.test(e)) return false
}
}
https://scs.twilightgamez.net/swnLj.png
e =  as seen in the console
you can generate an oauth url in discord.com/developers/applications/id/oauth2/url-generator
does it return the emoji or a bool?
so ig it's meant to output something like this
[
'',
'944092741476974632',
index: 0,
input: '',
groups: undefined
]
I'm mainly just trying to grab the id itself
nope
what do you want to access from the user
yeah I think you need identify
most user information is from identify
guild info is from guilds
i recommend just getting identify and guilds
you probably didnt set one
add a uri
theres another tab for the uri
not 100% sure if this is what I'm needing, tho I don't have much experience working with emojis. But the user would input something like reactrole <id of msg>
<role> (
being the custom ) and I'd extract the ID of the emoji used. Atleast from research, a decent approach is with exec with the regex shown in the example !xmiyukACheer
id and the name of the emoji?
nah simply the id
or the id only?
whatd you set it to
do you need to get multiple emojis?
single
did you use http(s):// ?
the reason for the function is if the emoji they provide is a global emote like π
so it can check both
custom and global
if(/\p{Extended_Pictographic}/u.test(e)) return e
if(!/\p{Extended_Pictographic}/u.test(e)) return false
for globals
https://scs.twilightgamez.net/5N8rj.png
ok
@craggy pine/<.*:(.*)>/gi.exec("wdfeawd<wdafesgr:asvawdaw>awdawdadwdeg")[1] gosh why is regex so hard.... btw if [1] is undefined just search for global
oh wait, i forgot the colon at the start
/<:.*:(.*)>/gi.exec(str)[1]
interesting
Oh you're doing what I used to lmao.
Oh ya?
Are you not using slash commands?
Nah
I mean my main bot is a react role bot.
Xd
Best bet for checking for custom Discord emojis is doing /\d{17,19}/.match(myAssumedEmoji)
If it doesn't match the 17-19 decimal range check it against a unicode list.
There is a nice package out there that handles that and the regex for you.
Did you make your own
stinky copy pasta π
yikes
here
im like 100% new to this. But hey I'll take a package to simplify my life anyday
bro i cant understand why regex is so hard
it's not
it melts my brain
the simplest thing I took like 15 minutes
It's only complicated when you start going schitzo mode trying to solve everything with it.
also another stink that discord does.
Doesn't allow @&20982390480 in an embed field for a role ping
/<:(.*):(.*)?>/gm check if [2] present(id), if not check if [1] is present(global), if not no emoji
It does.
<@&ID>
iirc global is <:1234:> right?
My bot for comparison.
da fuk
imagine using emojis instead of buttons
v11 cringee
I still use emojis in v13 sometimes
dylan this does look right no?
they look better imo
It looks right.
buttons look better if total buttons is like 3 or less of them
public static reactRolesFormattedString = (reactRoles: ReactRole[]) => {
return reactRoles
.map((r) => `${r.emojiTag ?? r.emojiId} - <@&${r.roleId}>`)
.join('\n');
};```
<@&ID> so yeah
Is it in the title possibly on accident?
Remove the bold. it's not gonna do anything but.
Also if you copy and paste that does it ping a role for you?
yap
reaction roles in 2022 xd
Just to confirm the ID is right.
why not buttons?
it's only bold because it's in the first part of the field. thing, blank text, false
Oh.

Make it your embed description.
ah
Roles dont get pinged in field name
^
How you doin dylan π
To reiterate my point I dislike buttons because big + ugly + on mobile with 25 buttons? bye.
me who just pushed a reaction role update in my bot: π
I'm fine, yourself?
Yee
Select menu ftw 
But again that could be messed up at times
yes
diff categories of roles in one message >:D
That'd be an interesting setup.
yeah, categorize the roles and give the option to have 5 categories per message
Oh open sourced
My bots main purpose is to categorize roles.
open source gang 
mucho better https://scs.twilightgamez.net/A2FdF.png
imagine using camel case on role names
imagine not

all we need is a role for testing, who cares what the name or how the name is written
Looks a bit close to what i have, but in eris
I was proud of it
well i dont have those button or select menu handler tho, since i dont have any use for em
clean enough code
yeah pretty clean, although u followed a bit of py formatting π
But we dont do that here in the js/ts gang
how do you handle animated emojis using this btw if you don't mind sharing
I've never done python development seeing I've only done C++/TS
But that matches any string with 17 to 19 digit characters, doesnt it?
You need to store an emoji mention for it or something.
It'll match it yeah
But that's why my code had r.emojiTag because I save in the db <(a)?:nn:id>
Because it's possibly animated.
/\<(a)?\:.+?\:(\d{17,19})\>/g
```Is what i use
https://github.com/Uhuh/RoleBot/blob/master/commands/react/create.ts#L106 Here's how I parse the emoji out.
And ensure it's a custom discord one or unicode.
I should've replaced the 10,20
it's old code pelase don';t hurt me
Lol
But this is where i got stuck. I was using \w too until i realized some emojis had underscores and other characters in name, so i moved to the lazy . operator instead
if (customEmoji) {
/**
* 0 - Matched regex
* 1 - 'a' if it is animated. Otherwise it's empty.
* 2 - ID
*/
isEmojiAnimated = customEmoji[1] === 'a';
emojiId = customEmoji[2];
} else {
const unicodeEmoji = emoji.match(this.emojiRegex);
I see how you do the global vs custom
yeah
a lot better than my shitty function bs I was trying to do ngl
_ is included in \w
is it? π
yeah
Thought only whitespace would be
afaik i thought it only includes a-zA-Z0-9
I always refer to regexr(site) when doing this stuff
Time to find out
and _
poggers.
can you make an emoji with that
there we go
Oh okay then, time to move to \w back

makes sense I guess
wait what does \w- do again
Oh wait im dumb
I thought \w- itself is a type of.. uk
π
zoned out for a sec there 
exactly
Shit
U could use select menu to display all the not in category too and let users select multiple roles (options) to add at once π
How does Discords thing handle multiple selections and how does it know when to submit them?
Just sends the array of all the selected items
[
':coiny:944092741476974632',
'',
'944092741476974632',
index: 1,
input: '',
groups: undefined
]
Ya that's a lot better. Ty for sharing.
I like that the will have an a if it's animated too
I've not seen it but.
Hell yeah

dont even make me remember this, i got so tired trying to parse all emojis in a string like 4 days ago π
I don't miss doing that from message contents
The only reason slash commands are good
getting all my arguments.

Was happy with my slashcommand abstract class
extract variable
this fucked with my brain so hard when i got so many bugs with it
Nice
that's pog
also ignores emojis if its from the current guild
Interesting
I've wanted to mess with the apps thing
currently trying to find motivation to finish the dashboard
I just match all the emojis from strings and construct the partial emoji object, and then for all the ids, just check it with the guild's emoji's IDs before adding em
Oooh
They are really cool
It was fun trying to basically make discords embeds/reactions
Pulls from a test DB of a server of mine.
Oh damn, looks great
Most of my work has been going into ensuring user auth/jwt shit
the fact that the interaction in the website is really close to discord itself makes it more cool
even the numbers animation so smooth
i still need to learn front end and backend of websites
Everytime I see a bot dashboard I doubt it has real authorization
maybe darken the div when mousehovered, add the pfp, bolden the BOT text...@round cove
the font i'm using doesn't look great bolded so I left it.
I need to import discords font to use for that component though
maybe change the font?
rulebot x rolebot?
For some reason when i open videos on fullscreen from discord, it plays it in like 5 fps
i have a rules bot and i shipped the two since i thought it would be funny
ahhhhhh
Discord's video player is ass
It fails with 4k videos for me
Keeps loading like my internet is single-digit Kb/s
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const { AutoPoster } = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
Will it work for posting server count of on top gg page
I tried this but it is not working like stats didn't posed on page
I used this code in my index file!
const { Schema, model } = require("mongoose");
module.exports = model(
"History",
new Schema({
userId: { type: String },
tracks: { type: Array },
createdAt: { type: Date, expires: null, default: 604800 },
})
);
``` Schema delete after 10 to 20 sec but i mentioned `604800` why its happening anyone can tell me
how would i import a different JS file, while using JS in a browser?
use the script tag
or a bundler
can anyone help me with mongodb? just a bit of explaining in the indexing part and a few more functions
I just don't get it
is this possible? ```js
const db = client.mongo.db("User");
const info = db.collection("author")
let queryo = {author: message.author.id }
let result = info.findOne(queryo)
let query = {author: vote.user, coins: 800, silver: 1 }
let quer = {coins, silver };
if(!result) info.insertOne(query)
info.updateOne(quer, { $set: { coins: 800, silver: 1 } })
firstly its too unclear to read and secondly if you don't care then why you care to reply.
if the end goal is simplicity, the intents are not needed in this example yes?
const Discord = require('discord.js')
let BOT_TOKEN = 'enter your token';
let MY_GUILD_ID = '825407338755653642';
let bot = new Discord.Client({
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.DIRECT_MESSAGES
]
});
bot.on('interactionCreate', (interaction) => {
if (interaction.isCommand() && interaction.commandName === 'ping') {
interaction.reply({content: 'Pong!'});
}
});
bot.once('ready', async () => {
let guild = await bot.guilds.fetch(MY_GUILD_ID);
await guild.commands.create({
name: 'ping',
description: "Ping pong!"
});
});
bot.login(BOT_TOKEN);
the intents just means another thing to explain to the reader?
the intents are supposed to give you access to some information that the bot can't get without intents
the only one it looks like it needs is guilds
a bot can work without them
the only one there is, is bot.guilds.fetch
at no point does that example need to receive DMs or guild messages? its purely slash commands
you can remove what you think is unnecesary and try
i dont do js π
i asked someone to make me this example to put side by side with my C++ example for a tutorial
considering i dont even have node installed, it was faster to ask
yeah
you don't even need guilds actually, that's for receiving guilds on startup and slash commands don't need them, although it might not work on discord.js since it relies on cache
yeah it looks like the registration of the slash command relies upon the cache @pale vessel
?
We can't tell, honestly.
do I have to export.functionName every function in my file that I need to export? or can I so something like export the whole file?
Okay.. i know this has to be a really simple thing.. but i cant get my head around that..
Im currently reworking my Bot for use with slashcommands.. but for some reason i get this error for this core
Error:
TypeError: Cannot read properties of undefined (reading '879376100273311774')
Code:
const guildID = interaction.guild.id;
const voiceChannelID = interaction.member.voice.channel.id;
const channel = interaction.channel;
// console.log(guildID);
if(!queues[guildID] || queues[guildID] === "undefined") {
^
queues[guildID] = new Queue(guildID, voiceChannelID, channel);
}
@pale vessel @earnest phoenix thanks for the help! ive finished remaking the tutorial π
https://dpp.dev/firstbot.html
Also.. since i started using the CommandBuilder i get this Warnings at Startup:
(node:8640) Warning: Accessing non-existent property 'defaultTimeout' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8640) Warning: Accessing non-existent property 'queues' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'client' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'lavacordManager' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'client' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'defaultTimeout' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'firebase' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'database' of module exports inside circular dependency
(node:8640) Warning: Accessing non-existent property 'randomstring' of module exports inside circular dependency
WHAT THE FUCK IS THAT ERROR
you have an if in a wrong place?
you have a circular dependency
meaning you are requiring file A which requires file B which requires file A again and makes an infinite require loop
Yup.. i kinda fixed it after i moved my requires into the module data
Now my main issue is that Lavacord is not updated for Discord.JSv13
Yup currently rewriting to erela.js
Okay.. ive got it almost to work.. but.. Erela.JS errors out with "No current Track"... but i give it a track?
await this.player.play(nextSong.track);
what is a good api that i can use for image manipulation with node?
sharp
blurry
How can I set the status of my bot to show how many votes there are, please explain in more detail.
Should add 'ssdnodes' to that list π
@spark flintI have nothing to put in the status of a bot, so I wanted to put how many votes there are and the command that will reach the voting link
you just replied to a 3 year old msg
i agree
@zealous veldt update the list you cunt
Do you have any idea what to put on the status?
Thatβs why you put something like server count or user count
my guy chinoman10 just gave a good suggestion
and you're right
i'm waiting for verification ://///
when I last managed to see how many members there were, there were 100,000 and more
Popular VPS Providers
Being on this list does not in any way shape or form represent a partnership or endorsement from me or Top.gg, all prices shown in USD unless otherwise noted
- GalaxyGate https://galaxygate.net/
Starting at $3/month, 1 vCPU, 1GB RAM, 15GB Disk, 100Mbps Network, Unlimited bandwidth, Weekly backups - DigitalOcean https://www.digitalocean.com/
Starting at $5/month, 1 vCPU, 1GB RAM, 25GB Disk, 1TB Transfer - Vultr https://www.vultr.com/
Starting at $5/month, 1 vCPU, 512MB RAM, 10GB Disk, .5TB Bandwidth - OVH - https://ovh.com/
Starting at $6/month, 1 vCPU, 2GB RAM, 40GB Disk - HostMyServers - https://www.hostmyservers.fr
Starting at 2.39β¬/month, 1 vCPU, 2GB RAM, 20GB Disk
-Advin Severs - https://advinservers.com
Starting at $4/month, 1vCPU, 4GB RAM, 60GB SSD
If you have suggestions to add to this list please let me know and I'll look into adding them
Or just rewrite
Updated with latest prices/deals
not really the best prices
contabo 
and thats not cheap
who is my favourite moderator
um uh
@rustic nova@rustic nova@rustic nova@rustic nova you ig pin this pls
that list is totally shit tbh
Iβm trying to change now
???
lol mentioning digital ocean and good in one sentence wtf
hetzner, kamatera, google compute engine, amazon aws
were making an updated best vps list pin this and unpin old pls ty
90% is from the original list, gimme suggestions and Iβll update fully
With newest deals
NO DON'T PIN THAT SCAM LIST
lmao
wrong mention
also, wasnt oracle offering pretty good deals?
Yeah oracle is good
and make sure to mention for GCP the specific settings you need to set to qualify for free tier otherwise you'll end up paying accidentally like me
heard good things about upcloud
lol mentioning
digital oceanoracle and good in one sentence wtf
Good idea






