#development
1 messages ยท Page 974 of 1
It's not exactly necessary
just... easier to navigate between files
I don't see why you would need anything advanced to load extensions really. Hell, even I do it like that
Is your bot public
One was and I loaded extensions the same way
am confused how do u specify bucket type
is it type = BucketType.user?
in discord.py
How do you import BucketType
ok so, does anyone knows how to avoid Youtube API quota exceeded?
tried submitting a form to increase my quota but everytime i try, it says "Try again" or somethin like that and wont let me submit it xd
For music command ofc
or anything else i can use for playing musics?
hello
hey
const Discord = require('discord.js');
const bot = new Discord.Client();
module.exports = {
name: 'servers',
description: "displays all the servers of the bot, for owner's use only",
execute: (message, args) => {
message.channel.send(`Serving ${bot.guilds.size} servers: `);
message.channel.send(bot.guilds.map(g => g.name).join("\n"));
}
}
so this is my command
hmm? it will be gud is you elongate the problem with errors and all @shy turret
bot.guilds.cache.size @vale garden
and it says bot.guilds.map isnt a function
lol
what about the bot.guilds.map
what do i do
d.js v12?
@earnest phoenix i was debugging it and console.log("this works"), but then "Bot is ready!" doesn't display, so that means the bot isnt logging in
bot.guilds.cache.map(...)
kk thx
console.log() the msg
above
message.channel.send(bot.guilds.map(g => g.name).join("\n"));
add
console.log("Debuging: " + bot.guilds.map(g => g.name).join("\n"));
try running the same thing and check the console
my best guess is that the variable's empty
@vale garden
ok
I'm gonna get so mad if my alpha ver of my discord bot turns on but stable doesnt WTF
ok
im trying to render something in blender, is anyone here good with it?
@vale garden put return before message.channel.send temp so the error doesnt run
I also recommend adding try {} catch(err) {}
discord hates my bot...
Discord: Invalid token, I know...
Discord: If token's discord user id is not 716102473718169680, works
Discord: My bot token, FU USE ANOTHER ONE OF YOUR BOTS
I'm not even kidding... I tried regenerating my bot token
how to pass a glitch project to VSC??
@earnest phoenix theres a glitch extension
i have the extension installed
@earnest phoenix There isn't much you can do without vsc, node and cmder
Although you could use BotGhost you will not be accepted by the moderators.
@misty sigil modified versions are allowed
as there are a couple botghost bots on top.gg
ah, ty
you could use botghost
aslong as it's modified
Cool, you're hosting on glitch right?
Ctrl + Shift + P
install glitch extension first
what lib
are you using intents?
How to send and edit messages outside loop
const broadcast = client.voice.createBroadcast();
const channelId = message.member.voice.channel.id;
const channel = client.channels.cache.get(channelId);
channel.join().then(connection => {
broadcast.play(discordTTS.getVoiceStream(args.join(' ')));
const dispatcher = connection.play(broadcast);
dispatcher.on('finish', () => channel.leave());
})``` anyone know why the client doesn't leave?
isn't it channel.disconnect() ? 
lemme check docs
@earnest phoenix try connection.disconnect()
https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=disconnect
i have already
https://nmw03.is-inside.me/oKndhSTJ.png
try connection.disconnect() instead of channel.leave()
yes i have already

not sure if this here is the right place, a question, is it possible for other people to know my name/address if they whois my url?
Could you please elaborate on the "outside loop" part?
@earnest phoenix it is a .dev url
I have did it and there are no information about me, but I am sure there are people who know better than I do, how to use whoami tools
i have a problem witha bot i made. I enabled the partial messages in the client, but if i delete a message that is partial and if i ty to fetch it i get a DiscordAPIError: Unknow Message error. How can i fix it?
@midnight blaze you most likely had a guard on so don't worry
here is mah code
ald i also made this https://cdn.lumap.me/a6ofd6tm.png but the bot randomly sends this https://cdn.lumap.me/m9jwihg4.png
ok
does anyone here use Tiktok Scraper?
Could you please elaborate on the "outside loop" part?
@slender thistle ? Didn't understood what r u telling
what do you mean by "outside loop"?
i'm using puppeteer and i want to zoom out from the page (ctrl + minus) because by default the image is too big, how can i do that ? i tried the .setViewport({deviceScaleFactor:0.5}) option but nothing changes :/
and then take a screenshot but thats ok
because it just zooms out the page and not the element
idk if you understand me :/
@tight plinth pretty sure you cant fetch deleted messages
oof
i'm using puppeteer and i want to zoom out from the page (ctrl + minus) because by default the image is too big, how can i do that ? i tried the .setViewport({deviceScaleFactor:0.5}) option but nothing changes :/
nvm fixed it i'm too dumb
just had to change the image size
smh
@tight plinth and your message update event is probably logging embed updates
hence why new content is empty
Someone help me to see the servers where my bot is?
I am trying to edit a voice channel every 60s using d.js - v12
bot.on('ready', () => {
const times = {
"1": "๐",
"2": "๐",
"3": "๐",
"4": "๐",
"5": "๐",
"6": "๐",
"7": "๐",
"8": "๐",
"9": "๐",
"10": "๐",
"11": "๐",
"12": "๐"
}
var time = bot.guilds.cache.get(`611881570202025986`).channels.cache.get("706504532854833172");
time.setName(`${times[String(moment().format('LT')).charAt(0)]}Server Time: ${moment().format('LT')}`).then((vc) => {
setInterval(function() {
vc.setName(`${times[String(moment().format('LT')).charAt(0)]}Server Time: ${moment().format('LT')}`);
}, 60000 )
});
});
But it doesnt do it well and no errors
editing channel name/description can only be done 2 times per 10 minutes
Its a new thing now?
yes
@heavy marsh
from the discord developers server, also reposted in #discord-news (<#discord-news message>)
OOh thank you
I'm having this issue: https://gyazo.com/20543a5d18e810b76cfdd2c70486e14a
This is the code: https://sourceb.in/57ccd15753
Anyone have any idea why it's showing minus?
Hey! So I want to use this module for my bot. I read over the documentation and never really understood how to use it
Is there a certain way to read the docs or ?
what module
My bot opening very late. When I try it with another token, it opens instantly but my bot opening very late. It has 810 servers.
Discord.js: v12
bruh
what module
@honest perch Tiktok Scraper
Was wondering how long it's gonna take to verify my bot. I didn't receive any updates for 1.5 weeks I think.
2-3weeks
Thanks
Uhm, so I noticed that my bot responds to 'please help' while it isn't suppose to. Is there an way I can fix this?
let args = message.content.substring(PREFIX.length).split(" ");
switch(args[0]) {
case 'help':
const Embed = new Discord.MessageEmbed()
.setTitle('Helper Embed')
.setColor(0xFF0000)
.setDescription('Current commands available: help, command-info picture, user-info, meme, play (youtube link), skip, stop')
.addField("Learn more?", 'You can type command-info to know more what every command does!');
message.author.send(Embed);
break;```
'Beaver'
oh oki thanks @haughty night
Np
and anonymous guy xD
Np
message.startWith.substring(PREFIX.length).split(" ")
Does it need to be that then?
or does the substring also need to go away?
if (!message.content.startsWith(PREFIX)) return;
try this
Np lol
that didnt happen-
stop sending so many requests
๐คฃ
You should send negative request then
can someone help me?
My bot opening very late. When I try it with another token, it opens instantly but my bot opening very late. It has 810 servers.
Discord.js: v12
maybe its because of all the servers its in?
are you loading some sort of server list?
if (!message.content.startsWith(PREFIX)) return;
@ancient lichen this gave me an error,
2020-06-15T17:26:17.897869+00:00 app[Worker.1]: switch(args[0]) {
2020-06-15T17:26:17.897870+00:00 app[Worker.1]: ^
2020-06-15T17:26:17.897870+00:00 app[Worker.1]:
2020-06-15T17:26:17.897871+00:00 app[Worker.1]: ReferenceError: args is not defined
oof k
The .first() is in the old versions
@feral aspen what are you trying to do?
?
I want to make this either a!bal <username>
so whats the new one for .fist()
*.first()
oh god, welp i cant help with that since i only know lua xd
Please help guys.
lol
array[0]?
k
Before.. it used to be .first() remember?
var user = message.author;
} else {
var user = message.mentions.user.first() || bot.users.cache.get(args[0]);
}```
so you need the id of the tagged person right?
so I dont want it only viewing my balance
Look..
Im creating a money system.
When I do a!bal.. it shows my balance.
Now when I make a!bal <user.id>, it says cannot read property .first() cause Im in v12
so How can I make it from .first() to new version?
message.mentions.users.first() bear in mind this is a user property not a member property
for a mention ^
how can i make a bassboost cmd with erela.js
check their docs
@feral aspen for id message.guild.members.cache.get(args[0])
maybe its because of all the servers its in?
@jaunty junco how can i fix it?
are you loading some sort of server list?
@ancient lichen if you are talking about me, no. I am using eval command
im just pointing out a possible problem
still works in v12
Its literaly saying cannot read property of first
instead of users change it to members
and that doesn't mean it doesn't work in v12
Ill try something one sec.
yeah yeah
@earnest phoenix on second thoughts, it might be that the bot is running out of memory, or the host is running out of memory.
Are there any rust libraries for discord bot development?
Ah okay, thanks :)
I've started learning rust language so thought of doing some practice by building a bot maybe
in discord.js how do you check if the person exucting a command is a bot. I cant find it in the docs? would
if(message.author.bot) return ```
work?
yes
ok tysm
doesnt matter really lol
Your bot needs to be on at least 75 servers to get certified bot dev tag or are there any other requirements for that?
check their docs
@earnest phoenix theres nothing on erela docs for bassboot
oh I thought he meant Discord Dev
Using eval, how can i identify how many bots are in a server i specify.
discord.js v12.2
Oh okay
@earnest phoenix theres nothing on erela docs for bassboot
@hardy vector equalizer
although i believe the certification program is on hiatus
or at least people have been waiting over 3 months for a response lol
Hey auric.. thanks a lot for the help as it worked!
which one
Hey auric.. thanks a lot for the help as it worked!
@feral aspen np
@silent berry you need to loop over the cached members of said server and filter out non-bots
but it only works on cached members
I need to refine code of my not first for faster performance XD
so offline/inactive bots wont be counted
ok thanks
how can i center my p tag in my div tag vertically?
Probably what they meant is if you did align-content: center in a flexbox with direction set to row
wait did i misread

