#development
1 messages ยท Page 1655 of 1
The issue is your ban command right?
Then you can basically implement the kick and ban commands with first check for permissions
Using <GuildMember>#permissions#has()
I know, i recommend using a command handler
First try making a command handler, if you don't want one then it's up to you https://discordjs.guide/command-handling/
ok
thanks
hey
i looked at it
and how would i edit the prefix
i dont see where i would change it
or do i need to add my own
adding my own wouldnt be very hard, but i dont want to mess it up
They're just requiring it from a json file, to keep the prefix and the token hidden
@final lynx do you want custom prefix per server or just change prefix overall?
how much js do you know?
i added the command handler
solutions for per server prefix require a sort of database
They're not really looking for custom prefixes
ngl, not that much. im new to discord bot making
im kinda tempted to slap them with detritus

LOL
but idk if it would be the wisest since detritus docs arent nowhere as easy as d.js
Erwin how long have you been using the lib for?
probably 2 months
ok so I have a question, do you think you can answer it?
if you wondering dusk, detritus is a discord lib for js/ts like discord.js
The lib is really nice
most likely yes
ik, i looked it up B)))
why do commands not work without the roles cached?
cuz you probably requesting permissions and since the users arent cached, it cant check
so it probably always returns false
not really
if you dont have permissions, how you're going to check?
you need a bitfield
no I agree with that
if i wanted to make a custom prefix for every server, how would i do that, building off of this
it gives you the option if you arent going to use it
then you wouldnt pass the function to check for permissions
oh?
onPermissionCehck(perms) {
return true;
} ```
that should do the trick
ok test one sec
i mispelled btw
const prefix = "n/" (message.reply)
also what permisions are you passing?
I'm JS, how do I make it so my reaction embed auto delete after a certain timeout
RN I have:
const collector = msg.createReactionCollector(filter, { time: 60 * 1000 })
But I would like to make it also delete the reaction embed when it ends
there is no onPermissionsCheck typed
actually
is that for me
this is most of my code for getting a guild prefix
me? im not touching anything
use the collector end event and delete the embed when it's emitted
๐ฎ
send what you got so far
commandClient.add({
name: 'ping',
run: context => {
return context.reply({
embed: {
title: 'DETRITUS',
description: `\`\`\`js\n${inspect(Object.entries(process.memoryUsage()).reduce(
(T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T),
{} as any,
))}\`\`\``,
},
});
},
});```
ah ok ty
blurred my token
commandClient.add({
name: 'ping',
permissions: [],
permissionsClient: [],
run: context => {
return context.reply({
embed: {
title: 'DETRITUS',
description: `\`\`\`js\n${inspect(Object.entries(process.memoryUsage()).reduce(
(T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T),
{} as any,
))}\`\`\``,
},
});
},
});```
try that @crimson vapor
you wanted a prefix command?
million used as any bru
???
talking to million
oh
well rip
n a n i
different
member.ban()
ezpz
@opal plank no go
import { CommandClient } from 'detritus-client';
const commandClient = new CommandClient(token, {
cache: {
roles: { enabled: false },
},
shardCount: 1,
prefix: '?',
});
commandClient.add({
name: 'ping',
permissions: [],
permissionsClient: [],
run: context => {
return context.reply({
embed: {
title: 'DETRITUS',
description: `\`\`\`js\n${inspect(Object.entries(process.memoryUsage()).reduce(
(T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T),
{} as any,
))}\`\`\``,
},
});
},
});
commandClient.run();```
code
im waiting for cake's response too, ask him on the channel as well
of course you arent in the server
-.-
ยฏ_(ใ)_/ยฏ
I doubt ill use it for more than a test bot
maybe ill write a joke bot
@crimson vapor https://discord.gg/WzVumxNZjF
get a feel for the lib
Question, does the timeout refresh each time you react again?
const collector = msg.createReactionCollector(filter, { time: 10 * 1000 })
there's more code obviously
time is how long it lasts
So no matter how many reactions it'll still end right?
Is there a way to make it refresh with every new reaction
<Collector>.resetTimer()
Ohh thanks
handle function pog
million instantly joined and saw me bitching about something in the lib
nice first impression 
ive not read any chat

do any of you have a discord.js ban command i could have B))
we dont spoonfeed here
if you want something that basic, use discord bot maker or something
we teach real coding here
ban: {
command: 'ban',
usage: 'ban <member>',
description: 'ban a member',
aliases: ['b'],
permissions: ['banMembers'],
botPermissions: ['banMembers'],
category: 'moderation',
exec: async (ctx) => {
const ID = (ctx.args[0] || '').replace(/[<@!>]/g, '')
const member = ctx.worker.members.get(ctx.guild.id).get(ID) || await ctx.worker.api.members.get(ctx.guild.id, ID).catch(e => null);
if (!member) throw new NonFatalError(getLang('CMD_BAN_NO_MEMBER'))
const guildRoles = ctx.worker.guildRoles.get(ctx.guild.id).array();
const userRole = guildRoles.filter(r => ctx.member.roles.includes(r.id)).map(r => r.position).reduce((a, r) => r > a ? r : a, 0)
const memberRole = guildRoles.filter(r => member.roles.includes(r.id)).map(r => r.position).reduce((a, r) => r > a ? r : a, 0)
const myRole = guildRoles.filter(r => ctx.worker.members.get(ctx.guild.id).get(ctx.worker.user.id).roles.includes(r.id)).map(r => r.position).reduce((a, r) => r > a ? r : a, 0)
if (memberRole >= userRole) throw new NonFatalError(getLang('CMD_BAN_NO_YOU'))
if (myRole <= memberRole) throw new NonFatalError(getLang('CMD_BAN_NO_ME'))
await ctx.worker.api.members.ban(ctx.guild.id, member.user.id);
await ctx.embed
.description(getLang('CMD_BAN_SUCCESS', member.user.id))
.color(ORANGE)
.send()
}
},```

