#development
1 messages · Page 1723 of 1
you dont need a hub even then, just a ethernet cable
when my bot gets to 2500 servers will it auto shard or do i need to do something?
depends on your code.
like if i were to keep all my state in memory like a noob?
still depends.
if you have auto sharder enabled, or things like a webserver outside your sharder, etc.
tons of things can potentially break from a non sharded bot to a sharded bot.
If you want to be sure make a second bot for testing and put it on like 2 guilds and shard.
okay, probably a good idea so i dont break my current bot
thanks
is there a setting in discord.js-light to force it to use 2 shards?
Is there a way to make a role using permission integers?
i think djs uses the default sharder right?
https://discord.js.org/#/docs/main/stable/class/ShardingManager
Nevermind found it
thanks, the IDE is happy with it
will sharding on my localhost break my bot that is deployed on my vps?
i have my bot setup so it normally doesn't interfere with prod when i run it in test mode.
Nah it won't affect your prod bot
@sacred vapor no
@ripe prairie
I uploaded my api docs on Swagger UI
how can I use it on my site
like people go api.............com/v3/docs
I want that to be there
is there a way in regex to make something like a negative lookbehind but just for a group (and not the entire expression)?
[^abc] won't work, because it actually matches the characters
hi i have a question
i have a bot which is similar to yggdrasil's userphone
and i have a channel on my friends server of like 70 members where theres a channel #comms
where the userphone messages are sent
to allow them to be moderated easily
is any of that against tos?
nope everyone can
could be a privacy concern, users expecting their conversations to be private, but its not.
so is it fine if i make the channel restricted to admins
probably.
I would also let users know admins can see it, but I dont think thats strictly required.
since i think even yggdrasil tracks the messages, cuz my friends got the owner joining their server and warning them
kk
thnx
anyone smart w mysql & py
im trying to make my bot dm users when they join my discord server for some reason its not working
here is my code discord.py
stored_guild_ids = [834635134388535327]
@client.event
async def on_member_join(member: discord.Member):
if member.guild.id in stored_guild_ids:
await member.send(f"Welcome To The Server!!")
https://bdsm-is.fun/
prefix is set to "god" yet it runs as "S" ??
hello
function hello() {
const array = [];
for (let i = 0; i < 2; i++) {
array.push("Hi");
};
console.log(array)
}
hello()
What happens if I add a return before array.push(...)?
I just launched V5 of my library - https://disco-oauth.tk
Can I look for some feedback here? Thanks
Easily integrate discord OAuth2 in your NodeJS webapps using disco-oauth.
The function will do nothing.
Does the return break the loop?
make it not work?
Yes
thanks!
Np
is there a nifty trick to ignore indentation to finish a function? imagine this scenario ```ts
MyFunc(foo:string) {
if(foo == 'hello') {
console.log('hello');
return true;
} else return false;
}
There are some things in js that i could use to bypass that like this
```ts
MyFunc*(foof:string) {
if(foo === 'hello') {
console.log('hello');
yield true;
} else yield false;
}
is there something i can use to call a function return or closure from within a blocked scope?
how do i make a really good help command?
Make it a link to a website that lists all the commands nicely
and if in an embed form?
Something I personally prefer is you first list all the categories and depending on what people react with, display appropriate categories and add a reaction to go back to the menu and continue navigating
Hard to understand wdym, can you give another example?
how is it confusing?
im using generators to bypass blocked scopes for returns for a function closure
@still sky ?
lol this confused him even more
probably shouldnt even try to help with this then 
generates arent widely used, not really suprised many people dont know about it, but the explanation should suffice
its basically bypassing blocked scopes to return something to the function
generators provide that handy feature, but i cant seem to find an alternative for standard functions
@lusty quest you got any ideas?
I know what generators are ans your question confused me
seen that before yeah
how so?
the return inside the scope is blocked, i want to return true on MyFunc(), thats about it, as it is it wouldnt return anything
those are the 2 important bits
the return is scope blocked
the yield isnt
So you don't want that return to be inside the if block??
technically i shouldnt be using generators here, but i think its a fair example
this is a very simplified example, but lets just assume its there
period
now what?
What's wrong with the first example though? Why don't you want it to be like that
wdym? it wouldnt return true for the function tho
for me it works
there are quite a few times my returns are blocked, was wondering how i could yield on the function instead
the worst part is that its been 2h already and i forgot the specific case use for this
Can you give an example from your code
just what i said, i completely forgot what i needed it for
You could return a promise if the closure is passed as a callback...
needed that so i wouldnt have to rearrange a big snippet frmo my code somewhere
THIS
thats a solution too
completely forgot about callbacks
ty
👍
Why do you need a space?
I don't need the space I wrote a code and this error occurred even though I deleted the code it doesn't go away (translate 😢 )
oh just appearance error bot is running
i've been noticing that lots of companies use the same layout thing for a support/help area eg https://support.top.gg/hc/en-us & discord. Whats it called?
Zendesk iirc
thats more of a softwear thing
do you have the multer middleware?
message.author.roles.add(Bunch);```
this says
TypeError: Cannot read property 'add' of undefined
anyone knows the fix
thx
Is it possible to delete messages from a certain user?
if you have permissions, yes
There is a way to make mongo db autosort the datas?
How do i give someone a role (mute role) inside a
"Client.on" block? its different from the actual command right?
i figured it out
anyway, is there a way to save canvas as webp?
or atleast get the stream
or something
wdym by auto-start the data?
Automatically put everyhing in memory?
no, I wrote autosort not autostart, lol
lmao sorry
https://srcb.in/G2yTuYRT8x
I'm trying this by my code
but aggregate give me undefined
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'aggregate' of undefined
Can anyone teach me how to code a webhook?
what is a webhook?
An integration of discord
I'm not sure aggregate is the right method to use
I've found this on mongodb docs
and after that I sort the data how can I output the first 10?
sort(...).limit(10)
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'find' of undefined
await db.profilemodels.find...
Also it doesn't sort them in place, it returns the sorted arr
So it create an array and I can do for(i=0; i<10; i++){message.channel.send(array[i])}
I have to declare this array?
Can anyone teach me how to code a webhook?
guys i was checking my kick command
i kicked my one friend
now he cant join back
and shows he is banned
but he isnt banned
LOL
const arr = await db.profilemodels...
and then you can so whatever you want
it still doesent work
any errors?
I hate trying to do this
whatever I do it gives me err
Can anyone teach me how to code a webhook?
In what lang?
discord.js
Cant you edit webhooks now?
¿?
Thanks bro
db is the database name?
Says Invalid Token
@cinder patio https://srcb.in/A89b8nk5pM
For the moment I have this
lol, i put some really aggressive memory management into my lib
its currently hovering at 441mb, caching about a million users across 7700 guilds... and every time it tries to add on a few more megs to the cache, the GC kicks in and WHACK, back down again lol
quite fun to watch
discord.py vs discord.js
which one is better ?
¯\_(ツ)_/¯
If you're more familiar with python, then use discord.py
Else use discord.js
ask "which is better for me"
oh ok!
i misread your nickname as diesel cow, btw
XD
LOL
how to suppress the reaction of a message except that of a user?
Member/role permission overwrites
You could give a member temporary role that lets them react while others can't
Hello
ask "what does exe prefer"
since when do developer's opinions matter? its all about exe's opinion
How do you split a String on Java?
thx qt
do note that, depending on what character you want to split you might need to use Pattern.quote(delimiter)
client.channels.cache.get("828985803178901544").send(`I have been removed from: ${guild.name} (id: ${guild.id})`);
TypeError: Cannot read property 'send' of undefined
the channel you're trying to retrieve is nonexistent
how do i do try except?
like i have the erro
but idk what the proper like error is
and how do i do like if this is the error do this etc
python
Correct id
that doesn't mean the channel exists
Model.deleteMany({ "guildid": { $regex: `^${guildid}$`, $options: 's' } })
I am trying to delete many in mongoose, but it is not working...
arent you supposed to use regex with //g?
it should delete all documents with the guildid
I keep what I said
it works with ^345678908765897654$ but, when I have a different guildid and use the way like the code below, it does not work
const reg = /`^` + guildid + `$`/;
Will this work?
I said //g not //
where should the guildid go?
super confusion lol
look at the fckin G
yes? /^$/guildid
boi
that does not make sense lol
/`^` + guildid + `$`/g?
lol, no its all about what brain says is right
and you don't need ^ nor $
like this ?it does not work lol
you still need to treat guildid as a string
else you'll be matching EXACTLY the word guildid
he's searching for docs that contains the id
I want to delete all documents which has the guild id ....
just
also, + is a regex symbol, not concat operator
its depreceated
oop, I think thats the solution
does not work
doubt
not necessarily having the field guildId
he wants to delete anything that contains the id
not necessarily being in a field called guildId
findOneAndDelete({ guildId })```
you don't need to write guildId twice btw
this
I vs i
?
my I was small
they're talking about another thing
but tbh
your db structure is bad if your forced to use regex to remove everything relating to a guild
that are mod cases, which fire or delete them after a specific time
your db is bad period
you're supposed to have id columns for that matter
this is nto the time to shit on somebody for using mongo vs postgres
thats another discussion for another time
who is shitting?
i was getting to the fact that they're storing relational data in a non relational database
lol, I am sitting since 1 hour on this problem, to delete some stuffs
other use case is, user accounts with guildids
lol, oh no, another person using mongo for relational data?
everyone uses mongo for relational data 😩
read the first 5 messages after that one
its all about mysql. mysql for life, yo.
disgusting
ah, yes, a truck for formula 1
postgres is for open source weenies ducks and runs for cover
or a sausage in a cheeseburguer
or lemon in orange juice
oh wait
brain
but anyways
him making bad db choices isnt going to solve his issue
postgres >>>
I removed the + and did (/guildid/g).replace('guildid', guildid)
it would tho since it's still in time to change dbs
i think people are drawn to mongo because of its very flexible and mature codebase in node
so u probs should first add a guild id field to all mod actions since i hope they all happen in a guild
doesnt make it the swiss army knife people use it as
well mongo is easy to use esp if ur a js skid
no
look, in regex guildid means guildid
not the variable
exactly the word
ive always used mysql, never really given postgres a second look
but thats for the same reason js people like mongo... the C apis for mysql are far better than the postgres ones
yeah
no
had to do something in mongo with rust for work and god
it has terrible driver support out of js and py like jeez
ok
tell you what is equally nice in C++ as it is in everything else, redis libs
redis 
does not work
, so frustating
get the document json and go here https://regexr.com
then see if the regex match
it works when I do /12345323432/g but when replacing, it does not work
maybe you're not replacing properly
(`/guildid/g`).replace('guildid', guildid)
What are you doing
mongoose deleteMany, all documents with the provided guildid
not necessarily being in a field named guildid
basically if guildid is 123 delete everything that contains 123
because it does not work with deleteMany({guildid: guildid})
"Everything" as in? Properties?
Why not? It should
What did you store the guild id as
let's say there's a user named hans_123
nope I tried 10 times, checked
as string
that doc would be deleted
because the guildid is there
yes
Then it should have worked
Hmm
like, he wants to delete anything that contains the guildid independently on property name
module.exports = {
name: "leaderboard",
aliases: ["lb"],
permissions: [],
description : "comando per vedere la classifica dei soldi di novabot",
run: async(client, message, args, Discord, cmd, profileData) => {
const collection = new Collection();
await Promise.all(
message.guild.members.cache.map(async(member) => {
const id = member.id;
const bal = await client.bal(id);
console.log(`${member.user.tag} -> ${bal}`)
return bal !== 0 ? collection.set(id,{
id,
bal,
})
: null
})
)
const data = collection.sort((a,b) => b.bal - a.bal).first(10);
message.channel.send(
new MessageEmbed()
.setTitle(`Classifica del sistema di monete di ${message.guild.name}`)
.setDescription(
data.map((v,i) => {
return `${i+1}) ${client.user.cache.get(v.id).tag} => ${v.bal} monete`
})
)
)
}
}
I've found this code for the leaderboard, but idk how to change it for make it work
PLS HELP
It's probably not a good idea to copy code that you don't understand
Hello !
I tried to download the python topgg (1.0.0) library but I didn't succeed. I already have the 0.4.0 (dblpy) and I would have the 1.0.0 (topgg)
https://dblpy.readthedocs.io/en/latest/whats_new.html#v1-0-0
(and my pip is up to date)
Can I do like when my bot joins a server then he automatically gives server name to my server channel?
can i know how can i create a !ping command??