@quartz kindle yes
i swear to god the word "center" was not in that sentence when i read it
when i user text-align: center; it has the same space left and right. but i want that it has the same spaces top and left
sry for my bad eng
you can use vertical-align:middle
but it only works with inline-block
and depends on how your css is organized
@slender thistle you could also set direction to column and justify it to the center
Mhm, something Tim taught me sometime ago
Flexbox is heavenly
but I can't figure out one thing
my div contains three elements and they're spaced evenly between
the second div has elements that expand and whenever I expand all and close them, the third div moves up
and then pops back to its original position
they expand vertically or horizontally?
i use this:
position: absolute;
right: 25px;
top: 25px;
border-radius: 10px;
background-color: rgb(255, 166, 0);
color: #fff;
height: 120px;
width: 300px;
}
#warn p {
text-align: center;
vertical-align: middle;
}```
and get this:
#warn is the div
i think i am to bad xD
i mean, if you have fixed height, just use a fixed margin/padding, or just replace the height with padding
@quartz kindle vertically
so it's
nav
body
expandable
expandable
expandable
footer
if I expand all then close them the footer comes up with them then pops back down
and how can i center this? Sry but i am very bad :/
thank you very much ๐
I'm finally making a command handler and I was doing research and fs is required, What is fs?
if you have an object indexed by ids, you can simply check if(object[id])
like if my bot is in multiple servers, I want an admin to be able to access a certain command
so it would be like if(message.author.id === object[id])
fs is node.js's built-in module to work with your local file system, ie: access files and folders, etc...
How to get your bot verified and get yourself verified bot developwr badge
@halcyon ember is this admin unique per server?
admin should be universal
so like a bot admin
so that say my ID was added to the object and I joined another server, I would still be able to access
yea
How can I get the id of the voice channel a user just left? I tried newMember.member.voice.channelID but that shows the ID on joinjing
not local server, if it was local server I could do the roles lol
you can make an array of admins accessible in your files
for example const admins = [id1,id2,id3] at the top of your file
then you check if(admins.includes(message.author.id))
Uhm, so I noticed that my bot responds to 'please help' while it isn't suppose to. Is there an way I can fix this?
let args = message.content.substring(PREFIX.length).split(" ");
switch(args[0]) {
case 'help':
const Embed = new Discord.MessageEmbed()
.setTitle('Helper Embed')
.setColor(0xFF0000)
.setDescription('Current commands available: help, command-info picture, user-info, meme, play (youtube link), skip, stop')
.addField("Learn more?", 'You can type command-info to know more what every command does!');
message.author.send(Embed);
break;```
(I have asked this before but these solutions didn't work: ```if(!message.content.startsWith(PREFIX)) return;``` and ```message.content.startsWith(prefix)```
oh
@earnest phoenix when a user leaves a voice channel, you get an old state and a new state in your voiceStateUpdate event
the old state should contain a channel, while the new one should not have a channel
which means the user left the channel
How can i get the id of the user, set it as the name of the variable, then export the variable to another file? I want to make a level system for my bot like mee6
can i pass oldState through
Plus check if a variable for that person already exists
wdym pass oldState through
I only need the id of the voice channel the user left
@spark breach if(!message.content.startsWith(PREFIX) return; at the top
)
get it from the old voicestate in your voiceStateUpdate event
Like this? Cuz if yes it gives me this error:
2020-06-15T17:26:17.897869+00:00 app[Worker.1]: switch(args[0]) {
2020-06-15T17:26:17.897870+00:00 app[Worker.1]: ^
2020-06-15T17:26:17.897870+00:00 app[Worker.1]:
2020-06-15T17:26:17.897871+00:00 app[Worker.1]: ReferenceError: args is not defined
voiceStateUpdate
module.exports = async (bot, oldMember, newMember) => {
return console.log(oldMember.member.voice.channelID)
then why are you using member?
voiceStateUpdate gives you voiceState objects
not Members
by accessing member, you're acessing the updated voice state, not the old one
I dont understand how i can acces the old voice state
that should be oldMember right
Why my bot give kick permission to everyone @flat obsidian
You need to lock the command to people with only admin perms
@spark breach you don't have any args
thanks king
this was the original i had @prime cliff
your oldMember and newMember are not members, they are voicestates
but when i typed 'please help' that also worked instead of the prefix + help
Add that let args = code bellow your message.content.startsWith
we don't spoonfeed
so like this?
You forgot the prefix check too message.content.startsWith
PREFIX.length
ohhhh
uh no
no-
I have had 5 session invalidations + reIDENTIFYs in the past <24 hours. This isn't something that happens normally for me
anyone else?
guys, what do you prefer you to use, postgresql or sqlite? I know that sqlite is better for small db and postgresql for large, but I don't quite understand what it means exactly
I wanted to use postgresql because I'm hosting on heroku right now, but it has 10k row limit, so game is not worth the candle I guess
PostgreSQL is really good
sqlite won't work on heroku either...
we don't spoonfeed for god's sake
Ok
If you don't know how to code maybe you should learn first instead of trying to do complicated stuff
i'd say keep Postgres because sqlite won't be supported on heroku anyway if you're planning on using it for a while
reaction roles are not an easy thing
Guess you need to learn some more then, tip use add reaction events and per-server data
you need to know how to use a database and many other things
ye
sqlite won't work on heroku either...
@next remnant yeah, I do know, but if postgresql has 10k row limit, I shouldn't stay on heroku and should transfer to some paying vps
you answered your question
Lol
I wanna detect if i react with a certain emoji so my bot edits the message.
For a help command
there are free vps' out there. Free tiers of AWS, GCP, Azure can provide those@ivory fox
you need a paginator
i'd say keep Postgres because sqlite won't be supported on heroku anyway if you're planning on using it for a while
@pale vessel is transfer from one db to another hard? I didn't work with db before and I can't rate the scale
@earnest phoenix if you have a static help menu that's fairly easy just do a list of embed pages and then track for each message that is a help embed
I wanna detect if i react with a certain emoji so my bot edits the message.
@earnest phoenix you could just make a second help command smh
if it's the same type of db then not really
@earnest phoenix what library are you using?
discord-ext-menus is your answer if you're on dpy
there are many ways to use reactions, its not an easy thing either. you can use the reactionAdd event or you can use message.awaitReactions, or a reaction collector
if you're using postgres right now, then you wouldn't need sqlite because postgres is better (imho)
there are free vps' out there. Free tiers of AWS, GCP, Azure can provide those@ivory fox
@next remnant so it doesn't matter what rdbms I'll choose? I missed it
transfering from one database to another is not easy, it often involves reading all rows from one db and writing them to another
if(message.author.bot)
{
if(message.embeds)
{
const embedMsg = message.embeds.find(msg => msg.tittle === 'Choose A Bot');
if(embedMsg)
{
embedMsg.message.react('722072274219434078')
.then(reaction => console.log("Reacted with " + reaction.emoji.name))
.catch(err => console.erros);
}
}
return;
}
if(message.content.tolwerCase() === '$react')
{
message.channel.send('**Click Here To Choose Your Bot!!**')
const embed = new Discord.RichEmbed()
.setTitle("Choose A Bot")
.setDescription(`:soul:*`)
.setColor('GRAY');
message.channel.send(embed)
}
});
client.on('message', message => {
if(message.author.bot)
{
if(message.embeds)
{
const embedMsg = message.embeds.find(msg => msg.tittle === 'Choose A Bot');
if(embedMsg)
{
embedMsg.message.react('722072241621172335')
.then(reaction => console.log("Reacted with " + reaction.emoji.name))
.catch(err => console.erros);
}
}
return;
}
if(message.content.tolwerCase() === '$react')
{
message.channel.send('**Click Here To Choose Your Bot!!**')
const embed = new Discord.RichEmbed()
.setTitle("Choose A Bot")
.setDescription(`:soul:*`)
.setColor('GRAY');
message.channel.send(embed)
}
});
it's good ?
hastebin my dude
tolwerCase() lmao
if(message.author.bot)
pretty sure you meantif (!message.author.bot)
also, message.tittle lmao
get a good ide
Ok
i love my npp
has anyone also experienced this https://canary.discordapp.com/channels/264445053596991498/272764566411149314/722156932219273266 ?
you mean its re-identifying instead of resuming?
yes
which lib?
dpy
could simply be discord craping out
it resumes too
if its inconsistent you can assume its discord's fault
yup
does it use js or how does it work?
@quartz kindle wdym
I'm using react but onclick I add a class to expand it

anyone know why my // line is getting a error
you didn't close your for loop
where do I put the bracket tho at the end it just gives me 800 errors (not really like 4)
or just remove {
figure it out
syntax is so basic that you shouldn't be making a bot if you haven't got that figured out yet
sadly have to agree with this
const onlines = client.guilds.cache.
map(guild =>
guild.members.cache.
filter(member =>
member.presence.status !== 'offline' &&
!member.user.bot &&
client.guilds.cache.
filter(guild =>
guild.members.cache.get(member.user.id)
).size < 2
).size
).reduce((a, b) => a + b)```
Hey! I made this to count the sum of all unique online members accross all guilds the bot is in, do you have any simpler way in mind?
this code seems unhealthy x)
by unique you mean only members that exist in only a single guild?
so a user that is in 2 guilds would not be counted?
yep
you could probably simplify it by using client.users as a starting point
yeah, was my first step, but doesn't a bot only cache a user if it receives a message from it?
same with members
so then the number will be wrong, cause if one doesn't message, he will not be counted right?
messages are not the only things that cache users
presence updates do too
and memberAdd, memberUpdate, userUpdate
oh
je recher un gรฉnรฉrateur d'images random meme
Assuming you have those intents or are < 100 servers
since i use free hosting, i think i can't handle > 100 servers, so it's okay
yeah, was my first step, but doesn't a bot only cache a user if it receives a message from it?
@fiery hill - OrfetchAllMembers: truewith DJS, no?
a free hosting can handle it if done correctly
If I applied and back then I didnโt use partials but now I do.. what do I do?
you mean the verified developer application?
Yes
then they dont care, partials have nothing to do with the api
its just a way discord.js works
they only care if you use GUILD_MEMBERS and GUILD_PRESENCES intents
I use partials for reactions role I was just making sure
aka the privileged intents you need to enable in your developer portal
How long is verification
took 3 weeks for me
Think they're down to 5 days now
If it only took 1 week to get on DBL then it doesnโt really matter for discord
Discord probably has a big coming in
Bit*
ye
I applied on the 9th I think
Ye
Think they're down to 5 days now
@paper phoenix so if that was true itโd have probably been reviewed
m
M??
-bots @earnest phoenix
Wrong channel
sorry
thanks ๐
can someone help for a kick and ban command
hello friends im little suffering to make a bot like pokecord..
discord.js
i need a bit help on How to make auto spawns
And make em catch it
please dm or ping me here and reply
@acoustic kiln use Math.random() to randomly generate a value, then set a threshold and check if that value is above it (like if Math.random() * 100 > 75 then spawn)
note that you'll need a database to store the spawns
thank you
i mean
I wrote it wrongly
just make it if Math.random() > 0.75
yeah, that'd be better
Hello, I'm making a simple logs system for when someone uses a specific command, and, I would like to retrieve the ID of the channel where the command was used. How could I do it? I'm using discord.js :p
This is my current code:
.setDescription(`**!say** command was used by ${message.author.tag} in <#${HereShouldBeTheChannelID}>`)
.setColor('GREEN')
bot.channels.cache.get("433948592433266688").send(logMessage); //The bot will send that embed to the logs channel
}
}
}```
[JDA/Kotlin] I'm having issues trying to return a value from this queue member function for the findUser member function. I want to retrieve a user by their ID, but within the lambda, I can't use return directly. It only allows for return@queue which doesn't seem helpful. I also tried declaring a local variable and assigning it later in the lambda, but it never changed it. Does anyone know how I could get the user from the lambda? kotlin // For the record, I know I'm missing return. This is just to show. open fun findUser(context: CommandContext, userID: String): User? { context.jda.retrieveUserById(userID).queue({ // I need to return `it` (a User instance) as the value from the member function. }) { /* Expected if it wasn't found. */ } }
[JDA/Kotlin] I'm having issues trying to return a value from this queue member function for the
findUsermember function. I want to retrieve a user by their ID, but within the lambda, I can't usereturndirectly. It only allows forreturn@queuewhich doesn't seem helpful. I also tried declaring a local variable and assigning it later in the lambda, but it never changed it. Does anyone know how I could get the user from the lambda?kotlin // For the record, I know I'm missing return. This is just to show. open fun findUser(context: CommandContext, userID: String): User? { context.jda.retrieveUserById(userID).queue({ // I need to return `it` (a User instance) as the value from the member function. }) { /* Expected if it wasn't found. */ } }
@sudden geyser you can't extract a value from a lambda
just do whatever you need to do inside it
In Kotlin they talk about closures and having access to local variables, but yeah it seems I can't do that here. I wanted findUser to just be a helper so would I really to remove it and just do that in my command code (what's shown above is an abstract command class)?
like, you "can" extract a variable from inside a lambda, but it'd be too much work to be worth it
Btw, just tried it and it worked. Thank you so much, @earnest phoenix! ^^
hmm
instead of using .queue() you could use .complete() or .submit()
.queue() is async, so the code inside it 99.9% of the time will run after a certain delay
i need help
the other two will return u the value returned by .retrieveUserById(userID)
when i use the .give command, it says that sum is invalid
so you can handle it without a lambda
idk how to use bot makers, you'll need to be a little patient
someone might appear here to help u
Hey! I'm trying to work with a module but don't know how
is anyone free to help?
How could I get a message's URL? :p
right click message
Bruh, but I mean in the bot's code
your syntax is wrong
self explanatory
@coarse topaz which lib
Discord.js
message.url
<Message>.url
oh, thanks 
I was silly and used message.channel.url x)
๐
channel's url 
i mean, a channel's url is simply the same thing without the message id
just goes to the channel
https://discord.com/channels/server ID/channel ID
discord is a gaymer chat
gay
Anyone know why client is not defined.. I have it defined by here
where is that error happening?
my index.js
31
show full code
how do i make bot change status every 120 second
LIB: djs
scope
use setInterval
const Discord = require("discord.js");
const client = new Discord.Client();
const token = "000000000000000000000000";
const PREFIX = "-";
const ms = require("ms");
const fs = require("fs");
client.commands = new Discord.Collection();
const commandFiles = fs
.readdirSync("./commands")
.filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.login(token);
//client.on("debug", console.log); debugging thing
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}`);
});
/*if(message.author.bot) return - ingores messages from bots
example: if a bot does <ban or <kick ETC the bot will not respond */
client.on("message", (message) => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case "kick":
client.commands.get("kick").execute(message, args);
break;
}
});
maybe u should uncomment message.author.bot
its useful
oh my goodness what is that
hm, looks like copied code
Sks i'm trying to remember it
which line is line 31?
the client.on thing for kick
looks fine, whats the full error?
client.on("message", (message) => {
^
ReferenceError: client is not defined
at Object.execute (C:\Users\Jon\Desktop\Manager Bot\commands\kick.js:6:5)
at Client.<anonymous> (C:\Users\Jon\Desktop\Manager Bot\index.js:36:35) ```
the error is in kick.js line 6
not used to writing in a command handler and accidently forgot to remove a client.on- (copying my bots old code into command handler) im so fricking smart ;-;
so i have it working
but the server status and the user one shows 0 servers and 0 users
statuses or setint
const statuses = [
"with " + client.guilds.cache.size + ' servers | ab!help',
"with the Javascripts",
"with " + client.users.cache.size + "users"
]```
the funny thing is. the status works before that
ooof wouldn't that take
alot of processing stuff
discord.js gang
discord.js gang
@earnest phoenix can you maybe help me . I need a kick and ban command. Pls I need help
Greetings, my bot is on the glitch platform and in some way I don't know why, the modules are wiping / loading itself again without stopping. What can cause this?
Google Translate using.
I do not have a code for the command
What that it
So
Where do I put that
Am new to node.js
Ah
And this code is not working
client.on('message', message => {
if(message.channel.startWith('${prefix}clear'))
if(message.member.roles.some(r=>['ADMIN'].includes(r.name))) {
message.channel.bulkDelete(100).then(() => {
message.channel.send("Delete 100 messages.")
.then (message => {
message.delete(5000);
})
})
}
else {
message.channel.send ("Did you really think you could do that?")
}
return;
})
That the code
It won't work and there is no errors
stupid question, but does the bot have admin perms
or at least the manage_messages perm
Yes
oh
i know
if(message.channel.startWith('${prefix}clear'))
if you want to use ${}, you need to use `` to make your string
not ''
every 10 seconds doesn't count as API abuse right?
if you write '${prefix}clear' and not `${prefix}clear`
Guys oh my god i have 1633 ping
then you'd literally need to write ${prefix}clear for it to work
so, in sum
at line 2
- if(message.channel.startWith('${prefix}clear'))
+ if(message.channel.startWith(`${prefix}clear`))
@north hollow

O ok thx
guys this code i need it to send 2 reactions not 1 but how
var emojiname = ["soul"];
var rolename=["Soul"];
client.on('message', message => {
if(message.content.startsWith(prefix+"reaction3")){
if(!message.channel.guild) return;
for(let n in emojiname){
var emoji =[message.guild.emojis.find(r => r.name == emojiname[n])];
for(let i in emoji){
message.react(emoji[i]);
}
}
}
});
client.on("messageReactionAdd",(reaction,user)=>{
if(!user) return;
if(user.bot)return;
if(!reaction.message.channel.guild) return;
for(let n in emojiname){
if(reaction.emoji.name == emojiname[n]){
let role = reaction.message.guild.roles.find(r => r.name == rolename[n]);
reaction.message.guild.member(user).addRole(role).catch(console.error);
}
}
});```
what is this?
platform
share huge chunks of text without cluttering the chat and filling up everyone's screen
@proven swan so like this
yep
Hi,
discord.py
Please how do we send a webhook ?
A simple python await ctx.send(webhook="https://top.gg/api/widget/705373559299637278.svg") doesn't work ?
Thanks! ๐
<member>.kick&<member>.ban
@earnest phoenix this is all the code for
So that all the code that I need or is there more code
hello I have a problem, someone uses glitch to host it's bot?
@earnest phoenix this is all the code that I need for the kick and ban ```js
<member>.kick or ban
Is that right
Yesn't
What

@mihz0 this is all the code that I need for the kick and ban
<member>.kick or ban
Pretty sure i did it a while ago, but cant remember how. I want a bot to remove a role if someone has another - so if i give someone "moderator" it would remove there "member" role. this is just an example, for the real one i need it to be automatic. Not for my own bot, but more curious if thereโs a main stream bot like dyno or yagpd that does this
status change every 60 second allowed?
could someone help me with the website css to move my avatar image to the centre of the page
Hey guys,
What can I do, when somebody stole my whole Code?
Idk tell them y did you stole my whole code
anyone used git before?
If it is a commercial product you can consult your lawyer about legal action. Otherwise, there is not much to do about it.
thats nice
Okay, thank you. How can I check that this is commetcial? I am not good in English sry
Hey guys,
What can I do, when somebody stole my whole Code?
@radiant estuary don't share it in general
i mean unless its open source and u put it out there
@radiant estuary if you sell it or make money out of it. It is commercial.
then it's really not stolen
[@grizzled raven] i use the gits for everything what u need?
I dont't have it her. The First time it was my mistake. So I did nothing and changed it. I sayd, he is not alles to do this again.
downloading the git client
Maybe this is a proper place to ask. I'm trying to write a bot. When attempting to create a new application it tells me "You need to verify your e-mail in order to perform this action." Although it is already verified (and even has 2FA enabled). Has anyone else encountered this before?
try re-verifying the email
like to an existing repo
I'm sure you could look it up
stuff on github
hey lets dwnload git
how do i commit to my github repo i used to work on
try re-verifying the email
@misty sigil All I've ever found on the subject is using the verify function in my profile. However it is not there because my e-mail is already verified.
There is a good amount of git guides out there, most are for the terminal-based Linux version of git though so I recommend using git bash if you're on Windows which essentially emulates that @grizzled raven
hm
@misty sigil thanks for the help. A relog fixed it xD
typical [@rancid fiber]
Just saying I feel like this is the best use of lambda ever
That one line, it fills me with pride
@radiant estuary is your bot on github
if your bot is oss you should have a license or some sort of clause against it
ie. on public bots i do, i usually follow MIT but extend it
yes [@north hollow ]
Do you know how to make a kick and ban command
it's probably simple
I really need
but im not into mod bots. sorry bout that
And am new to node.js
discord.py, so everytime i write my prefix '<' i get this error even tho that error is for a different cmd
@north hollow What Library?
if your on djs v12 use this https://discord.js.org/#/docs/main/stable/examples/moderation
O use v12.2.0
it would be funny if the d.js site disabled copying
I would live to see how much people will complain
*love
if your on djs v12 use this https://discord.js.org/#/docs/main/stable/examples/moderation
@sick cloud thx you so much
np
can i get help?
And do you know how to make a music bot
music bots are complex
O ok
No there no lol

Hi, I'm making a !say command, and I would like the bot to get the <#ChannelID> of one of the arguments, so it can know where it musts send the message :p
Does this should work? ```if (cmd === say) {
if (!message.content.startsWith("mm!")) return;
if (message.author.bot) return;
let channel = args[1];
let text = args.slice(2).join(" ");
if (!text){
return message.channel.send(Wrong command usage!);
} else {
message.delete()
bot.channels.cache.get(channel).send(text);
}
}
Hey what should i use for rest api mongodb or firebase
I know both of โem
Kinda
I do know mongo fully but yea still
does your api need to store data
hi, is it ok if i ask a question about github and its webhook system thingy here?
Yes
never used firebase but mongo scales well
Okay for example i need to save data of contries
Like contry id lat, long and stuff
use mongo, thats what i use for my api and bot. never used firebase because i've never had to use it
like a host?
just mongodb?
wym?
The web ui is kinda ugly
im confused, whats ur question again?
@sick cloud I just modified it and it just deletes my message, but it doesn't send the content to the channel I said if (cmd === `say1`) { if (!message.content.startsWith("mm!")) return; if(message.author.bot) return; let channel = args[0]; let text = args.slice(1).join(" "); if (!text){ return message.channel.send(`Wrong command usage!`); } else { message.delete() bot.channels.cache.get(channel).send(text); } }
like what do u mean by it
same
there's no web ui or shit
The ui you look at in website of mongo atlas
u don't need to worry about atlas too much, all u need from it is just the url
Why is it saying add is not defined?js const user = message.mentions.users.first(); user.roles.add(await message.guild.roles.cache.find(role => role.name === "Muted"))
unless ur bot is quite big
do any of you use typescript also
@earnest phoenix users don't have roles, members do
ok cool could you help me with a small error
sure
ok
in built in modules i get this error
i don't think i can help much lol, ur got the certified dev role ๐
@earnest phoenix Use member.roles.add() instead ๐
@coarse topaz no, he's trying to use a mentioned user
but hes using user
not member
<message>.mentions.members.first
Oh alright
r u using strict mode tonybo?
er i think so
hm
i really don't use typescript much lol
like in that file ur editing, do u have 'use-strict' ?
show code
er
no not in the file @digital ibex
ts conf has "strict": true,
lol ts conf has errors also
hmm
Anyone know why my warn thing isnt working?js et user = message.mentions.users.first(); if (!user) { message.channel.send(`You did not mention a user!`); return; } if (!args.slice(1).join(" ")) { message.channel.send(`You did not specify a reason!`); return; } warns.findOne( { Guild: message.guild.id, User: user.id }, async (err, data) => { if (err) console.log(err); if (!data) { let newWarns = new warns({ User: user.id, Guild: message.guild.id, Warns: [ { Moderator: message.author.id, Reason: args.slice(1).join(" ") } ] }); newWarns.save(); message.channel.send( `${user.tag} has been warned with the reason of ${args .slice(1) .join(" ")}. They now have 1 warn.` ); } else { data.Warns.unshift({ Moderator: message.author.id, Reason: args.slice(1).join(" ") }); data.save(); message.channel.send( `${user.tag} has been warned with the reason of ${args .slice(1) .join(" ")}. They now have ${data.Warns.length} warns.` ); } } );
Ping me if u know whats wrong
that's it
im not sure if this will change anything, but in the ts file, add 'use-strict' i don't think it will since u've already enabled it but shrug
ThatTonybo by and chance should module: "commonjs" be CommonJS?
eh nvm doesn't look like it makes a difference
``${user.tag} has been warned with the reason of ${args`
u forgot the }
wait dw i read it wrong
what error
^^
then your bot is broken else where
we don't know your code. you need to show it
is it erroring?
okay
that i have warned the user
lets get on the same page here, what have you already tried?
I tried !warn @ user#1111
no i mean, what debugging have u already done?
+ client.users.cache.get('123456789012345678');```
Ok so all my friends use v11 atm, they do client.users.get('id') to grab the users information but i cant seem to get the v12 way of doing it working:( anyone got any ideas?
client.users.cache.get
returns undefined every time or Cannot read property of undefined
Yo anyone using .py And Can help me?
@gaunt sand for some reason v12 is just messed up so i switched to python
well i learnt python in 2 days

I added console.logs for each and every function,
so where does it break
idk
lol

lemme check again
the best thing about .py is you don't need to add ```.js {[
]} ```
isnt even going after |```js
warns.findOne(
@earnest phoenix give this a read: https://docs.microsoft.com/en-us/visualstudio/debugger/debugging-absolute-beginners?view=vs-2019
right ok
Im using glitch :p
still debugging lol
if (!args.slice(1).join(" ")) {
message.channel.send(`You did not specify a reason!`);
return;
}``` theres ur issue
ik
if (!args.slice(1).join(" ")) {
return message.channel.send(`You did not specify a reason!`);
}```
ok
Migrating from v11-v12 docs:
- client.users.get('123456789012345678');
+ client.users.cache.get('123456789012345678');```
Ok so all my friends use v11 atm, they do client.users.get('id') to grab the users information but i cant seem to get the v12 way of doing it working:( anyone got any ideas? client.user.cache.get returns undefined every time or Cannot read property of undefined
you've already been answered
did u not see my response
client.user.cache.get returns undefined every time or Cannot read property of undefined
because thats not what he said
what
Could someone please help me with this? The command usage should be mm!say1 #channel content So the bot would find at the channels of the server and get the ID from the one I #mentioned... However it isn't working right now, it just deletes my message, but doesn't send the message :p````if (cmd === say1) {
if (!message.content.startsWith("mm!")) return;
if(message.author.bot) return;
let args1 = message.content.split(" ");
let channel = args1[1];
let text = args1.slice(2).join(" ");
if (!text){
return message.channel.send(Wrong command usage!);
} else {
message.delete()
bot.channels.cache.get(channel).send(text);
}
}```
look at what you sent and what he sent
I used my eval and got illegal return
@digital ibex he didnt even respond after i said that
i did
where
ok just be arrogant then
@coarse topaz because the argument isn't a channel object, it's a string, specifically a mention
you need to extract the id out of the mention
Didn't I do it with this line? bot.channels.cache.get(channel)
kind of
@digital ibex what was his response i actually cannot find it after i said client.user.cache.get returns undefined every time or Cannot read property of undefined
what you're telling the code is bot.channels.cache.get("<#id>")
which is obviously incorrect
you need to get the id out of the mention
I need help how to make a warn bot
And how could I get it, @earnest phoenix? :p
either with regex or by manipulating the string
d.js has built in regex for mentions iirc
What about only having the ID?
Like mm!say channelID <content>
Would it work in that way?

but if you want to use the mention method, you have to extract the id out of the mention
here's the regex for it https://discord.js.org/#/docs/main/stable/class/MessageMentions?scrollTo=s-CHANNELS_PATTERN
I think just having the ID is a better and easier idea x)
What were you meaning with Parsing? :p
extracting the id out of the mention
Oh, alright
is this how u split a mention from the rest?js args.split(args[0]);?
Well, if I don't need to change anything in the current code, that's ok then
if you want to use just the id, then yeah, your current code is valid
alright
sorry i meant slice
also not how you slice
Objects/Array/slice
on mdn
+ client.users.cache.get('123456789012345678');```
Ok so all my friends use v11 atm, they do client.users.get('id') to grab the users information but i cant seem to get the v12 way of doing it working:( anyone got any ideas? client.users.cache.get('123456789012345678') always returns undefined or cannot read property of undefined
- is client defined
- are you actually using v12
yes and yes
if it returns undefined it means the user doesn't exist
if it returns cannot read property of undefined then the user collection doesn't have the cache
iirc, try client.users.fetch
with an await
that'll fetch the user from the api if the bot doesn't have them cached
ah someone whos not a smart ass for once, thank you will try now
lol ok
@earnest phoenix
hello
It logs the ID but also displays an error
Wait I think I discovered the why of the error
Nah, I didn't :/
Tried to do this:
But it doesn't work
And it still keeps logging the channel's ID, and also the same error is being displayed
does anyone know how i can fix this error?
im tryng to push my code to github and its saying
I need help how to make a mute and unmute command
anyone know the exception for MissingRole? discord.py
@autumn summit Are you talking about error handler?
yeah @spare iron
File "bot.py", line 117
async def on_command_error(self, ctx, error):
^
SyntaxError: invalid syntax
this is what i have so farpy except MissingRole: await ctx.send("You need PT | Staff role to run this command") return
doesnt seem to be working
@autumn summit u know python?
yes
File "bot.py", line 117
async def on_command_error(self, ctx, error):
^
SyntaxError: invalid syntax
can you give the full code
commands.MissingRole
k thx


