#development
1 messages · Page 900 of 1
What library?
What language? What library? What are you doing?
discord.js
Hello, I registered my bot to DBL, but I want my bot not to stay in this server (This server consumes my bot's performance a lot) Is it possible to request mod to remove my from this server but not in DBL webpage?
yes
Yeah DM a mod
you can make it leave yourself
or eval
or that too ^^
anyone know why my bot is showing offline here but online everywhere else (i only have one shard)
there is no new guildCreate
Oh then make my bot leave here doesn't matter at all?
its the same as the old
its not working for me
nope doesnt matter
the only thing is that your bot will not show online in the top.gg website
thanks
i want to make my bot so when someone votes it knows who voted and can give coins to them
it works but gives an error
owner might not be cached
cos ik a bots that do that
bot.users.fetch(guild.ownerID).then(owner => owner.send())
guild.cache.owner.send?
no
bot.on("guildCreate", guild => {
bot.users.fetch(guild.ownerID).then(owner => owner.send("hi"))
});
like that?
yes
i want to make my bot so when someone votes it knows who voted and can give coins to them
@quartz kindle doesnt work
nvm it does
im just like on 21438192481294812831238 ping
can you help me please :
@bot.event
async def on_member_unban(user, guild):
embed = discord.Embed(title=f"**__{user.guild.name}__ à été debanni du serveur**", description=f"Information du membre banni : ", color=65280)
embed.add_field(name="``nom``", value=f"{user.guild.name}")
embed.add_field(name="``Compte créer le``", value=f"{user.guild.created_at}")
await discord.utils.get(user.guild.text_channels, name='📜pee1-logs📜').send(embed=embed)
@earnest phoenix um
you're asking for help but you didnt say what you need help with
is there a help channel?
regarding what
@zinc condor 4. No self promotion / advertising
@rustic jewel first of all, please refer to https://discordpy.readthedocs.io/en/latest/api.html#discord.on_member_unban for future reference with that event
you confused the arguments
also please state what your issue is next time as we are not mindreaders to know what errors you get
just trying to keep ya out of trouble 🙂
I can help you guys with python
@rustic jewel what do you need help with? you can't just drop a chunk of code and expect people to instantly try to help you, I didn't even read the code bc of the way you asked
Also how does User.guild make sense to you
you need to ask your question
AFAIK is member, guild
if they're kwargs
Guild, user
iirc
And? I don't see any errors in this code
I see plenty of errors
I know the diff shiv
my point was: the name doesn't matter as long as you know exactly what each argument is
true
but guild_object.guild doesn't make sense
nice
never heard of a country called android @stoic shard
aye no shitposting in this channel lads
what
hi, why am i getting Cannot read property 'edit' of undefined when i used the same resolver for my whois command?
code: wuser.edit({ nick: args.join(' ') });
show what wuser is.
and when i log wuser it doesn't log
the issue can't be with it because i just tested my whois command and theres no issue with it
its the same resolver
okay but can you show what wuser is
let wuser = members.find((m) => m.mention.replace('!', '') === query.replace('!', '') ||
`${m.username}#${m.discriminator}` === query || m.username === query || m.id === query || m.nick === query) || // Exact match for mention, username+discrim, username and user ID
members.find((m) => `${m.username.toLowerCase()}#${m.discriminator}` === query.toLowerCase() || m.username.toLowerCase() === query.toLowerCase() ||m.nick && m.nick.toLowerCase() === query.toLowerCase())
) || // Case insensitive match for username+discrim, username
members.find((m) => m.username.toLowerCase().startsWith(query.toLowerCase()) || (m.nick && m.nick.toLowerCase().startsWith(query.toLowerCase()));```
so the user could not be found? I assume this is Eris?
query is your user-input I assume. Can you show what that is? Maybe the user you searched for could not be found/cache/etc.
let query = args.join(' ')
I just assume the user could not be found. Are you sure the user is cached and is in the server/your input is correct
It's messy but it looks correct
yes
the user is cached because i cache all users
oh, i think i know why
because query is args.join
not args[0]
bc its a nick command
ok, er, my bot has admin, but its saying its missing perms
if query is args.join(" "), why is nick supposed to be set to the same input you used to find the member?
I can't even test it as I seem to get a syntax error.
Hey. When my bot gets this guild (client.guilds.cache.get(IdOfThisGuild)) it gives an object without name and available = false. What's wrong?
ohw thanks
Hey, how can I load all users immediately?
I use now Client.users.cache.size
should solve the error then 😅
available is only false when your bot doesn't have access to the guild due to an outage
nothing we can do
we have to wait for discord to work
haksui, cache all users
yeah if you cache all users your memory will just die
there's 100k users here
caching all will not be good for the system
not if ur using eris 
that's for any program
just because eris is better than discord.js in its memory doesn't mean it'll be a good idea
using a different library will not be any better for caching 100k users at startup
i cache all users and everything works fine
and your bot doesnt have 100k users on it from this server
Yeah but... why would it break?
it will use more memory, not break
How to mark spoiler in bot text?
same way you would with sending one?
like|| this||
You do it like normal: ||text here||
embed.addField
How you enter the giveaway
Hey I want codes like that if someone used that command he cannot use it for next 12 hours
does someone here know how to deal with oauth2?
how do you style your bots description
cos it says html and markdown allowed
and other bots have a cool design
so how do i do it
can someone tell me cos instead of helping some mod is saying "inspect element"
<styles>
YOUR CSS HERE
</styles>
Hey I want codes like that if someone used that command he cannot use it for next 12 hours
Please help me out
<style>
h1 {
color: blue;
}
</style>
Meme
_meme
_coronameme
_cursedimage
_wholesome
_joke
_cnjoke
Moderation
_kick
_ban
_report (person) (reason)
Cubing
_cubing, sends a random image from r/cubers
_3 generates a random 3x3 scramble
_4 generates a 4x4 scramble
_2 generates a 2x2 scramble
Miscellaneous
_stats, gets the stats of server
_stats @mentionpersonhere, gets stats of a person
_ping
Economy
Gambling
_coinflip (prediction) (amountgambling)
_dice (prediction) (amount gambling)
_slots (amount)
Money
_work, lets you work
_daily, gets you 100 coins every day
_transfer (person) (amount), transfers money
_stonks, try investing in stonks
_lb, checks the leaderboard
_bal, check your balance
_beg, beg if you are really desperate
_pm, lets you post a meme
_scout, lets you search for money if you're desperate
Minecraft
_mc (server ip) (server port)
More Help
For more information on certain commands do _help (Name of command category), ex: _help Economy
styles or style
does this work
jeez that's a big description you decided to paste here
@surreal notch you gotta give more info.
what language are you using?
do you have a database?
why?
but tbf if you only want to change the description's color...
can you also change background color?
does anyone here know how to deal with oauth2?
I'm stuck in the legendary "invalid_grant" error
iirc it's .long-description #content except I don't remember if the content was a class or an ID
store users in a database, and whenever someone uses that command just query the user with SELECT timestamp FROM Users WHERE id = :id
first of all you'll need to create a sqlite.db file
@lyric mountain actually i am new to coding means 3-4 weeks
I imagine those 12 hours cooldown is meant for votes, right?
Nope for votes but normally
so how can i create a database
now do npm install sqlite3
in that file?
no
@nocturne grove the second condition that you passed to me earlier does not work with d.js 11.5.1 you can tell me how I can do it (because I'm not on d.js 12.xx but 11.5. 1)
in your command line
just create a JSON file 
should i add a package?
wait, image still loading
just create a JSON file
@pale vessel better not make them start the wrong way
have you installed sqlite3?
should i add a package of npm install sqlite3
?
like, how are you starting you bot?
idk how to add packages on glitch, but I guess you need to add it to the package.json
Ok
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
How can I solve this? discord js
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
How can I solve this? discord js
@quartz hill optimize your code
@woven sundial ik that
no
hi
how can i send a message to a user with eris
when i do ```js
let dm = client.getDMChannel(message.author.id).then((e) => e.id);
client.createMessage(dm, 'hi');
Have you googled it @woven sundial
I mean I found this after googling "Javascript Timezone"
@digital ibex it's not asynchronous
you're supposed to put that inside .then
or use await, easier
so
let dm = await client.getDMChannel(message.author.id);
let o = dm.id;
client.createMessage(o, 'hi');
you can do dm.createMessage if you put it inside .then
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
@woven sundial
that works too
so, dm.createMessage('hi);
yes
ok, thank u
no need for o
dm.createMessage is not a function
let me see your code
let dm = client.getDMChannel(message.author.id).then((e) => e.id);
client.createMessage(dm, 'hi');```
yes
the reason y i'm using .then is bc i'm evallign it
ok
let dm = client.getDMChannel(message.author.id).then((e) => e.id); // <-- inside here
client.createMessage(dm, 'hi'); // not here```
so e.createMessage
client.getDMChannel(message.author.id).then((e) => e.createMessaege('hi');
or client.createMessage(e.id
yes
kk, thank
@nocturne grove the second condition that you passed to me earlier does not work with d.js 11.5.1 you can tell me how I can do it (because I'm not on d.js 12.xx but 11.5. 1)
@cobalt mesa remove the '.cache' and it will work
@earnest phoenix
can anyone help me with a random user command, it just stopped working
discord.js v12
show what you did
@nocturne grove ok thanks and if the server isn't in the cache how do i do ??
need help importing my play command (ytdl) from my old bot file to its own command file
var server = servers[message.guild.id];
const channel = message.member.voiceChannel; {
server.dispatcher = connection.play(
ytdl(server.queue[0], {
filter: "audioonly"
})
);
}
server.queue.shift();
server.dispatcher.on("finish", function () {
play(connection, message);
if (server.queue[0]) {} else {
connection.disconnect();
message.channel.send('Bye Bye :sc2:')
}
});
}
if (!args[1]) {
message.channel.send("send link pwease :sc1:");
return;
}
if (!message.member.voice.channel) {
message.channel.send(
"Pwease go in da channel :sc1:"
);
return;
}
if (!servers[message.guild.id])
servers[message.guild.id] = {
queue: []
};
var server = servers[message.guild.id];
server.queue.push(args[1]);
if (!message.guild.voiceConnection)
message.member.voice.channel.join().then(function (connection) {
play(connection, message); {
message.channel.send("Playing :sc1:");
}
});```
@nocturne grove ok thanks and if the server isn't in the cache how do i do ??
@cobalt mesa I guess all servers are in the cache. Never thought about something like that
@earnest phoenix sorry I don't have knowledge of music things
ah ok
its all good
how do i send a message to two channels in one commands discord.js v12
@proper mist do you know which channels?
?
possibly channel id?
@proper mist if you have something you want to send, just do:
channel1.send(message);
channel2.send(message);
that's very obvious, I know. But I can't make it any harder to do
if (message.channel.id == 702161547421810824) {
if (cmd == "hey") {
message.channel.send("All Works!");
} else {
message.delete(1000);
}
}
Why he do not delete the message?
In discord.js v12.2.0 how can i use invite to fetch information from an invite code?
@woven sundial This does not work too!
In discord.js v12.2.0 what is message.guild.channels.forEach's equivalent
can anyone validate the following line? execute(async, args, message, channel, server) {
Loudy it's in the docs: channels.cache.forEach
IF6 did you test it.
If you did you should get a syntax error.
if (message.channel.id == "702161547421810824") {
if (cmd == "hey") {
message.channel.send("All Works!");
} else {
message.delete(1000);
}
}
Why he do not delete the message?
no I can;t because vsc gives back
okay so click on that and it'll tell you where you messed up on your syntax. async is a keyword in javascript and can't be used like that.
If you want to dub a function as async, it must be before the function name.
@woven sundial v12
so i'm trying to reset my server and delete all the channels
I have this
client.on('message', message =>{
if(message.author.id == "my id") {
if(message.content === "/bye") {
channels.cache.forEach(channel => channel.delete())
}
}
})
i have this
@woven sundial There is not error, but it did not delete the message
it says that channels is not define
Fetch invite to get basic guild data?
Yes
@woven sundial Yes
how do i define channels
where in the docs does it tell you how to define channels
Use fetchInvite (https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=fetchInvite). You'll have a limited amount of data around the guild.
@woven sundial I tried yours but I do not work
In v11, you could pass the time as the first argument. In v12, you need to pass an object with timeout being the milliseconds before the message is deleted. If your error is something else (like you said, channels isn't defined), that code snippet is not the issue.
it says message is not defined
I'm on v12
if (message.channel.id == "702161547421810824") {
if (cmd == "hey") {
message.channel.send("All Works!");
} else {
message.delete();
}
}
setTimeout(() => {
},1*1)
}
}
would this work
if (message.channel.id == "702161547421810824") {
if (cmd == "hey") {
message.channel.send("All Works!");
} else {
message.delete();
}
}
setTimeout(() => {
},1*1)
}
}
what is the timeout for
if (message.channel.id == "705477023061245957") {
if (cmd == "hey") {
message.channel.send("All Works!");
} else {
message.delete();
}
}
setTimeout(() => {
.then(console.log)
.catch(console.error);
},1*1)
}
}
When I create a new client and login, the ready event is never emitted. I'm pretty sure this has something to do with the outage that happened earlier, as it started to not work when that happened.
There are no errors
And I use discord.js
Does anyone have any ideas?
Or am I literally the only person who has had this happen during this outage?
alright imma cool it on message. why does send come up as undefined
channel.send('<content>');```
how would I make this an
add a : right after execute
thank you
how do i make a command that deletes all channels in a server
i hope you're not nuking/destroying servers
im notd
loop over all channels and delete each of them
use a for loop with async await to avoid rate limits
how ;c @quartz kindle
channel.delete()
.then(console.log)
.catch(console.error);
client.on('message', message => {
if(message.content.toLowerCase().startsWith('/delete')) {
channel.delete()
.then(console.log)
.catch(console.error);
}
});
do you know what is a loop?
yes
How can I check if a user has voted in the last 12 hours
do a for of loop on the guild's channels
Not just only 1 user but like anyone
ok nvm i don't knwo
@wide glade you can use the top.gg api
there is an endpoint to get votes
they also have webhooks that notify you when someone votes
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement
Oh ok
yes, read the links i posted above
Hello, there's a guide about filter offline members? 
theres lot of loops, but best ones are for..of and for..in
ok
even tho for in, is like for(let i = 0; i < count; i++)
const arr = [3, 5, 7];
arr.foo = 'hello';
for (let i in arr) {
console.log(i); // logs "0", "1", "2", "foo"
}
for (let i of arr) {
console.log(i); // logs 3, 5, 7
}
yep
so basically, for in gives wheres the object/array located in, example 0 means 3, and for of gives wheres the object/array property.
for..of loop of guild channels.
you don't expect us to spoonfeed you
Hi
I'm watching a video on it
ok
just simply use google, if you have questions or this didn't solve ur problem
never trust any videos. (they're mostly outdated)
ok
when your bot is in 75+ servers
you go to your discord developer page and verify your bot
you will get a dm and email with more info
how do you detect if a message was copied from messages like hello
once in 76 servers
@tired nimbus that doesnt make any sense
If your bot got ip banned would u recieve an email?
even less sense now
the messages are in backticks to detect copy paste
Ah
Probably checks the message.starttyping and the message.created at timestamp
not sure thats a custom functionality they made
AFAIK no lib does that
If your bot got ip banned would u recieve an email?
yep I was right
Error:
(node:1484) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined```
> **Linea de Codigo:**
```js
let cmd = client.comandos.get(command) || client.comandos.find((c) => c.alias.includes(command))```
Con algunas cosas pasa, pero no se el por qué
#memes-and-media for non English
@quartz kindlehow do i check?
idk why but voiceChannel and voice.channel come back undefined
What is it in the portal to develop
anyone used postgresql before, i don't understand why it's saying Sql is not an constructor,
const Sql = require('pg')
const sql = new Sql({
connectionString: process.env.DATABASE_URL,
ssl: true,
});
i'm following this tutorial
the { } is not optional?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
voice.channel and voiceChannel come back undefined
my exact error is UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'voiceChannel' of undefined
@sudden jay this is the discord developer portal
when your bot is in 75+ servers, you go there to verify
the bot needs to be in 75+ guilds to be verified?
does it need to have a website?
no
ah
made a script
but
noooooo idea whatsoever
how to upload them to the bot
@earnest phoenix
you run the script
hey, i'm making a command for making anoucement in every channels that the bot can see, which has a defined name, but i juste know that send messages with a forEach block is against the ToS to limit the raids, but i'm using a map, like this :
bot.channels.findAll('name', "bot-annoucement").map(channel => channel.send(embed))```
Is it fine ? Or is it still against the ToS ?
ps : ping me i don't read every messages 
@hasty lotus .map does the same thing as forEach
It's "against the ToS" because it spams the API. You should set a cooldown.
Wdym?
It's still spam when it's used.
@woven sundial use a for of loop with async await syntax
that way you can create a delayed loop, with a delay on every single iteration
How can I do a command that when you put !join the Bot enters in the channel and it puts a YouTube Playlist?
magic
Yes, but I dont now how.
what language do you know
then you should pick from either discord.js or eris to start off
but if you're a js noob then start with djs since its easier
to an extent
ok so
eris is a js discord lib but with less utilities
I've never done this type of stuff before
sure
I'm good at scripting but,
then why are you tryna do it in js
i usually would script with java but

alright so to create a bot in python you need to run a python program using a discord library
did you install a discord library?
And, can I do this, if you put !join the Bot enters in the channel and plays the music that the Bot has downloaded?
like discord.py
I didn't used eris yet what does it is ?🤔
@woven sundial js library for discord API
Yes
what have you dont so far
because Eris is better overall
eris doesn't use as much memory as discord.js
if you dont mind having a more awkward time
it's not that bad
i barely use d.js utilities anyway
i downloaded discord.py, then i tried to do cd desktop and py -3.5 (the name of my bot).py
The fact that a bot like Luca and a site like tog.gg can have stuff go wrong and go offline makes me worry less when my bot goes offline for no reason
@earnest phoenix did you follow the basic examples provided? what happens when you run it?
well the error says it all
secondly your not in the same directory as ur bot
3.5.3
yeah you cant run a d bot on that
well i don't know how to do that because i actually learned most of my scripting in uh..
Minimum is 3.5.5+
Idk if i should say this but..
and even then recommended 3.6.1+
what
but ill try an updated version
I have this error
Error:
TypeError: Cannot read property 'active' of undefined```
> **Code Line:**
```js
opts.active.get(message.guild.id);```
what is opts
opts is undefined
how to i define it
So
what the fuck do i do
i have all these scripts here
(my english is bad, sorry :c)
Can you show where you defined opts
let fm = opts.active.get(message.guild.id);
@earnest phoenix you figure out how to run them, fix the errors, make it work
that's not where you defined opts
you dont "upload" anything to a bot, the bot itself is the program you create
at most you can upload the program to a hosting or a server you rent or own and run it there
Now that I realize it, I don't have opts defined, but I don't know how to do it either
😕
your bot will only be online as long as the program is running
@earnest phoenix how did you come up with the idea to use opts then? did you copy the code from somewhere?
I made a bot with some friends, and that code must have been put by someone, but nobody says who it was
well you'd need to figure out what the code is supposed to do and correct it or rewrite it accordingly
blindly defining opts without knowing what its actually doing would be a bad idea
The only thing I know is that the code is from the "play" option of a music command
Guys errr....i need help using oauth2, does someone here know something about that?
sadly i do
sad
i still havent realised that im too bad to be making a discord bot
that's a good thing
I have this problem
Cannot read property 'get' of undefined```
```js
let cmd = client.comandos.get(command) || client.comandos.find((c) => c.alias && c.alias.includes(command))```
check if comandos is undefined
are you able to change your client status before its ready?
Are you sure client.commandos is a property.
Tim
are you able to help
me for this
cause i have no definition for this at all
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let command = args.shift().toLowerCase();
let cmd = client.comandos.get(command) || client.comandos.find((c) => c.alias && c.alias.includes(command))
if(cmd) cmd.run(client, message, args, opts);```
I use handler, and the folder where my commands are located is called "comandos"
How do I know if it's defined?
get is undefined
and how can i define it?
which i believe is due to client.comandos being incorrect
I don't want code to run on this server, how can I do? 😄
dont run it on the server
yes.
@rich coral have you got your bot id ?
Idk
I copied it
How do you get message ping
I thought You could code on mobile
no u can't
Oof
prolly can code on mobile but not a bot no
message.createdAt - message.createdAt - message ping
you can code a bot on mobile, its just absurdly complicated, slow and a stupid thing to do
what would shards be used for?
Shards are used to split the gateway connections of bots to help alleviate the load on discords and the hosts end. Also allows the ability to cluster the bot so that it can be run on more than one machine
@delicate zephyr
What's the code that I could use to see the number of my bots shards on eval?
show code
What did I do to cause that ^^^
whats your code?
find wherever u used warn
u cant just post an error and expect us to know the problem
especially with no trace
serverID: message.guild.id,
username: wUser.user.username,
userID: wUser.id,
wUsername: message.author.username,
wUserID: message.author.id,
time: message.createdAt
});
That is where the error is at
apparently the first line
i thought was #memes-and-media sry
dont delete it to make me look stupid
serverID: message.guild.id, username: wUser.user.username, userID: wUser.id, wUsername: message.author.username, wUserID: message.author.id, time: message.createdAt });
@clear wraith you are trying to use "warn" before initialization
try using different names between the variable u want to call and the const
also dont name a var after something else already used
Uh... Ok...
go on ur bot edit page
k
idk if its actually there so
Yes Its there
scrolling and reading helps in anythin online
Go to where you edit your bot, and scroll to the bottom.
For my error ^^^^^^. Would I do a different thing. Like a "let statement"?
For my error ^^^^^^. Would I do a different thing. Like a "let statement"?
@clear wraith yes
just change the name from the const
no u wouldnt
to another thing
Instead of a const
no
serverID: message.guild.id,
username: wUser.user.username,
userID: wUser.id,
wUsername: message.author.username,
wUserID: message.author.id,
time: message.createdAt
});
Like that?
change the name of the variable
or anything else
How do I make my bot go online
host it
im gonna assume you know nothing about bots
Nope
first grow some braincells then learn to code
Lol I’ll try
you can go on codecadamy or sololearn
I’m using this thing
LOL
I used to use that
dont use shit like that
Ok
why do u need a bot anyway
Because I’m bored af
And i want to make a gaming bot
and the Server count posted message isnt being logged
show your code
k
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
i recommend u do js because lots more people can help
i also installed dblapi
does it not have a function to post
no
oh i need to actually post it
i added the server count post
@hardy vector saame here. Thats why im here. How to fix it?
u shouldnt
Im not
This is what it looks like...
ok
lient.on("ready", async () => {
console.log(`I am now online, my name is ${client.user.username}`);
dbl.postStats(client.guilds.cache.size)
let servers = client.guilds.cache.size
client.user.setPresence({
status: "online",
activity: {
name:"In " + `${servers.toString()}` + " Servers" + " /" + "_help",
type: "PLAYING"
}
})
});
console.log(client.users.cache.size)
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
still not working
u used dbl before it was defined
maybe dont just copy paste code
thats good advice
sadly i do
@modest maple it's just a simple question, but what could be the causes of a invalid_grant error?
Like, I have followed the exact example from the docs
But it still give this error
I've checked if my request was being sent correctly with postman
const {TOKEN, PREFIX} = require('./config');
const client = new Client({ disableEveryone: true });
client.on('disconnect', () => console.log('Desconectado, logo mais parça..'));
client.on('reconnecting', () => console.log('Reconectando.'));
client.on('message', async msg => { // eslint-disable-line
if (msg.author.bot) return undefined;
if (!msg.content.startsWith(PREFIX)) return undefined;
const args = msg.content.split(' ');
const searchString = args.slice(1).join(' ');
const url = args[1] ? args[1].replace(/<(.+)>/g, '$1') : '';
const serverQueue = queue.get(msg.guild.id);
let command = msg.content.toLowerCase().split(' ')[0];
command = command.slice(PREFIX+length);
if(command === PREFIX+teste) {
msg.channel.send('Yep!');
}
});
client.login(TOKEN);```
It's correct?

Did not work. kk
so
intents
if you specify an intents object, does it mean that you will only recieve packets for those you specify, or you will not recieve packets for those you specify?
https://hastebin.com/eniqugatus.cs
Please, someone who has used oauth before help this fellow tormented soul
i asked first help me first
jk
yeah idk
you could look at the discord.js repo and see how they did it
This code is the post request I'm sending, which returns invalid_grant.
The post request is being sent finely, but for some reason oauth hates me
if you specify an intents object, does it mean that you will only recieve packets for those you specify, or you will not recieve packets for those you specify?
@grizzled raven yes
@grizzled raven ,
I think you will receive the specified packages kk.
or look at the discord developer documentation
@grizzled raven already done that, did exactly how they are doing
But to no avail, I think I might be missing something really silly
@lyric mountain i looked it up and yeah that does answer my question
although i hate how i cant unsubscribe from presences without losing guild members 😔
Unsubscribing from presences is almost a suicide sentence
The bot simply doesn't boot up in less than 5 min
Due to ratelimit
When your bot starts up it'll cache all the presences
then YEAH
Withou the gateway intent, it'll load EVERYTHING
With the intent it'll lazily load them
One way or another you're getting the presences
im on this https://discordjs.guide/popular-topics/intents.html#enabling-intents and it says that if you specify presences guild members are gone
wait
it could also mean just at startup

say if i input GUILD_PRESENCES, will stuff like message.member be unavailable?
Not at all
The intents just define whether you'll be lazily loading them or caching
At least in jda
TIP
GUILD_PRESENCESis required in order to receive the initial GuildMember data. If you do not supply it your member caches will be empty and not updates, even if you do provideGUILD_MEMBERS! Before you disable intents think about what your bot does and how not receiving the listed events might prevent it from doing this. Version 12 of discord.js does not yet fully support any combination of intents without loosing seemingly unrelated data.
i need tim
You definitely need tim
@tim come here u development camper
RangeError: Maximum call stack size exceeded```
I get this error when I run this code:
```js
const twitter = require("twitter")
class Stream extends twitter {
constructor(client) {
super(client)
this.client = client
}
async run() {
this.client.guildData.find({ feeds: { $exists: true, $not: { $size: 0 } } }, function (err, feeds) {
if (err) throw new Error(err)
const data = new Array()
for (const feed of feeds) {
data.push(feed)
}
console.log(data)
})
}
}
module.exports = Stream;```
https://hastebin.com/eniqugatus.cs
Please, someone who has used oauth before help this fellow tormented soul
Bump
i dont know so i cant help you 😔
sorry to push you up but
nah nvm its too cnfusing
Don't worry, I'll keep bumping in hope of some help
I just don't know if I'm missing some headers
if i opt in for server members intent,
aaaaaaaa
if i dont opt in for server members intent, will i not recieve anything to do with members?
@grizzled raven
anyone know why this happens its coming from node_module discord.js not my coding (node:16440) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions at C:\Users\Cools\discord-dogbot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15 at C:\Users\Cools\discord-dogbot\node_modules\discord.js\node_modules\snekfetch\src\index.js:215:21 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:16440) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:16440) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
you're missing permissions
from like what how
sending messages maybe
it can be anything
your bot just doesn't have permissions to do something it tried to do
like in a server?
does the error message contain anything about what missing permissions?
like this is a totally different question
no thats all the error has
DiscordAPIErrors don't give an accurate traceback
it just keeps repeating it
Laughs in java
if it keeps repeating it's probably that your bot can't send messages somewhere
wait jda actually gives the permission string that missing doesnt it
yeah thats kinda nice
That's a developer thing
you could check for if the bot has permissions to send a message in that channel
could pull request it
Yet it doesn't have a wiki
so when it receives a message, initially check if it can send messages to the author's channel, and if not, ignore it
jda does have a wiki
well it's more like a javadoc
So no wiki
But their javadocs are epic
Last time I've seen such javadoc was in apache utils libs
@valid frigate you were exactly currect
in my 49 servers
if anyone said anything
it would tag them being like "Howdy, prefix is db!"
my server count is about to get to 0
lmao
well then you should definitely change that
but just for redundancy add my suggestion so you don't get those errors in the future
im using discord.js
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]){
case 'unban':
if(!args[1]) message.channel.send('Please put a members username.')
const user = message.mentions.users.first();
if(user){
const memberr = message.guild.member(user)
if(memberr){
memberr.send('You have been banned from Basic Bots.')
memberr.whatdoiputhere(Unbanned by moderative system.').then(() =>{
message.channel.send(`${memberr} has been banned.`)
})
}
}
break;```
what do i put in whatdoiputhere to unban the player
Unban?
You're going to receive the same answer here as you did in the other place you asked.
To unban you need to use message.guild.members.unban(userid)
like this?
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]){
case 'unban':
if(!args[1]) message.channel.send('Please put a members username.')
const user = message.mentions.users.first();
if(user){
const memberr = message.guild.member(user)
if(memberr){
memberr.send('You have been banned from Basic Bots.')
message.guild.members.unban(user.id).then(() =>{
message.channel.send(`${memberr} has been banned.`)
})
}
}
break;
}
})```
You have it inside a check to see if memberr is true, so it wont work, because a banned user will not be a guild member
https://hastebin.com/eniqugatus.cs
Please, someone who has used oauth before help this fellow tormented soul
Bump again
The check isnt necessary
And the if(memberr)
@sick cloud yes please, although its late and im going to bed so i'll ask tomorrow
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]){
case 'unban':
if(!args[1]) message.channel.send('Please put a members username.')
const user = message.mentions.users.first();
{
memberr.send('You have been banned from Basic Bots.')
message.guild.members.unban(user.id).then(() =>{
message.channel.send(`${memberr} has been banned.`)
})
}
}
break;
}
)```
``` break;
^^^^^
SyntaxError: Illegal break statement```
what now
What does the error tell you
look at the error
Yes I read it, did you?
okay
Try it and see.
@grizzled raven ping me when you get up and ask
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]){
case 'unban':
if(!args[1]) message.channel.send('Please put a members username.')
const user = message.mentions.users.first();
{
message.guild.members.unban(user.id).then(() =>{
message.channel.send(`${memberr} has been banned.`)
})
}
}
}
)
^
TypeError: Cannot read property 'id' of undefined```
User is undefined
yes it is
Because your bot can't query that user
what does that mean
Mean that if that user isn't in a server where your bot is in you can't get that user
Since your bot cant see him
ok
But just get the banlist and check for the target id, if it exists just unban it
okay tony
how do i do that though
theres no results
Well, don't you know why YOUR bot is spamming?
Check the code relevant to that command
I have an if (message.author.bot) return; statement
let count = await logs.obtener(oldMessage.guild.id);
//Obtenemos el nombre del canal donde se edito el mensaje
let nameChannel = newMessage.channel.name;
// Obtenemos el nombre del usuario que edito el mensaje
if (oldMessage.author.bot) return;
await snipedit.establecer(newMessage.channel.id, {
"author": newMessage.author.username,
"antes": oldMessage.content,
"despues": newMessage.content
})
let member = newMessage.member.displayName;
const embed = new Discord.RichEmbed()
.setTitle("**MENSAJE EDITADO**")
.setColor(0xff0000)
.setThumbnail(newMessage.author.displayAvatarURL)
.addField('Antes', oldMessage.content)
.addField('Despues', newMessage.content)
.addField('ID del mensaje', newMessage.id)
.addField('Link del mensaje',`[Link](${`https://discordapp.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.id}`})`)
.addField('Nombre del autor', newMessage.author.username)
.addField('ID del autor', newMessage.author.id)
.addField('Mencion del autor', newMessage.author)
.addField('Nombre del canal', oldMessage.channel.name)
.addField('ID del canal', oldMessage.channel.id)
.addField('Mencion del canal', oldMessage.channel)
.setTimestamp()
.setFooter(newMessage.guild.name, newMessage.guild.iconURL);
// enviamos un mensaje de información de la actualización de un emoji en un canal X
client.channels.get(count).send(embed);
});```
The bot say two times!
@earnest phoenix is it doing it twice now? or was it before
Twice
No but is it doing it now
Right now not
Ok the issue is not your code
Oh
Discord has been having a lot of outages today and js bots are known to send messages twice when that happens
What time was that?
It's doing it now?
Do you have another process open of your bot
Like how?
Are you using glitch or something to test
I can't seem to figure this out....
at arbitrate (/rbd/pnpm-volume/3e0e7ff0-a6f9-4413-afc4-43ee427079be/node_modules/.registry.npmjs.org/quick.db/7.1.1/node_modules/quick.db/bin/handler.js:240:6)
at Object.fetch (/rbd/pnpm-volume/3e0e7ff0-a6f9-4413-afc4-43ee427079be/node_modules/.registry.npmjs.org/quick.db/7.1.1/node_modules/quick.db/bin/handler.js:39:12)```
Can someone help me out?
File is not a database
How is it not a database?
I thought db meant database
const Discord = require("discord.js");
exports.run = async (bot, message, args, config) => {
let user = message.mentions.members.first() || message.author;
const db = require("quick.db");
let money = await db.fetch(`money_${user.id}`);
if (money === null) money = 0;
var fs = require("fs");
fs.readFile("./e/cmds.json", "utf8", function(err, contents) {
var c = JSON.parse(contents);
if (c.economy === "0") {
message.channel.send();
} else {
cc();
}
});
function cc() {
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setDescription(`${user}, has $${money}`);
message.channel.send(embed);
name: "bal";
}
};
right?
Why are you doing const db = require("quick.db"); again?
Am i not supposed to?
Don't use js but probably not since it's already defined at the top
And you are trying to set that twice
wait @clear wraith what script engine do you use, since microsoft visual studio doesn't support quick db
microsoft visual studio is a code editor not a package manager which you use to install that
ok
I use glitch.com
Bummer
say what twice?
The event messageUpdate
maybe something in the code
idrk
please elaborate
people advise me to use an if statement to stop bot from spamming, you have to put it outside your message event. the only problem is that you have to define message and I don't have a definite for message
the exact if statement is
if (message.author.bot) return;
discord.js?
yes
bot.on('message', function(message) {
if (message.author.bot) return;
}
thanks, I'll try it
that's where message is coming from
hi why my bot votes decreased ?? In the morning it was 25 and now 2 :/
didn't work unfortunately
perhaps you could make it real explicit
bot.on('message', function(message) {
if (!message.author.bot) {
// code here
}
}```
heyo, just wondering what people use for a database
i use sqlite rn but im thinking of going with mongo or maybe redis, want it to be speedy but still scalable
o rip
i think mlab sandboxes are free
those are cloud vms
yes
u sure that'd work as a db?
a vps?
yh
i mean, i dont see why it wouldn't
its just a server
i can deploy docker images to them
yea mongo and redis both work fine in docker
as would any other type of db id assume lol
just wondering if using just redis as a db is a good idea
@earnest phoenix how did you do it?
or if i should use both redis and mongo
with redis caching stuff the bot accesses frequently, like prefixes
did you literally copy and paste the entire code block into your code, hoping it'll work or you actually tried something