spoonfeed activated
n a n i
and million goes and instantly spoonfeeds them
not djs

woah
๐
atmods spoonfeed!
I see spoon-feed!??!??
someone should tell a mod!
nono

I ate them
Mods are watching anime
@opal plank js Error: Cannot send messages in this channel at CommandClient.handle (/home/million/discord/shit-test/node_modules/detritus-client/lib/commandclient.js:466:27) yea, I think its permissions errors
@bot.event()
async def on_member_join(ctx, user):
embed = discord.Embed(colour = discord.Colour.blue(), description=f"{user.mention}({user.id}) joined ImpactRP at {user.joined_at.strftime("%a %b %d %Y at %I:%M %p")}")
channel = discord.utils.get(ctx.guild.text_channels, id=821454429264936991)
await channel.send(embed=embed)```
https://cdn.discordapp.com/attachments/780220433043423273/821606262970122271/unknown.png
Help please if you could.
@opal plank POG I "FIXED" IT
wht did you change?
Use apostrophes in the f-string
f"{'haha'}"
description=f"{user.mention}({user.id}) joined ImpactRP at {user.joined_at.strftime('%a %b %d %Y at %I:%M %p')}" ?
coroutine?
good shit
Idk why I would need a coroutine? Or why its calling for that
it's kinda weird, commands need them but events don't?
ERIS
{
rss: '48.9MB',
heapTotal: '13.6MB',
heapUsed: '12.1MB',
external: '1.4MB',
arrayBuffers: '0.1MB'
}
DISCORD.JS
{
rss: '59.9MB',
heapTotal: '24.4MB',
heapUsed: '16.2MB',
external: '1.5MB',
arrayBuffers: '0.1MB'
}
DISCORD.JS-LIGHT
{
rss: '48.5MB',
heapTotal: '13.7MB',
heapUsed: '12.5MB',
external: '1.5MB',
arrayBuffers: '0.1MB'
}
DETRITUS
{
rss: '44.7MB',
heapTotal: '10.4MB',
heapUsed: '8.7MB',
external: '1.7MB',
arrayBuffers: '0.3MB'
}
DISCORD-ROSE
{
rss: '50.3MB',
heapTotal: '7.1MB',
heapUsed: '5.3MB',
external: '1.4MB',
arrayBuffers: '0.1MB'
}``` DETRITUS, taking a lead over all but drose, which is no surprise as djs has no cache config and idk how to config eris
Correct
and drose has no cache
I may have done it wrong
@bot.event()
async def on_member_join(ctx, user):
embed = discord.Embed(colour = discord.Colour.blue(), description=f"{user.mention}({user.id}) joined ImpactRP at {user.joined_at.strftime'%a %b %d %Y at %I:%M %p'}")```
You
I am stupid, yes
Not those parentheses
In the decor
The @bot.event() thingy
Not in the strftime function
i feel stupid, but tysm
np
wait, detritus is using less cache than drose with no cache?

,
,
LOL
DETRITUS, taking a lead over all but drose, which is no surprise as djs has no cache config and idk how to config eris
detritus is using less reserved but more heap than drose with essentially the same caching options
that was 5 mins in
gonna do 15 now
drose is stable-ish at 5mb heapUsed, the lowest of them all
Detritus is the lowest rss
djs and eris basically already lost
djsl is trying
just doesn't have the caching capabilities tho
special ed me again here, i tried user and memberand ctx. in front of each of them and vice versa I usually use user, so idk, same error when I use user, but says user, I even change it in the async line to what I use, so its not that.
tim has only 2 jobs, once is being a wiki slave here with answering questions and his side job is benchmarking

How newbie friendly are all of it?
Show your code
@bot.event
async def on_member_join(ctx, member):
embed = discord.Embed(colour = discord.Colour.blue(), description=f"{member.mention}({member.id}) joined ImpactRP at {member.joined_at.strftime('%a %b %d %Y at %I:%M %p')}")
channel = discord.utils.get(ctx.guild.text_channels, id=821454429264936991)
await channel.send(embed=embed)```
Remove ctx
i tried with and without it
use member.guild
yep, same error
You removed ctx and saved the file, right?
yes
all of it as in:
all of us users here
all of detritus
all od discord.js?
The function has only one parameter?
Yes
that wasnt a yes or not question you dork
Sorry, wrong server
correct