menas if someone write !ping then it should say the ping of the bot
Depends on library
Mb library guide have it?
means?
What language?
Late response but await novabase.profilemodels does absolutely nothing. You need to await the novabase.profilemodels.find().sort({bank: -1 }).toArray() call and iterate through it
python
I've changed everything
I'm trying all the things that I have online
https://srcb.in/XVZwzKSXCG
Now this
I don't know python
how can i create a command that say ping of the bot when i write >ping (python)
I feel bad for you so I'm just going to give you this:
const array = await novabase.profilemodels.find().sort({bank: -1 }).toArray();
for (let i=0; i < 10; i++) {
// i is your index
// array[i] is your object
}
and if it doesn't work don't just say it doesn't work, give us the error you're getting
for who it is??
@stiff lynx
should this work?
Most likely, haven't tested it
index Is the id? or what
index is the current index of the array
like
0, 1, 2, 3, 4, 5, 6 and so on until 9
yes I know
do i + 1 to get the actual rank of the user
Well what do you store in novabase.profilemodels.? How's the object structured? You definitely do not need another for loop
sorry i need a direct answer
One message removed from a suspended account.
can i know how u made ping pong command @earnest phoenix
wdym return the letter
One message removed from a suspended account.
One message removed from a suspended account.
message.channel.send(`Rank ${i + 1}: ${array[i]})`
COULD be good enough but it depends on what array[i] is
One message removed from a suspended account.
what happen
One message removed from a suspended account.
okay
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
👀
One message removed from a suspended account.
One message removed from a suspended account.
linq just implements methods like you have in js
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
how can i create a prefix for bot??
One message removed from a suspended account.
split the character?
One message removed from a suspended account.
One message removed from a suspended account.
what i am asking
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
yes there is
One message removed from a suspended account.
One message removed from a suspended account.
hey
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
What do you mean
One message removed from a suspended account.
so i inserted the unicode of this emoji: 💀
in the vps
but it keeps giving me emoji errors. When i searched the function in the code running on my vps, i saw that all unicodes were turned into ??
That's just because your console has limited unicode support
how would i fix it?
There's nothing to fix
well there is
as it throws me unknown emoji errors
i copied it from this site
@sage bobcat this is what i threw together real quickly
Console.Write("Enter a string: ");
string input = Console.ReadLine();
Dictionary<char, int> counts = new Dictionary<char, int>();
foreach (char i in input) {
if (!counts.ContainsKey(i)) {
counts[i] = 1;
} else {
counts[i] += 1;
}
}
foreach (KeyValuePair<char, int> kvp in counts) {
Console.WriteLine($"{kvp.Key}: {kvp.Value}");
}```
One message removed from a suspended account.
so you can store what each character's count is
otherwise you can just store a character or a count
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I have created webhooks. It works. But how do I make a vote required command?
One message removed from a suspended account.
also the dotnet-script tool is awesome cause i can just do it all in vscode 😎
One message removed from a suspended account.
One message removed from a suspended account.
csx is the technical scripting language extension i believe
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
you could ig
One message removed from a suspended account.
One message removed from a suspended account.
nothing with the tool i'm using
i'm sure i could name it .js and it'd still compile fine
One message removed from a suspended account.
yeah
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
nah it's an external tool
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Fake name parm is his real name
One message removed from a suspended account.
One message removed from a suspended account.
nah
One message removed from a suspended account.
One message removed from a suspended account.
any builds i just do in vs
One message removed from a suspended account.
how do i escape a unicode?
Where can I find out about custom events?
what do you mean by "escape a unicode"
you don't... need to? unicode is just characters.
Need more information to answer that query. what do you mean by custom events?
@ocean wave
but it still turned them into ??
can i find uptime bot?
if you get ?? with unicode it means whatever you're looking at doesn't support that unicode range
not here. this is a development channel 👀 try looking on https://top.gg/
hmm really? i was just trying to fetch this emoji: 💀
yeah i know
the problem is your VPS, what you're using to look at the vps, doesn't show it
I got absolutely no idea what that is or what that refers to
owh so it is there, it just doesn't show. Strange. I can bet that it still gave me unknown emoji issues
yeh
what is normal ram usage for a bot with 2k guilds?
There's no "normal usage"
These are web hooks.
usage depends on what your bot does
ok but that's a service I've never seen, maybe ask their support for help?
Otherwise a webhook is literally just an HTTP POST query to a specific URL
the words "custom event" don't have any meaning in webhooks.
uhm you can't programatically vote with a bot
One message removed from a suspended account.
you need to have an EventEmitter object to do that
Google translates my translation sentences nonsense.
I mean you could technically create that process.on and then just call it with process.emit('emergency') actualy
Is it possible to make a npm package which modifies internal function of another npm package
ok
Google translates my translation sentences nonsense.
is such an irony because it's literally a nonsense sentence. LOL
It would be better if I tried to do it myself.
technically yes you can absolutely and horribly fuck shit up in core systems and functions and modules. however, doing so is horrible, it's the absolute epitome of bad practice, and will get you utterly shunned by the entire nodejs community. Don't fuck with core prototypes 😉
Why would you not just use the #topgg-api ?
You misunderstand me.I am using google translate.......
else i have to import all file or delete require.cache and resolver it
What, specifically, are you trying to do?
like what problem are you trying to solve
You know dbd.js?
I want to modify the parser so you can add support for selfmade functions
hey @umbral zealot
They directed me here.
2|index | at RequestHandler.execute (/root/Miniboss5/node_modules/discord.j s/src/rest/RequestHandler.js:170:25)
2|index | at processTicksAndRejections (node:internal/process/task_queues:9 4:5) {
2|index | method: 'put',
2|index | path: '/channels/836632001989705778/messages/836632002509013054/rea ctions/%3F%3F/@me',
``` if the emoji's are there, why is it still returning an error?
for some reason its still not sending the joining user the message do i need to import anything?
It's possible but it really depends on the exact way the module was built. That requires some pretty specific knowledge of the internals of the module.
looks like it didn't really save the emoji correctly, at all, unfortunately
do i have to delete require.cache?
There's a whole lot of resources in the pins of this channel about hosting
ik the internals of the module.,but don't how do it lol.
I am looking for free
no not at all. you'd have to import and then either modify or extend the code. It's probably easier to actually branch their source code and modify it directly rather than importing it and trying to modify it after the fact.
Right. See the pins of this channel about hosting, free or not.
then i have to update my code everytime when they update :C.I will ask tim he did on djs-light
you can use heroku, but that site is demonic
i heard that google cloud offers free 100$ hosting tho
even if you somehow extend dbd, you'd have to update anyway because... well... their code changed either way
the never change the parser .The parser is a plain file of existing functions .
it looks likethis
i will find a solution
better to write your own parser
okay guys i am still cornered with my emoji problem
\❌
i tried copying this unicode character to my vps, still gives me ?? characters instead
my client returns me: DiscordAPIError: Unknown Emoji 2|index | at RequestHandler.execute (/root/Miniboss5/node_modules/discord.j s/src/rest/RequestHandler.js:170:25) 2|index | at processTicksAndRejections (node:internal/process/task_queues:9 4:5) { 2|index | method: 'put', 2|index | path: '/channels/836632001989705778/messages/836632002509013054/rea ctions/%3F%3F/@me',
what are you editing the file with
winscp
https://www.youtube.com/watch?v=Aqk7x_w1H98
just gonna leave some codin' music here for you all
Mick Gordon - The Only Thing They Fear Is You ( DOOM Eternal OST High Quality 2020)
#doometernal #doom #RazeHell
Here is My DOOM Eternal OST Playlist : https://www.youtube.com/watch?v=Bew_XUdU7dQ&list=PLNqTTJ3Zn5gmeOnWBUGrAcNtCic5rJEnc
SUBSCRIBE TO MY CHANEL
:https://www.youtube.com/channel/UCPqO1T-5tALJ7u5SRo_vnpQ
Donate to the Channel Via...
i remembered once that i had this issue, someone told me that i had to escape the emoji and return it as a /s22js9 or something
you need to save as utf8
Red cross would be something like \u274C
emoji endpoint takes either emojiname:id or the unicode, e.g. \😄
url encoded unicode
yeah how do i get tho utf8 characters
Is the webhook only working, if your bot is approved?
i copy and paste them from an emoji table on the web
You can only use the API if your bot is approved, yes
will do that too, thank you!
@safe raven i think so yes
but the test option will still work
iirc
as the test is done from your browser isnt it
yeah, pretty sure it is
isn't that the unicode number?
or the css number
this chart is confusing the hell out of me
and add a \
correct
mhm
google: hippity hoppity your credit card is now my property
okay guys
Okay
3|index | at RequestHandler.execute (/root/Miniboss10/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
3|index | at processTicksAndRejections (node:internal/process/task_queues:94:5) {
3|index | method: 'put',
3|index | path: '/channels/836639007118589972/messages/836639007525306369/reactions/%E1%BD%880/@me',
3|index | code: 10014,
3|index | httpStatus: 400
how
i am using utf8 characters
What.....
you tried to use do something with an emoji that didn't exist
Dumb it down for me
i didn't
doubt

those aren't custom emojis
i know
why cant you just type \:emoji: on discord and copy the character
but i had problems on my vps
it would turn them into ??
and still would get the same problem
i already asked it here
and someone told me to use utf8 characters
still gave me unknown emoji errors
really strange
and how tf are you coding on a vps those are for hosting you use a text editor for writing code
i am not going to push and pull a file for only 1 emoji string
uhhm
the one with U+2592
And removed the + and added a \
so for example: \u2492

this channel is not for shityposty
okay i changed it back to unicode, still the same issue

arthur please fuck off with your emojis
Ok
see the emoji code you were using in #commands
it's not an emoji lol
i tried console logging it and it outputs 11

i dont know python but there is something absolutely wrong with that code
You'd probably need to parse the message to see if a command was run.
ok
Just do what you already did. Check if the message starts with !userinfo and if it does, just await client.process_commands(message) instead of sending anything
hey spaxter, do you know the utf8 sequence of 💀?
google returns me \u1F480
but that is not valid
You wouldn't need to process the command either since both the command is run and the on_message event is triggered I believe
So what are you asking for then? Cuz that's how I read your question
I have a name conflict in my ts project: an interface named Interaction which defines the structure of the payload from the API and an Interaction class for you to do stuff with the interaction
what should i rename them to?
Yeah, that looks it should be it
Rename the interface to IInteraction
suffix your model interfaces (aka the ones that define the structure) with Model
nope
Isn't that what your code already does?
i tried console.logging it with some test bot here
it returned some strange characters
if(msg.content === '$guild') {
const ownerr = client.users.cache.get("769077060944658452")
const { MessageEmbed } = require('discord.js')
const guild = client.guilds.cache
.addField("Servers Name :- ", guild.name)
Itz giving me undefined
what the fuck is that code
Help me
collection.addField()
You can try if message == client.user.mention instead
@earnest phoenix one solution would be to listen to the on_command_error event and see if the exception was a CommandNotFound exception. If it was, you can run your hook to see if it mentioned the bot. This would be suitable if you don't want your bot being mentioned in any command to count.
my eyes are bleeding from seeing that
Oo so can u tell me?
or how about APIInteraction for the interface?
no
InteractionModel looks and sounds 100% better
^
plus APIInterface has two Is next to each other which looks weird
plus, the model suffix is self-explanatory
you read it and you understand that it's a model
k
Can I get help in this?
just get your channel from cache(your server channel) and send it with the payload coming from guildCreate
hey, so is there any way to fetch a messageid that was sent in another channel?
get the channel its from first
but yes
you need to know its channelId before you can fetch, as long as you have that, you good to go
yeah i tried fetching the message but it of course gave me a message unknown error
as it was sent from another channel
like i said, you need to fetch FROM the channel its inherited from
i know
then?
i just said that i tried it
you said it was SENT from another channel
you didnt say you fetched it from that channel
Like guildMemberAdd?
what code you got?
wahahha yeah i meant to say that i tried it before but it didn't work as i was using the wrong method apparently
guildCreate not guildMemberAdd
guildMemberAdd is just when new users join
Oki
not when a bot joins aserver
show what you got so far
should be as simple as ```ts
/The channel the message originated from/ <channel>.messages.fetch('id');
if its d.js should be that
or pérhaps it uses an object
/*The channel the message originated from*/ <channel>.messages.fetch({ids: ['id']});
fetch() on a string should work
Hey I want to do
If I type $guild
Then my bot will send all guilds name in embed
is there a way to utilize roles.add from a variable if collected from the users previous roles?
for example
let oldroles = member.roles.cache.map(r => `${r}`).join('\n').replace('@everyone', "")```
will return whatever roles are there
i then remove the `oldroles` from the member and then i can replace <@& and > to just get the role id out of it but it when trying to add `oldroles` back later with or without the <@&>, it gives me an error stating supplied role is not a role
i want to do this with multiple roles. i know if i remove the \n it works with one, however i would need it for more than one role at a time
Instead of manipulating a string to get the roles IDs, save their IDs by using <Collection>.keyArray() on <GuildMember>.roles.cache in a variable and then do whatever, and after that, just pass the variable to <GuildMember>.roles.add()
// Save member's role IDs
const oldRoles = <GuildMember>.roles.cache.filter(role => role.id !== <GuildMember>.guild.id).keyArray();
// Remove the old roles from the member
await <GuildMember>.roles.set([]);
// Do whatever here
...
// Add old roles back
await <GuildMember>.roles.add(oldRoles);```
might be faster to first turn it into an array and then filter if only the id is used in the filter function
How?
against tos
iirc
Means?
discord doesnt allow you to expose info about the guilds a user is in
not sure if that works for bots
In a short term
"Breach of privacy"
that worked. thanks
I don't think just listing guild names is a exactly a breach of privacy, it is a little intrusive and you should definitely let your users know
but just having the name of the guild doesn't mean much
my friend magical cat got banned from discord for doing something similar to that
!support will invite him to the server with admin perms
just for listing all the names of all guilds it's in?
The command should be owner only ofc
well owner only ur good
no
you think it shouldn't?
names only is ok
they made four alts what do you expect


ok can someone tell me now how i could make ```py
global trophy
with open('trophy.json') as f:
trophy = json.load(f)
put your computer on a school globe
Do you want to make trophy accessible across all files?
yes
wtf is trophy.json
oh god dont tell me you're using a json database
clearly
no
good boy
not that

have a hug
I use a json database
I believe the code would be run for each time the file is imported from other files (aka import somefile).
dw, I don't
so basically
add
another py file
import it
cough https://npm.im/jason.db
Oof
hey
lol
so i have a txt file with a username and 1 simple number after the name: js if(subcommand === 'levels'){ const leveling = fs .readFileSync("./levels.txt", "utf8") const embed = new Discord.MessageEmbed() .setColor("RANDOM") .setDescription(`Name: Level: \n${leveling}`) message.channel.send(embed) }how would i put a @in front of each users name?
oh god not this again
so do i create
stop using a text file as your db
Again haha
awesome, this is not awesome
why
i agree he's awesome
kek
Looks like you might have to change that "some" to "ful"
i am not using this for any type of leveling system. These are constants.
not variables
the file doesn't change
then you could use json
or why do you have the need to manipulate them?
and if you're storing usernames that are static why would you not just make them mentions?
They're constants
because i want to make a register of my pokemons and their level, just manually put into the file.
sure
#globals.py
import json
import os
global trophy
with open('trophy.json') as f:
trophy = json.load(f)
But how is this levels.txt but it's about pokemon and you want to mention people with their username? that's like so damn confusing
I will admit, that level of commitment is admirable
I dunno, have I ever told you the definition of insanity?
imagine thinking levels of pokemon dont change
imagine thinking pokemon are usernames that need to be mentioned with an @
Are you SURE?
^^
but i just got confused myself and made a typo
someone help me
very amusing story
maywitz shut the fuck up
Settle down, kids.
no one is going to help you with that attitude.
^^ nice attitude
I don't know specifically about python, but in general, making something global is a horrible thing to do. What you should be doing is importing the data from anywhere you specifically need it, not making it global.
then i gotta change lots of stuff
lol
global is not that bad
Probably, yeah
evie, is there a way to create a channel directly into a category?
instead of first fetching the channels
Provide parentID in the options
hi
https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=create seems to clearly define there's a parent property you can use
hi server auntie
hi
has anyone verified a bot before
im doing this for the first time
its been saying this for the past 20 mins
is that normal
kk
20 mins....heh
better sit down if you're going to watch it till it completes
I need to run a command inside an npm script in another directory
ex.
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "enter another directory and run a command && node ."
},
is this the right command to ping someone when they type "ping"
because there is an error in the terminal
Lol
did u copypaste that?
your client is called bot
bot.ready
client is whatever name you assign Discord.Client to
ohh sorry no bot.on('ready', () => {
}
who do i listen to
whatever name you chose, thats the name you have to use everywhere
you did bot = Discord.Client
so bot is your client
use bot everywhere
and also you covered the token really bad, I can still read it
@quartz kindle what do i write then
i just told you
change client to bot
bot.on('ready')...........
instead of client.on('ready')
is that better
and also 'member.user.roles' so the bot says 'member.user.roles' but i think you want to say for example owner, moderator
i said everywhere
yes, do it with client.on to bot.on
you still have a client there
now is it good
yes
working, but as i said
and also 'member.user.roles' so the bot says 'member.user.roles' but i think you want to say for example owner, moderator
i want it to ping the user
well then
you're new to JS aren't u?
very new.
pro tip: halt bot development and practice common programming
okay, but ill finish this first
bot devving isn't a newbie-friendly task
just a simple bot i want to make
it's like medium-hard project
message.channel.send(message.author.username);
save the file
ok
do you ever changed the js?
if you saved then restart bot
node .
lets see
message.channel.send(message.author.username); this one says the username of the user
as i said
u can ping me for help with coding
CHANGE WHAT I SAID please
so what do i change this to
message.channel.send(message.author.username);
now it just says my username
it’s message.channel.send(“member.user.roles”);
this one displays the username. you can ping but I recommend you message.reply
yes
how do i make it an actual ping
I can do that
not in "
can you help me
like show ur bot ping(
?
OHH
I see what he wants to do
i know it was a mistake lol
I didnt know what he wanted
well try this one message.channel.send(message.author.String())
is it working?
he just wants a mention
message.channel.send("<@"+message.author.id+">")
who the hell do i listen to
bruh
ok dm me i help you
do mine 100% working
just what should this turn into
message.channel.send("<@"+message.author.username">");
bruh just save and restart the bot it works
bruh
@shadow compass does it work?

now the bot doesnt even go online
dm me and I tell you how it should look like
just type in bot.on
learnjs moment
bot.on("message", message => {
if (message.content === "ping"){
message.channel.send("<@"+message.author.id+">");
}
}
that does not correspond to your code
yours doesn't work either :/ it's .toString()
but... you do'nt need either
ok then toString
that cod eshould be fine
no.
maybe just add spaces
give it a try
Evie's right
<@${message.author.id}>
`${message.author}`
```. The template literals are needed
thank you so much
especially when you know nothing of javascript and you're just starting
then?
For some reason
send(`${message.author}`) => Mention
send(message.author) => User#tag
ohh yeah then it's a working code
with spaces
is there a way to just automatically ping every minute or something
no don't
you should not ping people on a loop
thats what the person who wanted me to make this bot wanted
is this and
if that makes sense
tell him that that's forbidden
If someone asks you to beat up someone else with a baseball bat, are you up to it?
and this works?





