#development
1 messages · Page 1162 of 1
let msg;
user.send(`Incomming short message from ${message.author.tag}!\n\n**${m.content}**`)
.catch(() => msg = `${user.tag} DM is currently closed!`)
.then(() => msg = "Your message has been sent!")
if you're setting a variable, use await.
pog
hey so i made a website where any user have to login via discord so after he authorize he will be moved to my website and a code will appear in the URL like thishttp://example.com/cover?code=123456789 that ?code=123456789 discord adds it to my original url which is ``http://example.com/cover` and it changes if i login in again so after the user is moved to my website i use this code to get his information like name, id and etc
but if i moved to another page the code disappears and i can't get the user information
i tried to store his/her information but i can't connect it to the other pages since there is nothing to identify that this information belongs to this user
can someone tell me a way to keep the user information in all pages ? (ping me)
cookies
?
web cookies
store a session cookie
^
could someone hep me, I would know, how to join a VoiceChannel (by the channel name) on an specific guild(I know the ID)
discord.js
grab the guild using your client by id (client#guilds#cache#get()), find the voice channel (guild#channels#cache#find(function)), and join the channel (channel#join())
ok, thanks
the function for find can be something like find(channel => channel.name === "General")
crhello, im using opusscript for my music system, while im playing music and there is error , and no matter what error, even one that doesnt matter, opusscript making the app to get crashed
anyone here have a solution ? (discord.js)
this is a part of an error :
"]=asm["V"];var dynCall_viiiiiii=Module["dynCall_viiiiiii"]=asm["W"];Module["asm"]=asm;Module["setValue"]=setValue;Module["getValue"]=getValue;Module["then"]=function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=function(){if(old)old();func(Module)}}return Module};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run();```
excuse me wtf
escuz me what
this part of the error is not very useful
I’m making a bot for my friend so he can get commissions. I got the message collector working but I want the bot to personally DM the user. But the collector only works in the channel? Anyone knows how to fix my problem? Sorry if it doesn’t make sense.
Any error/any code?
Uhm.
what did i mean, that every single error the app got crashed
I’m on my iPad rn.
because of opusscript
Sleeping.
JS arrays are treated as objects wtf
let anArray = [];
typeof anArray: // returns "object"
If I have an object, with normal object properties.
Does object[0] get the first property
🤔
(Js)
Nope
is that a rhetorical question
If I have an object, with normal object properties.
Does object[0] get the first property
@solemn latch it returns undefined
Btw I have a status ad is that allowed
your name isn't hoisted so it's fine
k
does anyone know how to use cookies in aiohttp_jinja2 ?
mods have status ads too
does anyone know how to use cookies in aiohttp_jinja2 ?
@regal jacinth https://dontasktoask.com
?
Tf is that pfp
what?
^^
@misty sigil hey u dontasktoask.com even tho i dont know what that is but here it is
Code does that when he doesn't know what something is
sockey.iowo not lwoading uwu owo
im including the src too
y it !work
<script src="/socket.io/socket.io.js" defer></script>
wth are u saying
it is not working
trying to do socket.io, its installed on my machine and shits not working
Hi, how to make [function], when a user joins a voicechannel? (discord.js)
You mean this event?
wwoooo do you know how to help with socket not loading?
Like on your webpage?
no, for my discord bot
You mean this event?
yes
Try using this @pure lion
https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js
how to do that
@solemn latch spaghetti
I dont know what I'm looking at in the hastebin
neither do i
its trying to load the same thing over and over but not ig?
nvm its different every time
<script src=chttps://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js"></script>
You swapped your source over to this right?
Sorry about the random c
Kek
I have no idea then
fuc
no

s y n t a x e r r o r
how can i print the information of specifc user that i stored in mongodb
i mean if the user in 2 guilds i get the 2 Schema
any1 know how to remove folder on github ?
remove the folder, and push the new commit without it?
the folder has a lot of images
@dreamy cedar find
Can someone explain how shards work?
remove the folder, and push the new commit without it?
@solemn latch idk how to push and commit etc
but fairly certain that
yes github
Schema would mean they're using mongoose?
you could store guild IDs under the user and use that if needed
U need desktop app
each shard handles a set number of guilds
but find is probably a better method
u have that?
kek
thats pretty much it
U need desktop app
@earnest phoenix then ?
Remove?!
yes
where can run this ?
any terminal with git?
yes
https://docs.mongodb.com/manual/reference/method/db.collection.find/
@solemn latch it return just the first one
whats your code look like?
i dont know github desktop
git doesnt like when you just randomly delete stuff
remove then push
you have to push it
am using github desktop too
i did
anyway https://docs.mongodb.com/manual/reference/method/db.collection.find/#find-documents-that-match-query-criteria
@solemn latch it return just the first one
@dreamy cedar can i rename images without remove and re-add it ? on github desktop ?
like only rename
is it gonna work ?
use i think you can
i didnt try to use images but i removed before some files
it says it returns all matching documents
@solemn latch 🐸
Do you use VSC (Visual Studio Code)? If yes, just type in the Terminal npm i ffmpeg if you have NPM. @earnest phoenix
ye
yes
And what‘s the error?
FFmpeg not found
Can you show the code?
what should i do after push ?
Can you try npm i ffmpeg --save?
@dreamy cedar
use deploy in ur host
const modlog = require("../../models/modlog.js")
modlog.findOne({
guild: message.guild.id
}), (db, err) => {
db.collection.deleteOne()
that not works why?
can i create a bot that would welcome my memebers into my servers
Of course.
you didnt delete them u just rename i think
Of course not
you didnt delete them u just rename i think
@dreamy cedar i tried to remove
Spoon feeding is not allowed (#rules-and-infos 7)
nothing happened
your file exists on your github but not on your pc?
const modlog = require("../../models/modlog.js") modlog.findOne({ guild: message.guild.id }), (db, err) => { db.collection.deleteOne()
@hazy girder
const exp = await mdlog.findOne({
guildID: message.guild.id
});
your file exists on your github but not on your pc?
@quartz kindle yes
nothing happened
@viral iris it works for me
ty
and github desktop doesnt show any changes?
wlcm
send a screenshot of your github desktop
if there are changes you have to commit them
no
write a summary then press the commit button
what is it ?
what? a summary?
yes
its a small decription of what changed
what to write ?
something like "deleted unneeded images"
use commit to master
still can't
use commit to master
@dreamy cedar how ?
oh no
it's worked
by bad lol
you need to check all boxes
ok nice
so anyone know how i get all the collection of specif schema in mongodb
As a way for newbies to port their bots to proper hosting?
highly doubt it
You think I'd get in trouble if I made a bdscript interpreter for Linux?
@green kestrel strictly forbidden in BDFD if you mean that.
the rarities folder not here but it still on github
They‘re rules, yea.
has anyone had a problem with discord bots just chomping through bandwidth? a bot i have in 80 servers is on track to use about 250 gigs of data this month, which is really rough since i have a 1tb cap, considering just buying a cheap vps to run it off
ok worked
I'm thinking I could make a blackbox implementation using just their docs
Or even just people's bots
You are allowed to host the BDFD bots on other hosters because the commands won‘t work but if the commands are working in other hosters then it‘s forbidden.
lmao
That's like saying I can't make a PHP interpreter
I was BDFD supporter for long time. I know many things about it. xD
@quartz kindle commit then push right ?
yes
thx worked ❤️
I can look at a language and make a compatible interpreter that can be run on any Linux box, I doubt any way of accusing someone of a tos breach for a service they've never even signed up for an account for on is not feasible especially if it was an open source project
what can bdfd do about it tho? did they copyright their bd-script "language"?
can they sue you for it?
what can bdfd do about it tho? did they copyright their bd-script "language"?
@quartz kindle no, bot they will ban you. xD
How though?
You can copyright source code which would mean I can't steal their code and wouldn't
How can they enforce against their code being run on other boxes
It's like hackintoshing
Yeah
Hm
This is what I'm thinking
They probably run on some linux box themselves
they cant ban you if you move out of there and shut down your account
Yea
It's a simplistic language anyway
they cant ban you if you move out of there and shut down your account
@quartz kindle they will ban you on BDFD and ban you on the app.
i have a question
i dont use either
anyone coded their bot in discord.py?
neither do people who move out of their service into a proper vps
But if there's a third party interpreter you don't need their app
@fringe axle but if you've moved onto another box you don't need the app
That‘s true
????????
No
And I watch YT now. xD
dang it
oh ok
if thats your bot and you just added it, you need to wait for it to be verified
no
How to create category channel in v12?
rule 4
yes
category channel?
yes.
from #support , how do i fix the caching issue? this is the only server pulling up null
Can you send an example?
set the type to category
from #support , how do i fix the caching issue? this is the only server pulling up null
@gleaming island <guild>.ownerID is always defined
you can fetch from there
i'm pretty new to python but I don't know what the issue is
python main.py
File "main.py", line 9
bot.run("TOKEN", bot=True, reconnect=True)
^
IndentationError: expected an indented block
im an idiot, i didnt close off the function above it
lmao
oH
how do i define message?
with magic
thx
on a serious note, we need more context in order to help you
Message is meant to be passed in or defined somewhere
remember that we can't read minds
on a serious note, we need more context in order to help you
^^^^ covid broke my crystal ball
On a more serious note
My source to socket.io is at about 200 404 get errors and counting
hey guys
i am kinda stuck with a problem right now
i just made an autoreaction bot
but i started off slowely.
now it sends the word test everytime you write something down in the chat
is there any way to remove that word test, but add a reaction instead?
if you're using djs that is
could i send my code through hastebin?
pastebin**
Pastebin
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.
and you cannot use discord client names for the emojis, you need to use their unicode counterpart
i know
Do you want to be murdered by discord API staff?
but when i use message.react
the bot stops after 1 message that i send
Do you want to be murdered by discord API staff?
@pure lion i can put lowmode on that channel
discord api staff
slowmode
that entire snippet you shared is just a mess and not following any good practices
yeah sorry for that
This is the only time good practices account
Ever
Congratulations
Your code is so pasta you broke es
Is there any bot programmer and full server? And linking with a website?
if anyone could provide that, gladly appreciated!
Read privatr message
Alr
@pure lion
@eternal osprey firstly to stop further confusion, please install the prettier code formatter and format your code
okay done
Send your sexy code and I'll do stuff
is this a json database
yes
i also have 2 more files
Ardata.json
which contains these:
{
"AR_Channel": "",
"AR_Message": ""
}```
and ofc my config.json
okay
Okay don't use json
@pure lion json is fine, as a config file
it gets bad when you start using it as a database
😉
are you looking through my code rn?
binned?
pastebin
Pastebin
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.
there you go
${client.ws.ping} returning NaNms value how can i solve that?
custom?
its message.react("ID")
i know
but in my code
it add it to only 1 message i send
then the bot exits
i want it to stay
and add reactions to every message
but i have no clue tbh, cannot find anything in the docs either
client.on('message', message => {
message.react('ID')
})
Also is there a way to interact with phpmyadmin through node?
client.on('message', message => {
message.react('ID')
})
@pure lion how do i make this work with a !channel set autoreact command
Use an if statement
in discord.js using reactionscollector#collected method i get reacted emoji name
👍
✅
how can get it in array ['👍', '✅']
@jovial frost push into array
then i get two arrays
my bot still only sends 1 reaction
and then stops with thiss error code:
SyntaxError: Unexpected end of JSON input
i tried and i get
[ '👍' ]
[ '✅' ]
att json.parse
Why
you corrupted the file
maybe i should create a new databse for the emoji send
this is why we don't use json as a database
@earnest phoenix no
finally got config thing working, its in a .txt and requires some other plugin tho
lmfao
congratz
SyntaxError: Unexpected end of JSON input
@eternal osprey json serialization is so fragile
that is indeed invalid json
check it out manually but i told you
you probably corrupted it
oh no not talking about that
i think the bin shared is just the result of logging to console
i don't understand where's the problem anyways
it does what it's supposed to
is that hell's kitchen
yes lol ive been stuck on a binge
lmao
what is phpmyadmin
Me neither x( sorry qt
message.guild.channels.create('「▶️」youtuber', {type: 'text', permissionOverwrites:[{
id: message.guild.id,
deny: ['READ_MESSAGES']
}]})``` isn't it true? (V12)
wut
...
wdym
Does anyone know of a npm package that can render gifs?
Real time
kinda like canvas with js
message.guild.channels.create('「▶️」youtuber', {type: 'text', permissionOverwrites:[{
id: message.guild.id,
deny: ['READ_MESSAGES']
}]})``` isn't it true? (V12)
It's not giving an error, also not working.
make sure youre using it properly
hi
those symbols more than likely aren't allowed in the text channel names
also it probably throws an error you just arent handling it properly
😋
go to #memes-and-media if you want to chitchat
fuck off to shitpost
@slender thistle deal with
There we go
lmao
@slender thistle how do you deal with these people
@honest perch muted
Nvm lag
bruh dude said "sex"
lmao

If im building a "pet" thingy that storage user data/leveling and other stuff should I use any kind of sql db or I can still using JSON? any experienced dev opinion or tip to storage?
Don't use json
It will corrupt
I suggest using an sql or no sql database like mongo
Local files are generally a bad idea for dynamic data storage
You have to be exceptionally careful to not destroy it along the way
Make weekly backups
i would suggest postgres
Nice, i can now apply my sql knowledges from school
postgres is heavily used in the game industry whenever there's an inventory system, or just in general
imagine having to write sql
this post was made by ORM gang
NoSQL gang can't hear you
sqlite > all
i wanna restrict this command to a role can someone help me
module.exports = {
name: "skip",
aliases: ["s"],
description: "Skip the currently playing song",
execute(message) {
const queue = message.client.queue.get(message.guild.id);
if (!queue)
return message.reply("There is nothing playing that I could skip for you.").catch(console.error);
if (!canModifyQueue(message.member)) return;
queue.playing = true;
queue.connection.dispatcher.end();
queue.textChannel.send(`${message.author} ⏭ skipped the song`).catch(console.error);
}
};
the website is ancient
am i the only one who loves sql? its just nice
check if the message's member has the role
how do i do that, i'm not very good with js sry
message.member.roles.cache.has('role_id')
where does that go
and it needs an if statement right
yeah, so you can put that at the beginning of the function and return if its false.
if message.member.roles.cache.has('role_id')
{
return;
}
```
i have a sinking feeling thats not right
i need to put the role id
ah
sqlite > all
@quartz kindle no
yes
if (message.member.roles.cache.has(!'733777623154557008'))
{
return;
}
no? yes? idk
np
++ doesnt tell errs like vs
(!condition)
if (!message.member.roles.cache.has('733777623154557008'))
{
return;
}
```
should work
all together my code is this
module.exports = {
name: "skip",
aliases: ["s"],
description: "Skip the currently playing song",
execute(message) {
if (!message.member.roles.cache.has('733777623154557008'))
{
return;
}
const queue = message.client.queue.get(message.guild.id);
if (!queue)
return message.reply("There is nothing playing that I could skip for you.").catch(console.error);
if (!canModifyQueue(message.member)) return;
queue.playing = true;
queue.connection.dispatcher.end();
queue.textChannel.send(`${message.author} ⏭ skipped the song`).catch(console.error);
}
};
unless somethings messed up
@solemn latch New question
can i get by role name instead bc this bot is one my server, and a couple of friends
like a "dj" role
like ryhtm
rythem*
i think youd use some in that case.
https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=some
same thing really, but it takes a function, the example kinda shows it.
you can use the .find function to find the role by name
Using the inbuilt search would way cleaner too
how would i use it
saw this in the docs
collection.find(user => user.username === 'Bob');
i assume it works on role names
yeah
A typical bot is self assigned to a bot role when they are invited to a server in the mange role list or? is that the bot creating a role and self assigning.
yep @unreal bluff
discord adds a role to bots when they join
a bot gets a self-assigned role if its invite link contains a defined set of permissions
Do I need to create the check if premission and create the role to assign the bot role auto like most bots?
oh, its only if it has perms, intresting
How do u use collection.find(user => user.username === 'Bob'); on roles
I setup the code but doesnt seem to request or self assign
if your invite link has &permissions=somenumberhere discord will create the role and assign it automatically when it joins
O
@thin tapir message.member.roles.cache is a collection
I just added a database to my bot, what should I use it for? My bot is CommunismBot (not yet approved), and has basic political and fun commands. An economy in the bot wouldn’t make sense, and idk what else a database can be used for
i use databases in cs for warnings / ban / mute logs
for anything that you want to be persistent data
It’s not much of a moderation bot either
MongoDB
used to use a cloud based db until trial ran out
sqlite3 as well (better-sqlite3)
Maybe i could use it to better store information on political ideologies and famous communists because the bot does that too
That would clean up the code a ton
it takes a function
if its static data, its better stored in config files for example
Like a json?
databases are better suited for dynamic data, user-generated data, caches, etc...
yes
databases are better suited for dynamic data, user-generated data, caches, etc...
@quartz kindle true
data that never changes is better suited for json files or similar
like my ban logs
i can do ?bans and it displays why they were banned, when, reason, etc
@quartz kindle is this how u do it
execute(message) {
if (!message.member.roles.cache.find('DJ'))
{
return;
}
.find takes a function
like in your collection example
.find(item => item.something === something)
what do i change
you want the role name right? so check if the name property equals the name you're looking for
and optionally check for case sensitivity
Honestly i know so little abt js, this is an example i found online to kinda see how js ticks
i made my own music bot in cs
for example
ik how to do all of this in cs kek
message.member.roles.cache returns a collection, which is essentially a Map/List/Dict/Object/HashMap
the .find function iterates over the list and compares every single item
so ...roles.find(item => )
the item is the current item being evaluated, in this case, each item is a Role object
the Role object contains a name property, so you're looking if item.name equals someting
therefore ...find(role => role.name === "dj") for example
damn this is alot simpler in cs all i have to do is " [RequireRoles(RoleCheckMode.Any, "dev", "OWNER")] "
but thats a case sensitive lookup, so you need to check for casing
or dj in my case
you can for example normalize the case of the name property before comparing
role.name.toLowerCase()
yes
if your invite link has
&permissions=somenumberherediscord will create the role and assign it automatically when it joins
@quartz kindle #502193464054644737 this
the find function will return the first role that passes the test, if it finds one, otherwise it returns undefined
since a role object is truthy and undefined is falsey, it will work correctly as a condition for the if statement
const permissions = new Permissions(269479104);
var role = message.guild.roles.cache.find(role => role.name.toLowerCase() === "dj");
if(role){}
you mean something like that?
opps
lol
the lowercase
but yes, the lowercase part is correct
cool I actually used that just now as your tips are pretty spot on.
I was forcing a single cap on roles.
o i think i found a bug with the docs
hype
bug hunter
https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=some
the link to some in the github links to every
kek
docs unusable
there was an update to collections a little while ago i believe, i guess the docs werent regenerated so the lines are all off
this is sorting the arrays you need to input proper values.
huh
var blah = discord.reduce((acc, guild) => acc + guild.memberCount, 0);
console.log(blah);
what is the results of this query ?
what is discord supposed to be?
hey tim do you know much about CSP/security
i'm having issues where it just refuses to load anything inline, including script tags, onclick code as well as SVGs inline on the page
ie with svgs on checkboxes
So what is the true request of the array to ?
const { Permissions, Client, MessageAttachment } = require('discord.js');
const bot = new Client();
bot.on('guildMemberAdd', (data) => { /*data.guild.recude(); console.log('what?');*/ });
//?data.guild
what's that http element that adds dotted lines under an element and when you hover it shows a popup
http element?
you mean html/css element? you have any example? i dont really undrstand what you asking for
@sick cloud are you using nginx?
text-decoration: none;
border-bottom: 1px dotted #000;
as a css work around to any html elements.
nope
Tony you mayb asking for tags?
wdym tags
sry titles/tags, that message box that pops on hover things
title thats it, ty
but with css you can do whatever you want talking about popups
and tim
express, and yes i do
<meta http-equiv="Content-Security-Policy" content="default-src *; img-src data: 'unsafe-eval' * 'self' 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval';" />
basically trying everything to allow it all lmao
i got data: working
but i still can't have inline js
<h1 title="Hi">Lorem ipsum</h1>
wdym 
res.set("Content-Security-Policy", "bla")
for example
this is what i have on my nginx Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
you can also try adding 'Access-Control-Allow-Origin' '*'
boys just got updated
it took eight weeks but we did it
verified i mean
woooo
look at that boys
congrats 👏
ty 🥺
it’s at 5 now
uhh maybe continue this in #memes-and-media or #general
(i was referring to the comment about charging your phone, but you're just making things worse now lol)

oof
@astral yoke I did apply 3d ago, when did you apply? like month and a half ago?
i applied june 8 😐
Having an issue using a json API. If I type in a certain football team, the json API will show {"country":"england"} etc, but if I enter an incorrect team, it responds with "Not a valid team". How can I use this to notify the message author?
If condition
If the respond is that do smthing
But the API has over 200 teams
Wait wait wait
So if you put an invqlid team
What is the response?
Invalid team
no the json
Did it return json or just text
Actually, the invalid team text would be the same
can someone tell me how to use cookies in my website using aiohttp ?
OoO
So if (response == "Invalid team") return sorta thing?
Better use ===
Tried that + if (response.body == "Invalid team")
Alright, lemme retry
wdym
hmmm so i made website where the user have to login via discord
and discard adds ?code=123456789 to my original url
i use that code to get the user info like name , id and etc
but it only works in one page
if i go to another page the code disappears and i lose the info
so i tried to store the info in a db but i can't get define that this info belongs to this user
so i asked her before and someone told me to use cookies
so i searched but i didnt get how to do it
@sick cloud sorry to ping
Tried that + if (response.body == "Invalid team")
@earnest phoenix what are you using? fetch or request?
why mention me
@chilly bison Request
k
hayper pinged u soooo i thought u r willing to help
sorry
just use the responsetext
thing
do something like this
if(response == "invalid request"){
//do something
} else {
response = JSON.parse(response);
}
oh sorry
How install dbl on Raspberry Pi via terminal?
Currently downloading the npm thing mentioned in #support
@dusky mason Can you not troll?
Domain is not available
Then don’t help if you don’t know what you’re talking about
bearic is right XD
what is your issue?
uh hello
how do i make it so if message.guild.rulesChannel is null make it say none/not setup ?
i have it like
if (message.guild.rulesChannel == null)
someMessage
if(message.guild.rulesChannel === null){
message.guild.rulesChannel = 'none'
}
i am using that e.e
Uh, does message.guild.rulesChannel have an available set accessor...?
yea
Interesting
So the d.js docs say that's a readonly property
Is rules channel something that is created when making a guild a community guild?
yes
@sharp thicket Since it's readonly, you'll have to keep another variable if you really want something that says "none"
hey there so i have a messageUpdate event which looks like this
public async exec(oldMessage, newMessage) {
try {
let channel = this.client.settings.get(oldMessage.guild.id, "messagelog")
if(channel === null) return;
const embed = new MessageEmbed()
.setColor("RANDOM")
.setTitle(`A message was edited`)
.setDescription(`${oldMessage.author.tag} edited a message in <#${oldMessage.channel.id}>`)
.addField("Old Message", oldMessage.content, true)
.addField("New Message", newMessage.content, true)
// @ts-ignore
this.client.channels.cache.get(channel).send(embed)
} catch (e) {
this.client.logger.error(e)
}
}```
and when i edit a message it sends the embed but i get an error saying messageEmbed field values may not be empty but hows that possible if the fields are filled in with content?
uh
try use name:
wait
@hardy vector here
let Embed = new discord.MessageEmbed()
.setTitle(`Help`)
.setDescription(
`Hey \`${message.author.tag}\` Here are the help commands `
)
.setColor(`RED`)
.setThumbnail(message.author.displayAvatarURL({ dynamic: true, size: 256 }))
.addFields(
{ name: "a!help-moderation", value: `Sends you the moderation commands!`, inline: true },
{ name: "a!help-info", value: `Sends you the information commands!`, inline: true },
{ name: "a!help-fun", value: `Sends you the fun commands!`, inline: true },
{ name: "a!help-utility", value: `Sends you the utility commands!`, inline: true },
);
message.channel.send(Embed);
}}
``` this is how i usually add fields
see i did name: "something" value: "something"
idk but the thing is its sending the embed and showing the oldmessage and new message but i get that error stack
sending an embed also fires the messageUpdate event when Discord renders it. Its responding to its own embed and trying to log its own content
i fixed it
Oh
i added if (oldmessage.author.bot) return
was your bot starting ?
how to self deaf the bot in discord.py ?
I have made a bot through discord developer portal and added it to a server ... But I couldn't understand how to add commands to that can anyone help me please
🙂
see:
@earnest phoenix
Where I could learn this programming knowledge ?/ I mean to say that from where I could get a guide on how to code a bot and add commands to it ?
typically, its expected you know a programming language before you make a bot.
"a programming language" isn't a specific thing, it isn't a "this"
there are many of them, you'd use one which you have the most experience with if there's a wrapper for it
if you don't know any languages my suggestion is not to faceplant straight into bot making but rather learn and get to know the language you're planning to work with
as an alternative you can use those bot makers or simply pay someone else to make the bot for you
Tl;dr Watch a YouTube tutorial, for questions Google it and click on links from StackOverFlow or something that says "discord library" or "docs"
The internet is a public library. Learn something new by searching it.
🤔 youtube tutorials are not a good idea imo
@faint prism
Thanks Dude :)
It's not gonna be easy, and definitely helps to actual learn a programming language you'll be writing the bot program in
docs is now unusable now
how come?~~ i hope that wasnt a joke that went over my head~~
if you click the link that takes you to the github, it takes you to the wrong part
it does it for a lot of stuff on the collection page
oh yeah you right
COMPLETELY unusable
ive been meaning to check another lib but effort
i need to finish my pipeline
and add parsers
but theres some anime i need to catch up
¯_(ツ)_/¯
priorities, i guess
lmao
yeah
also might take a few days off from programming too. then move on to connect 4 or something
ive been meaning to check another lib but effort
@opal plank fall back on making http request directly to the API :^)
ok
@gilded plaza idk that langauge but it looks like it's saying that bot is private and only owner can add it
@gilded plaza you need your email verified to add the bot
oh
Verify Stars?
you need a verified email on your account
lol i speak vietnamese but the main giveaway was the word "email" in the middle
look around your inboxes, spam, updates, etc.
Also, double check you used the correct email
No I Watched It Very Close
So You Can Add For Me The On Bots Essential For A Sever discord
.
go dot elsewhere @edgy sparrow
tried to triage the issue, but it seems to be an upstream issue with babel and how it parses the typescript @solemn latch
don't think its gonna get fixed anytime soon ¯_(ツ)_/¯
idk if this is something i should know or not, but does anyone know how to invite a user when my bot is added to their server? with a few bots i use they have done that bit idk how to do it
You mean inviting the bot owner?
Thats a massive privacy concern. Any bots that you know do this should be reported to mods and discord.
no i mean, when the bot is being invited you go through the usual process and than you get the option to join the support server
i think so, im not to sure
you click to add bot(oauth) then it redirect you to the bots support server after you added it?
yeah
what you want is to generate an oauth link with a redirect uri in it
ok cool ill go have a look at that
Yes
@gilded plaza nó nói là bạn phải verify cái email của bạn
So You Can Add For Me The On Bots Essential For A Sever discord
wut?
Ê người Việt Nam à
VIET NAM
Its near my contry
english here btw
Ê thêm vài con bot được ko
Thêm vài con bot giúp tui được ko
either DM's or #memes-and-media which allows other langs
Ê thêm vài con bot được ko
@gilded plaza i have the same question
You guys speak viet nam I speak Chinese
haha sorry
No
so we can't?
Ê thêm vài con bot được ko
@DoggyEggVN i have the same question
bạn không nói tiếng việt ở đây được, hãy đi qua #memes-and-media nếu muốn nói tiếp
why is it that when i try to use this in a embed desc. it says data is null even tho i declare newData right before it
data is not newData
userID: message.author.id,
}, (err, data) => {
if (err) console.log(err);
if (!data) {
const newData = new Data({
name: message.author.username,
userID: message.author.id,
lb: "all",
money: 200 + reward,
daily: Date.now(),
})
newData.save().catch(err => console.log(err));
embed.setColor("00ff00");
embed.setDescription(`You created a bank account and collected your daily reward of ${reward}. Current balance is ${data.money} ${config.currency}.`)
return message.channel.send(embed);
yes, data is not equal to newData
you're checking for the existence of data; if it doesn't exist, you create a new one called newData, and then proceed to use data, which doesn't exist, at data.money
oh got it thx
also
how do i reload a command if i have mongooseDB connecting to it
it keeps giving me this error when i try to reload it
try {
const newCommand = require(`./${command.name}.js`);
message.client.commands.set(newCommand.name, newCommand);
message.channel.send(`Command \`${command.name}\` was reloaded!`);
} catch (error) {
console.log(error);
message.channel.send(`There was an error while reloading a command \`${command.name}\`:\n\`${error.message}\``);
}```
It doesn't look like the error is coming from there
Also that's not how it's done, you need to remove the file from the require cache before you require the command file again
How can I make an API JSON query in discord.js?
How to get server count for my bot ? Help me.
wdym
client.guilds.cache.size
if ("message.author.id" === "554185890453389322") return message.reply("I m sorry but this is a owner only command")
everyone can use this command
why
@weak rain you can't use the command yourself right
i can
@weak rain
You should use !=
That is plain text
To check if the user id is NOT the owner id
^this too