detritus is the best no cap
^^
I mean as an early dev with middle range of understanding javascript
saying detritus is not good is like saying Ferraris are shit
Documentation, OOP wise
idk
detritus docs are a bit lacking. everything is there, but its generated docs
its worth it tho
#development message read past that
And detritus heavily use class? For most part, I used djs because I still lack understanding on classs
kinda? not really tbh
This.mything etc
look at million's example
no classes
Oh the usual module.exports
wait, what does the error event do in djs?
Using v8 api?
mhm
it shows you api errors
lol
oh, ok ok
oh, ok ok
thank
so if i want to
umm
like, if there is a missing permission, what do?
message.channel.send(error)?
the event only gives you an error object and no message
hey guys need some help with my bot, im hosting it on heroku with postgres, it was working fine since i made it last year but today all of a sudden i cant connect to my postgres database, here's the log on heroku
heroku aint rly good for databases
did they do some update and break my settings?
oh shit yea seems like its something they changed, i was scared it was something i didhttps://devcenter.heroku.com/changelog-items/2035
pog
detritus best lib confirmed

why does it take more then

Thanks
np
idk man but I compare by heapUsed and heapTotal rather than rss
@slim heart fix rss being high
how do you fix that
why do you guys keep posting this meme man
it's a meme
that's not even what they were asking
you guys are literally repeating random shit you hear from other people and giving unwelcome opinions
dude wasn't even asking if heroku is good for databases lol
Heroku has a whole thing just for databases, ive never heard a valid complaint about their database hosting ๐
Heroku and heroku postgres are completely fine for most people's bot needs
isnt heroku for webapps?
it can host long running processes too
they have several other things as well.
the only downside of heroku is the price
like I said before, if I had infinite money I'd use heroku for everything including top.gg
๐
what about mee6 bid-
also why is heroku good anyways
lol
I find heroku complicated to use
it takes care of all big problems like continuous delivery and scaling
way more complicated but just as expensive if not more
you need to set up many things with aws, codedeploy, route 53, ec2, elastic beanstalk and a bunch of other shit to get what heroku does for you out the box
oh ok
like people here just hear "heroku bad" and "json file bad" and start repeating those things to everyone else they meet without thinking about why and when those things might be bad
ah you need help writing things to a file for your 50 server bot? Why are you using json files bro have you considered setting up a highly available postgres cluster with automatic failover instead?
I mean if you want ur bot to be scalable in the long run you shouldn't use json files
doesn't make sense to use postgres at like 50 servers
ok but you're forgetting that 99.9% of people aren't creating mee6
but something else maybe
what if they want thier bot to be succesful though
lol
there's a thick line between what you want and what actually happens
json files are not the thing that prevent people from having a successful bot
true
you'll notice the problems with json files when you get there
the features do
lol
most make multi purpose bots so they all die
they die as fast as ants

it just really annoys me that people give unwelcome feedback here and the same people who get criticized end up going around telling people heroku bad without knowing why they stopped using it in the first place. Programming advice in this server is honestly like a big monkey ladder experiment
You know Xetera had enough when he goes at it like this
I don't mean to pick on you in specific link, you're not the only person who does this
ffune
*fine
spelling moment
I personally don't like how complicated heroku is to get started with
thats all
heroku is the least complicated thing I've ever used idk what part of it you think is complicated
idk when I first used it it looked complicated to me
lol
like worker dyno's?
whats that supposed to be
using linux's ssh client is complicated compared to heroku
lol
making it so your bot automatically restarts through crashes and gets updated when you update github? Because you don't have to do any of those with heroku as opposed to selfhosting
nah Im good with ssh
I do use a dedicated server and I have a webhook for auto deploy
lol
If a person wants their bot to get big they'll have to ditch the json database sooner or later, and changing it while there is as less data as possible in it is optimal, I see nothing wrong with telling people that json isn't meant to be used as a database, as it'll prevent headaches later on
For private bots json databases are fine, I guess
sameee
but that's not what they're asking and you don't know what their bot is. Literally someone posts a question with JSON.stringify and fs.writeFile and everyone goes whoa set up mongodb bro without asking what their use case is or explaining why they need to change
I mean if they put thier bot on top.gg you can assume they want it to grow right
lol
yeah i hate those people who end up recommending detritus the moment they see d.js, or redis;postgres as a db replacement for their json db they got

Yeah ikr Erwin
I'm not in front of my pc atm but if I looked it up I'm certain the median server count for a bot on top.gg would be double digits
mine are triple
i would assume most bots wouldnt even be verified in all fairness
most devs are not building the next biggest thing. They're just having fun learning about programming and daydreaming about having a big support server so they can satisfy their need for authority
not wrong tbh, i somewhat agree with that
i agree partially with it, a LOT of time i saw people getting the ego inflated with their bot in 50 or 60 servers like it meant something
Lmao, make the bot reviewers your testers
Literally
how can i run bot scripts from mobile someone please tell me
laughs in 500+ servers
I wanted to grow my bot when I submitted it here back in the day and it never got past like 200 servers I think. I could've probably run it on json files just fine although it would've been pretty slow
laughs in nearly 4k
lol
of course, everyone wants their bot to boom
the issue is the ego getting in the way
its not dead yet
I remember I ran out of heroku free database row limit when it got added to top.gg cuz I was eagerly creating rows for each member of the server 
just the other day i had a user try flexing on me that i didnt know how to code cuz their bot was in 200 servers
didn't even automate it lol
madlad
inflated egos are an issue when coding
automate what
creating the rows
I did automate it that's why it ran out of rows
i dont have many stories about shit coding tbh, ive always had expert people that i could get advice from to figure out how to do stuff
lucky you
I said eagerly as in its not created when the user runs a command but as soon as the user is available to the bot
I started learning coding with my friend
he was further than me in knowledge
lol
https://cdn.discordapp.com/attachments/688416503120396299/768137828986912798/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/801827848725200946/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/792789174042099732/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/791090756441866310/unknown.png
doesnt mean i never wrote shit code tho
https://cdn.discordapp.com/attachments/655288842433200129/747330215344209991/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/787760323640688660/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/777496593138057217/unknown.png
https://cdn.discordapp.com/attachments/655288690192416781/708356643297165312/unknown.png
these are only gems i wrote here
ooooo
any quick glimpse on it you instantly realise how bad it is
the issue is that my mistakes were a bit more advanced
thats why I like to use async await
didnt make it any less shit tho
lol
its the equivalent of tim using eval casually on his code instead of require()'ing stuff
wait rly
lol
why
hello 1-2 server had a minor problem like this i haven't encountered yet how can i fix this error
CODE
if(message.member.hasPermission("MANGE_GUILD") || message.author.id === process.env.OWNER){
//MY CODE
}
ERROR code
RangeError [BITFIELD_INVALID]: Invalid bitfield fal or number
but yeah in summary pls put more thought into the advice you give people. Beginners come here having 100% trust in what people say and a lot of times they get the impression that you're supposed to follow rules blindly because that's what everyone tells them
it was what you'd call advanced stupid
yeah I agree
this goes back to what i was saying tho
ego is a big holdback
It's MANAGE_GUILD you have a typo
the moment you try to teach someone something new, they curl up into a denial state
but my json db is fine, i dont want to move
mange guild
many times have we seen that here

interesting I haven't seen the error elsewhere but thanks for that
it's very frustrating asking something and getting told something completely different and possibly irrelevant by someone who could be helping you solve your issue but chooses not to. So that "my db is fine" reads more along the lines of "I didn't come here to get criticized on something irrelevant, fuck off" which is completely fair when receiving unwelcome criticism
other devs: "reeeEEEEEE moVe DaTabAseS"
thats a point, yes, but a lot of times its even related to the question they had
phrasing plays a role too
the way you approach to kindly tell people their setup is absolutely garbage is important
also this
true
the more you end up developing, the more you take criticism as its face value
time after time you get your stuff get called out, early in dev you usually brush it off since you already have something working
but later down the line you invest into improving it
a good example is a command handler
it has nothing but pros
this chart can be applicable to both sides
yet a lot of people are reluctant to use a command handler
and decide to go the monolithic route
they are probably like in thier mind "if it works then I don't have to switch since it works"
it may work ok
but it wont work good
and also not in long run
the itJustWorksโข๏ธ mindset
if ur code is shitty to maintain its hard to add stuff to it without puking
if you get what I mean
if(message.member.hasPermission("MANAGE_GUILD") || message.author.id === process.env.OWNER){
// CODE
}
if you get some super messy code for some stuff that is super annoying to do i would say its ok to just say if it aint broke dont fix it,
but refactoring code for a easyer to read code or a better structure i would say go for it, your future you will thank you for it.
this
you wrote MANGE_GUILD instead of MANAGE_GUILD
command handler is a must in my opinion
bruh someone already told them the mistake

a lot of times if I didn't know any better I'd think the people giving advice here are also the ones who have to maintain that codebase considering how evangelical they're being with it
even with a codebase, dont do stupid stuff, if someone else takes over he will hate you for some of the messy code you left over.
I think I of all people here would agree with that lol
you just gotta be efficient
thats the key in a devs life
then you write code so shit and performant that no company would fire you for another dev since no one would pickup on such cursed code
cost benefit

this works until your code contains a breaking bug and you need a month to fix it.
#NotLegalOrDevAdvice
well, you're the one who wrote it
logic dictates you'd be able to unscramble some of it
doesnt mean you know after 3 years how it works
just have one line for all the code with no formatting and no comments
found it
this level of shit
just name your variables like that
is that webpack?
i forgot what the fuck it was that used that
write code like this and no dev would pick up your trash, thats where the efficient part comes in, write so much functional code that it would be too much cost to get a dev to rewrite everything

bruh that code is obviously obfuscated and minimized
minimized
thats the word i was looking for
thank you
yes
but the point stands
write like that
and your position as a dev is secure

or maybe you just threw away your coding career
tis a gamble
thats for good/sane people, we dont do that here sir
How can I check file is directory or js file in this sitautation?
Python gang
@opal plank https://million.is-a.computer/files/kE6Yga7xj6iX7oxU.txt final test
What's the arrayBuffer mean
How much space array buffers take
Som uhm, larger mean better or reverse
depends
could mean a memory leak
or it could mean that your code is being run often
my bot's memory
generally lower is better tho
you could check the suffix of the file by doing file.name === โ.jsโ
than ks
help me understand this error
TypeError: Class constructor MongoStore cannot be invoked without 'new'
at Object.<anonymous> (C:\Users\justi_8vy6ryi\Downloads\Tsuyo-master\Tsuyo-master\modules\web.js:10:44)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at module.exports (C:\Users\justi_8vy6ryi\Downloads\Tsuyo-master\Tsuyo-master\events\ready.js:61:7)
at Client.emit (events.js:315:20)
at WebSocketManager.triggerClientReady (C:\Users\justi_8vy6ryi\Downloads\Tsuyo-master\Tsuyo-master\node_modules\discord.js\src\client\websocket\WebSocketManager.js:431:17)
Im trying to connect a image with another file so i tried const Img = require("../../util/Img/Cute.png"); But its a folder in a folder
You can't require images
MongoStore is a constructor, so you need to put new before you call it
oh
oohw but how do i connect images
What do you want to do with the image?
Lol I asked on fiverr as a test to see if anybody could make me a moderation bot with mongo integration and this dood said that JSON is better ๐
"faster and more efficient", my ass
๐๐
I smell bullshit
I should message him and joke about it but I donโt want to lose my rating ๐

Ik, higher rating than me
Iโve got $375 from working on fiverr
Itโs not bad when u got nothing to do outside of work and college while waiting for your discord bot to grow bigger ๐
Lmao
boom, $400 a pop
it is though
I mean sure it can be
i have my bots framework which is absurdly modular
change the config.json and add the commands
thats it
i recycled 80% of the framework from my older bot
You just gotta actively keep checking the fiverr buyer requests lol
im already working on basically 4 major projects, cant afford to commit to more
They donโt come up that much but when they do, I send them an offer straight away before some Indian gets there
work and hobby included on those 4 projects
Fuck you
i do not
we like you too
You fuck
why so rude/
Lizzy owns a bot named SoundCord and has decided to give me the bot with all its servers lol, since it wasnโt in the best shape, imma do it up and hope for the best
Soundboard and music
havent heard of it tbh
Iโm just trying to think of a unique thing for the bot, since thereโs plenty of music bots out there. Iโd like mine to stand out.
i dont see that bot
shouldnt matter
verification only stops people from adding the bot
doesnt block any other functionality
Intents might be the issue
it doesnt
as long as you dont restart it, that is
i went with my bots with the intents throughout the whole verification process
since it relied heavily on detecting if the user started playing genshin impact
so, i just never trestarted it

Same
i recycled the gateway connection a couple times in fairness
One of mines been up for 8 months straight
Iโm assuming the bots been restarted at some point ๐
Not sure whatโs happened but it ainโt working anymore lmao
not really
the only killer is discord itself
since they do have their outages every now and again
Not since the intents enforcement release 
i assume they would only kill connections if one of the api's went discontinued
not even deprecated
Its a gif but its super HD and to strong to link with a website so i need it in the program it self to mae it work
amazing, my electric oven had a wire loose and i managed to electrocute myself
What

what the fuck, you ok?
Let me ask you all something, this is a personal opinion but, at what amount of servers would you consider a bot to be โdiscord famousโ? ๐
Poggers
clearly not, that was a nice shock
yikes
my legs legit gave out
oh
you gonna go to the doctor/hospital?
hell nah, too broke for that noblity shit
fair
well, at least im not sleepy anymore
LOL
What are the odds of you getting kidnapped in Brazil
quite high
show more context
client.commands doesnt exist
client does
oh
client.commands doesnt
so what to do??
const Discord = require(`discord.js`);
const {prefix , token , author_id } = require('./config.json');
const client = new Discord.Client();
const fs = require('fs');
client.command = new Discord.Collection();
const commandFiles = fs.readdirSync(`./Commands`).filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const command = require(`./Commands/${file}`)
client.command.set(command.name , command);
}
client.once('ready' , () => {
console.log("I am online.");
});
client.on("message" , message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandname = args.shift().toLowerCase();
if(!client.command.has(commandname)) return;
const command = client.commands.get(commandname);
try{
command.execute(mesage , args);
} catch(error) {
console.error(error);
message.channel.send(`${message.author.tag} There was an error executing that command.`);
}
});
client.login(token); ```
no ads
srry
@sick fable Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
@sick fable
Can I get some opinions on a bot idea?
probably
i guess?
I'm thinking of making a bot named ShopCord, which allows users to speak in a server and earn cash.
The cash earned can be used to purchase roles on the server setup by server admins.
I don't believe there's a specific bot for that feature, apart from bots that are multipurpose
I remember ~2 years ago I used to talk in a server which used unbelievaboat for similar features, so yea, it does exist. A specific bot for it? unlikely one thats good
Do you think it'd do well?
I have documented it already
Want me to DM u the documentation for it lol
im fine
rip alright lmao
those things are usually best fit for bots made for specific servers tbh
It's good for servers that allow users to speak and gain permissions
it would probably do decently well depending on the way it is built and your luck
Like DJ role access for rythm, image permissions in a channel etc
it'd be good for roleplay servers in all fairness
perhaps
<head> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
</head>
<body>
<img src="https://images.discordapp.net/avatars/807706583173038080/48924132c6ebeac0bb6006d0462e47d5.png?size=512"> <div class="jumbotron">
<h1 class="display-4">Cheems Media</h1>
<p class="lead">This is a bot that is based on social media that includes posting. You also even can find random posts/memes!</p>
<hr class="my-4">
<a class="btn btn-primary btn-lg" href="https://discord.com/oauth2/authorize?client_id=807706583173038080&scope=bot&permissions=2014309456" role="button">Invite Cheems</a>
</div>
<style>
body {
color: #FFF;
text-align: center;
font-family: changa-one, sans-serif;
background-color: #03031A;
background-image:url('');
}
</style>
</body>```
why doesnt this work?
what does it do? what does it not do?
lol
- things
- not the things i want it to do
nvm i fixed
.botadd
no
Im trying to connect a image with another file so i tried const Img = require("../util/Img/Cute.png"); But its a folder in a folder and someone told me require isnt possible with images
const allItems = fs
.readFileSync("./keywords1.txt", "utf8")
.split("\n")
.map((x) => x.split(/ +/));
let filtered = allItems.filter((x) => x[1] === message.content);
let final = filtered.map((x) => x[1]).join("\n");
console.log(final)
let final2 = filtered.map((x) => x[2]).join("\n");
let role = message.guild.roles.find(r => r. name === `${final2}`);
console.log(final2)
console.log(message.content)
if(message.content.includes(`${final}`)){
message.channel.send(`${role} We need you here! Someone just used a specific trigger word! Get your ass back here now!`)
}``` so i had the thing working that if you just wrote a specific keyword, like hello without any other words, it would work. However, if you wirte a sentence with it, it wouldn't get the right specific role. Anyone that knows a fix?
this is the role it is searching for, but in fact i just want the help part.
let filtered = allItems.filter((x) => x[1] === message.content);```i need to change this part
but idk how to do it. Could anyone help?
@eternal osprey you still working on that
yeah
what does it do
well i can write one specific word
such as help
it would then ping a specific role
but once the word is used in a sentece it wouldn't work.
It would give me a complete invalid role
let filtered = allItems.filter((x) => x[1] === message.content);```because of this part
im pretty sure this is development linked but I don't understand what it means. I don't collect any data on my users at all.
hello guys
im gettings this error
TypeError: Cannot read property 'createMessageCollector' of undefined
here my code
please help
:c
im using discord.js v12
btw i think that's wrong
this.channel is undefined
how do i call this (im using mongodb) to my code
here
const Telephone = require('./code/Line.js');
module.exports = Telephone;
client.on('message', async message => {
if (message.content.startsWith(`!telefon`)) {
const Line = new Telephone({client: client, guild: message.guild, linename: 'thing', channelName: 'tele'})
const ons = {
whenDone: function(callerchannel, listenerchannel) {
callerchannel.send(`Connected to guild: ${listenerchannel.guild.name}!`);
listenerchannel.send(`Connected to guild: ${callerchannel.guild.name}!`);
},
onBegin: function(channel, guild) { channel.send(`${guild.name} wants a call!`)},
onFind: function(user) { message.channel.send(`User found!: ${user.username}`) },
onNoFind: function() { message.channel.send('No one picked up! :(')},
onEnd: function(messages) {message.channel.send(`Call ended! Message history:\n${messages.map(message => `**${message.author.username}:** ${message.content}`).join('\n')}`)},
onMessageCaller: function(element, channel) { if (element.content == 'stop') return Line.Stop(); channel.send(`${element.author.username}: ${element.content}`) },
onMessageCallee: function(element, channel) { channel.send(`${element.author.username}: ${element.content}`)}
}
await Line.requestGuild(ons.whenDone, ons);
//const listener = Line.requestUser({time: 100000, filter: msg => msg.author.bot == false}, ons);
await Line.Start({time: 60000, filter: msg => msg.author.bot == false}, ons);
}
});
its a main.js
@rustic nova can you help me please
I don't know js and don't spoonfeed either

unfortunately no, i'd recommend digging the docs for it
What color is an embed
@crimson vapor how did you make that box in embed?
Im trying to connect a image with another file so i tried const Img = require("../util/Img/Cute.png"); But its a folder in a folder and someone told me require isnt possible with images
yeah you can't
what do you mean by "connect"?
Do you want to include the image in a message?
You just have to pass the path to your image
<TextChannel>.send({
files: [
{
name: "Cat.png",
attachment: "./path/to/image"
}
]
});
Ok so what i did is i deleted is require and it gave me this error js (node:54456) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body embed.image.url: Scheme "../util/img/cute.gif" is not supported. Scheme must be one of ('http', 'https'). at RequestHandler.execute (C:\Users\Media\Desktop\Folder Files\Emia-master\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:97:5)
Try
`${__dirname}/../util/img/cute.gif`
for the attachment property
const Img = (`${__dirname}/../util/img/cute.gif`) so this??
no
<TextChannel>.send({
files: [
{
name: "Cat.gif",
attachment: `${__dirname}/../util/img/cute.gif`
}
]
});
How do i call this into my code?
mongoDB node.js driver
How do i make my bot page custom like others
By adding CSS to your bot description
How
@cinder patio sooo still gives me the wrong body error F
would a top.gg module that creates an internal vote server/webhook for you be a good idea 
so like it all just works in the background
some people will use it bcs they cant manage to install express
how do I fix this?
catch your errors
color: red;
// ... other styles
}```
at the top of your bot description
did you have build tools installed?
help?
uuh you shouldn't need that for dotenv
I kinda took a 7 month break from coding, and I lost all my knowledge about this stuffs
it looks like it wants the build tools
but dotenv should not require it, did you installed other packages too?
how do i call the collections file of mongoDB?
you mean the single files inside a collection? document
?
use the mongodb node.js driver to work with the database
i use mongoose, it works a bit different than the plain driver, makes some stuff easyer other stuff a bit more annoying.
I use mongoose too
but i think i know what you mean now. you want to use the collection called vips in your code right?
yes
there are 2 ways, either over the connection url add /mycollection after the ip:port
or throu code
const myDB = mongoose.connection.useDb('mycollection');
module.exports = myDB.model('MySchema', mySchemalayout);
```this will use the set collection for this schema
Why would the Discord API response be 50001 - DiscordAPIError: Missing Access on the GUILD_CREATE event?
this is a websocket error
What could have caused this?
did you use d.js?
light, yes
did you modified d.js-light?
nope, not the request handler
usually this is something you get from the websocket connection, did you modified the intends?
nope they're default, I don't need member intents etc.
DiscordAPIError sounds like REST, not websocket
Node\node_modules\discord.js-light\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
API would probably respond with 404
yeah looks like a REST error
... and tim is asleep

did you get this error constantly or just once?
nope just once
maybe an hickup on the network
And I wonder which access is missing... successfully received the guild object
probably
idk maybe the lazyloading of the guilds went wrong
You don't have any code that creates requests in that event?
oh maybe...
the bot is changing it's presence on a GUILD_CREATE event
that could be what has gone wrong
Anyone have any experience with LuaSocket? I'm trying to make a connection to a TCP server but the socket isn't receiving any events from the server ๐ฉ
is that it?
changing presence shouldn't give missing access
Weird... I've noticed the guild which was added was removed 2 times which, well doesn't work
i get this too
i had to change the permissions in the invite
that's just the request handler
it can happen to any API requests
How do I get my arraybuffers size
that doesn't make sense for me... weird thing tho
memory
?
[2021-03-14 18:55:13] -- Guild added: xxxx82716511322112
DiscordAPIError: Missing Access
[2021-03-14 18:57:26] -- Guild removed: xxxx82716511322112
[2021-03-14 18:57:27] -- Guild removed: xxxx82716511322112
do you log command usage?
why did it call removed twice
Yes and no at least no command was used is what I've logged.
dont thnk you canlog command usage
oh nvm... looked at the wrong row, yes 3 commands were send
probably my bad, I didn't use my framework to send messages and catch errors, just send the message using the send() method
looks like an error occured when the message was sent, that might be the issue
probably a client in the guild was running the command and kicked the bot at the same moment
what language?
why are you using xpath then?
or does the api return a xml?
but if the api returns json, js has native support for it
I wonder why yall still choose dbm/bdfd/dbd instead of javascript
hm yes too much work
but it is
as you can see, it is
lmfao
how does the custom code work?
how do you access modules?
like, for you it doesn't feel limiting because you've never tasted freedom
yea
so?
wait, you do think Dyno is a high bar?
dyno is literally a generic moderation bot
well, it means anything can recreate its functions
P.s. you might be already aware of how much the community here doesn't like bot makers
no, why would I?
dude
I don't need to use it to know it's limiting
NO maker will EVER be as free as raw programming
used it, after 1-2 Months ive switched to js bcs dbm is way to limited
yes
yes, but its way to limited
also when you start with custom code you could just go entirely to javascript
don't get it why so much love for a bot maker
like, literally
say ONE command you made that you think "this one is special"
not special at all, that's just simple math
;-;"
you did brag about it tho
well, I asked for an example and you promptly said that
Feels like I'm back in fucking kindergarten with you
You might wanna just carry on with your business
Proving my point further
You're not any better
Still surprised how I considered you a decent guy in the first place
i used it and its not good, there is stuff you cant do with DBM, exept for using custom code, and even then some stuff is quite hard to do maybe even impossible
help please
That seems not to work
then you did something wrong
I'm actually here because
A - I'm waiting my staff to be online so we can resume our tcg card creation
B - Its kinda a good way to pass time
I have a guy's discord id, How do I DM that guy???
@toxic jolt not a function
DISCORD.JS V12: client.users.cache.get('user_id').send('Hello! I send DM For bot!")
Probably, i dont know what to put on "myschemalayout"
get the ownerid and send him a message
Is there any discord website developers who can assist me with a project?
You will be paid for setting up and maintaining a website with a dashboard for a discord bot.
where did you put the code?
i how to fix
ah thanks, I forgot how to do this since I took a break from coding for like 6 months
In my main.js file
its for your schema file
if you have a code that you've already begin we can assist you, but we won't write code for you
paid jobs belongs in fiverr
no problem bro
Where i can find my schema file?
No, i'm just looking for a developer to join in with my project
The keys() method returns a new Array
Iterator object that contains the keys for each index in the array.
did you know how to use Mongoose?
oh okay thanks
fiverr/freelancer then
A bit
did you have a schema?
oh man what is this
my brain is burned
the docs
I think yes
there your code needs to be
No lmao, there's only idiots who can't code discord bots who send me a custom offer.
They just try to milk money out of people who need something different than they ask for
Would be this?
can you help me .c
why did you make the screenshot on Atlas? it needs to be in your code
async requestGuild(whenDone, options = {}) {
this.Session = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
if (!options.Target) {
const instanceZ = this.client.guilds.keyArray();
const instance = instanceZ.remove(this.guild.id);
let guildA = "..";
for (let i = 0; i < instance.length; i++) {
if (guildA !== '..') break;
let thing = instance[Math.floor(Math.random() * instance.length)];
const guildZ = this.client.guilds.cache.get(thing);
const channelA = guildZ.channels.cache.find('name', this.channelname);
if (channelA) {
guildA = thing;
}else continue;
}
if (guildA == '..') return reject(`No cached guild has a ${this.channelname} channel!`);
const guild = this.client.guilds.cache.get(guildA);
this.channel = guild.channels.cache.find('name', this.channelname);
if (!this.channel) return null;
if (!this.guild.channels.cache.find('name', this.channelname)) return null;
const callerc = this.guild.channels.cache.find('name', this.channelname);
const server = this.lines.get(this.linename);
server.happening = true;
server.guildCaller = guild;
whenDone(callerc, this.channel);
}else {``` here my code
But when i want to update i dont want my bot goes offline
well, yeah but, mods will eventually say the same thing
then you have a unresolved error
it's not allowed to look for devs (to join a team) here
this doesn't exist
read the docs I sent to find the answer
I want to make my bot always on but still can put an ID of a user on it
Are you using v11?
mb @lyric mountain
If you're using v12 it's guilds.cache
i dont get what you want then.
dw, good luck on your search
anyone has a idea where can i learn about webhook
I want to make a only donators can use an specific command of my bot
for what lang?
then learn how to use mongoose / mongodb, you are lacking basic knowledge
Yeah i really need to learn more, thanks
connecting to top.gg api
again, for what lang?
js, java, python, lua, spits dbm, dbd, bdfd end spits, which one?
js
How do I get the key of a string in an array?
arrays don't have keys
did you mean index of?
like, get the position of it?
yep
.indexOf()
oki thanks
was it you who wrote the code?
my friend helped
"helped"?
I'm at work right now
Is this enough for a bot
like, if that "help" involved writing the code himself then sending you I suggest you to learn how that code works
depends, what kind of bot?
It is a economy bot
Ur using ur pc nice
no its a vds
Oo



