#development
1 messages · Page 999 of 1
you will need to fetch all members to do that
to get an accurate count you first need to download all members in the guild... which on d.js can spike up your ram usage by a fuckton
yeah
bruv
hi

May as well just light your server on fire at that point
well you could fetch all and not cache them, but still...
or don't use retarded libs 
there's room for optimisation and storing objects
but that's mainly on the runtime and the language
yeah but any half decent bot will likely not want to cache all at all times
guild.members.fetch({cache:false}) optimization™️ dont thank me
^ this is what i do
but you'll have to run it again on every command execution
which arguably costs more resources than caching
exactly
Well, cache the result?
you can cut down on resource usage by using intents now though
yeah, but it still will have the spike in usage because it needs to put them all in memory for some time, just wont be a sustained high usage
you could run it once and cache the numbers, and refresh it only if outdated for a day or so
or create your own custom member cache that just tracks bots
and control it with memberAdd/Remove
Tim you switched to using intents right?
did you see what you saved bandwidth wise after switching?
btw the {cache:false} option doesnt actually exist in djs
its something i added myself
it should
In there it does
does it?
idk if you can fetch all with it tho
because it doesnt say the userresolvable is optional
the cache option is only for single id fetch
unless nothing just fetches all still
not for fetch all
just manually clear the cache with reflection 
btw the bandwidth difference with presences enabled or disabled is basically 80% of the entire thing
You could edit the guildmembermanager to fetchmany with cache off
if you disable presence updates, you use 5 times less bandwidth, literally
just have to know what you're doing 
i rewrote the entire GuildMemberManager.fetch() method
and replaced it with my own
ye
I didnt even see lmao you just manually modify the exports of each file that you change
depends
ah you also use Structures.extend
some stuff is hard to override
I never understood that
https://oliy.is-just-a.dev/m337jk_4852.png what does this actually do lol
its a marker for the cache option
i use it to know if this member is being added with cache on or off
the Object.getPrototypeOf line is basically a way to override a method that uses the super keyword
since you cannot use super outside of classes
so it's a ghetto super? 
yup
I like it
nice
js has weird things, but i find it awesome how easy it is to override anything
yup
they'd have a heart attack
js takes the entire private/protected keywords and throws them out of the window
It's done slightly different though.
Yeah
not yet
I did see private getters and setters though
but you can do this.#somefunc = function() {}
so my mongoDB promise is returning what it is supposed to
how do I get prefix from said promise
and then how do I apply said prefix from said promise
it returns a promise<object> doesn't it?
Once you await the query
it will return an object or undefined if not found
You're bound to know how to interact with Objects in JS so it's just that.
An object.
it is an object
it's just variablename.property
did you await it properly?
it's awaited, yes
you could one line it like let {prefix} = await mongocall
There's multiple ways to one line it, that's just the one I think of
it makes use of destructuring
or deconstruction
forgot if those are the same
destructuring
Also could do it with a default value.
let { prefix = 'defaultprefix' } = await mongocall
yep, you can also call it different stuff lmao, but it can get really complicated and prefix is probably fine
@warm marsh thank you, that's handy.
I need help making a command like this:
When you type /challenge @user 5 Miami,
it dm's the @user a Message Embed of
Challenged By ${message.author.tag}
Rounds: 5
Server: Miami
What part about it are you stuck on?
message.guild.members.kick(user) is true on v12?
Are you looking for kickable?
don't think you can kick users but maybe it grabs their id instead and try to resolve it to a member, who knows
but probably false
I mean how can i kick a user on discord.js v12 version, okey?
so,message.guild.member('userid').kick() will work?
members.kick work too iirc
sure i guess
not sure if guild.member accepts IDs but i think it does since id is resolvable
Ok, so my prefix is readable in the promise
now how do I set it as the prefix
(extra details: lib: d.js/mongodb)
await it
it is
shouldn't be a problem then
prefix = await read()
or destructure it if you need to
what does the promise return?
I'll send an img
hello
does anyone know why js app.post( '/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login', failureFlash: true }) ); is giving me this error: Error: Unknown authentication strategy "local"
hi
because local isn't an authentication strategy?
yes it is
is that discord passport
did you install passport-local?
yeah
whats the passport coming from?
passport?
i done new Strategy
@pale vessel https://jeremy-clarkson.is-inside.me/8JkKJjdl.png
i just changed localstrategy to strategy
@misty sigil destructure it let {prefix = "defaultprefix"} = await findPrefiz();
mfw typo
lol
so it'd be this
client.prefix = {prefix = "ab!"} = await client.db.collection("prefixes").findOne({"g_id":guild.id});?
this is my code: ```js
const { Strategy } = require('passport-local');
async function init(passport, getEmail, getID) {
// < insert unrelated code here >
passport.use(
new Strategy({
usernameField: 'email'
}),
auth
);```
prefix = "ab!" would be the default prefix, yes and then you try to get the prefix from the promise if available
prefix = "ab!" is the default
https://jeremy-clarkson.is-inside.me/8JkKJjdl.png and then it'll return prefix from this?
thats just gonna be undefined tho
what would i define it as?
im not sure i understand how thats gonna change anything
wym?
flazepe
u can see the code here if i done something stupid
i dont think i have or anything
you required passport for passport
don't you need to require passport-local?
not sure since i've never used this before
then you can use new LocalStrategy
wait does that line of code set it for guild?
yeah
ab! and the custom one
ab! + custom if it could
im requiring passport-local
where am i using passport?
im only using passport for initialising it and stuff
if it errors out then make it js let prefix = "ab!"; const custom = await findPrefix(); if (custom.prefix) {prefix} = custom;
ok
you're using it on app.js lol
yeah, because thats how u like initialise stuff
i'm pretty sure you can just change it to passport-local
yeah
How can i obtain the user who deleted a message?
Ofc i can
because i have the js app.use(passport.initialise()); and stuff
no, like the module name
you said you installed passport-local but you're requiring passport
Which is the problem of audit logs?
try const passport = require("passport-local");
im using both
wdym
im using passport-local and passport
const {LocalStrategy}
async function prefix(guild){
client.prefix = {prefix = "ab!"} = await client.db.collection("prefixes").findOne({"g_id":guild.id});
console.log(client.prefix)
}```
this is the code, idk if i done something wrong
lemme try that
and then change Strategy to LocalStrategy (no shit lul)
on message yes
why don't you just await it without a function?
do you need to use it more than one time?
wait I can do that I’m dumb
the function is wrong btw
can someone help me with canvas, i wanna draw a text boarder but it misses the text entirely
aa!eval (async () => {
const Discord = require('discord.js')
const Canvas = require('canvas');
const canvas = Canvas.createCanvas(750, 100);
const ctx = canvas.getContext('2d');
//loadImage(msg.author.displayAvatarURL({size: 512, format: 'png}).then((image) => { ctx.drawImage(image, 50, 0, 70, 70) })
ctx.fillStyle = '#7289DA'
ctx.fillRect(0, 0, 750, 100)
ctx.textAlign = 'center'
ctx.font = "50px Cartoon"
ctx.fillStyle = "white"
ctx.strokeStyle = 'white'
ctx.lineWidth = 3
var textWidth = ctx.measureText(msg.author.username).width
var fontsize = 50
var fontface = 'Sans'
var lineheight = fontsize * 1.286
ctx.strokeRect(75, 65, textWidth, lineheight)
ctx.fillText(msg.author.username, 75, 65)
const attach = new Discord.MessageAttachment(canvas.toBuffer(), 'h.png');
msg.channel.send(attach)
})()
bro
orB
send it in a codebin or something
https://github.com/OfficiallyLost/site/blob/master/src/auth/passport.js i made some small changes
Do I need a computer to create a bot or can I create a bot from my phone?
u can use a phone
it's something like ```js
client.prefix = "ab!";
const find = await findOne();
if (find.prefix) client.prefix = find.prefix;
u'd have to use something like glitch tho
Well thx I’ll use computer ,idk how to glitch my phone 😝
what's the problem
me?
mhmm
i wanna draw a text boarder
but it misses the text
it draws to the right size, im just trash at numbe-
if it errors out then make it
js let prefix = "ab!"; const custom = await findPrefix(); if (custom.prefix) {prefix} = custom;
@pale vessel "Declaration or statement expected."
can somebody help me pls:
Code:
.filter(channel => channel.me.hasPermission("CREATE_INSTANT_INVITE"))
Console:
uf
<message>.channel.me?
^
NEED MORE CONTEXT
client.channels.cache.filter(channel => channel.me.hasPermission("CREATE_INSTANT_INVITE"))
hm
can somebody help me pls
i find nothing
im not sure
channel.me isn't a thing, guild.me is
ok thx. i try this
https://hasteb.in/yudadonu.php
i wanna draw a text boarder
but it misses the text
helppppppppppppppppppp
errorjs (node:21200) UnhandledPromiseRejectionWarning: TypeError: client.db.collection(...).findOne(...) is not a function code in message event js let prefix = "ab!"; const custom = await client.db.collection("prefixes").findOne({"g_id":message.guild.id})(); if (custom.prefix)prefix = custom; console.log(client.prefix) and the client defining code js let mongoDB = await MongoClient.connect(`url`).catch(console.error) console.log("Connected to Mongo") client.db = await mongoDB.db("discordprefixes")
Libraries: mongodb and discord.js
Make sure you know what you do with your mongodb
i know what i do with my mongodb
Show what it returns
can someone help me with loadImage? it doesnt wanna work
what lang
js
oof
jeremy clarkson plj hep ><
ok thx
I'm not finding anything
damn
p5.js appears to be the only thing appearing
I wanna slice the first argument, for example:
"Hey! what's up?" will become: "what's up?"
But I don't seem to get it for some reason
do that, they generally have loads of awnsers
p5.js appears to be the only thing appearing
@misty sigil iirc loadImage is a Canvas String.
Ahh, no idea about canvas
Been a while since I’ve used canvas but I remember seeing it there
@hoary elm u got any ideas?
@hoary elm
do i use await/image#onload because i have no idea
I wanna slice the first argument, for example:
"Hey! what's up?" will become: "what's up?"
But I don't seem to get it for some reason
@earnest phoenix Does anyone know?
#development message @misty sigil
substring(args[0].length + (excess amount))
@pure lion wdym by substring
oh nvm lol
#development message @misty sigil
@pale vessel still doesn't give the default prefixjs Cannot read property 'prefix' of nulland the line of code causing it isjs if (find.prefix) client.prefix = find.prefix;
the if statement obviously sees that find.prefix exists somehow
are you sure client is defined
client is defined
im still confused
what is the substring method?
im still confused
what is the substring method?
message.content.substring
yeah ok, but what is it?
no he asked what it is
i wanna know and not copy & paste
but better
faster
i never used those, thats why im trying to get to know them
it gets a portion of the string
like a part of it ?
yea
yea(edited)
but afaik it cuts a part of a word and not a full arg
i wanna cut a full arg tho
slice works on both arrays and strings while substring only works on strings
what do i put in the slice to cut a specific arg?
so if i did
let str = 'abcde12345'
let test = str.substring(2, 4)
output: bcd
thats what i read(but with slice)
https://hasteb.in/wajififu.php
error:
SyntaxError: Invalid or unexpected token
i tried using
let thing = args.join(" ").slice(-1, 1)
so it will give me args 0 for example
i really dont get it..
bot.user.setStatus('offline')
whats wrong with this code its not working
im using discord.js
it takes a few mins so it updates
i used this
let itemname = args.join(" ").slice(itemprice.length)```
!additem 100 a
which works but on console it makes a lot of spaces " a "
you need to slice before joining
why is that
so you can slice by words instead of characters
OH
for example
slice first then join
"abczyx".slice(1) = "bczyx"
["abc","zyx"].slice(1) = ["zyx"]
becuase then it counts as an array?
yup
no, you slice by number of items in the array
so if you have an array of words, you just slice by 1 to remove the first word
no matter what length the word is
yes, what slice does is give you sub-selection of the array
.slice(1) means all array items from index 1 to last index
skipping index 0
which equals to removing index 0, aka the first word
ok
so slice 1 will get everything after 0
yes
👍

<voicechannel>.connect()
where voicechannel is a channel you have to get from somewhere
for example bot.get_channel(id)
Hey! So I am currently modifying dragory's modmail bot to do a special feautre where if the user is muted it sends them a dm, does this look right? It's currently not working with no errors
bot.on("guildMemberUpdate", async (oldMember, member) => {
let role = "726573617806311546";
if (oldMember.roles.size < member.roles.size) {
if (member.roles.has(role)) {
try{
const dmChannel = await bot.getDMChannel(member.id)
dmChannel.createMessage(`Hey! You have been temporarily muted in the "Avatar: The Last airbender" discord - if you wish to talk to the Sentries or White Lotus please reply to this DM`)
}catch{
bot.createMessage("726569173353889923", `Member: ${member.user.username}#${member.user.discriminator} was muted, and I attempted to DM them but they had DMs closed.`)
}
}
}
})
I dunno, it looks fine
djs v11?
def not djs
ah maybe eris
eris
newMember?
Someone could help here?
TypeError: Cannot read property 'toUpperCase' of undefined
const info = client.channels
.cache.map(cat => stripIndents`${cat[0].toUpperCase() + cat.slice(1)} \n${commands(cat)}`)
.reduce((string, category) => string + "\n" + category);```
cat[0] is undefined
to what should I changed it
tim it still didnt work :(
alright, lets try thanks
@ember atlas oldMember.roles is an array
mhm
so you have to use .length
actually both of them are arrays
Hi
ya
ill add .length and check
hey tim, how can i check if a member has a certain role?
i thought it was how i did it, but i guess that isnt a function according to the error i got
roles.includes()
this is one of the reasons eris is lighter than djs, using arrays instead of collections in lots of places
lmao
<3
one more thing, i have it that if the user doesnt have dms open it sends to a channel, any idea why it wouldnt send?
await dmChannel.createMessage()
otherwise the error isnt thrown in the try/catch block
this part
}catch{
bot.createMessage("726569173353889923", `Member: ${newMember.user.username}#${newMember.user.discriminator} was muted, and I attempted to DM them but they had DMs closed.`)
}
yes, createMessage() has to be awaited
aah
otherwise any error it throws gets lost in limbo
aka, unhandled promise rejection
or if you prefer, bot.createMessage().catch(() => bot.createMessage())
thanks, it all works perfectly
just gotta figure out why gitignore isnt ignoring the node modules now : D
lmao rip
Someone could help here?
TypeError: Cannot read property 'toUpperCase' of undefinedconst info = client.channels .cache.map(cat => stripIndents`${cat[0].toUpperCase() + cat.slice(1)} \n${commands(cat)}`) .reduce((string, category) => string + "\n" + category);```
Tim, nop, still not working
you changed nothing
nono, thats the messague quote
hey
const info = client.channels
.cache.map(cat => stripIndents`${cat.name.toUpperCase() + cat.slice(1)} \n${commands(cat)}`)
.reduce((string, category) => string + "\n" + category);```
But it returns Cannot read property 'toUpperCase' of undefined
its probs on the docs
It should be like updateOne
cat should be a channel object here
const updateDocument = function(db, callback) {
// Get the documents collection
const collection = db.collection('documents');
// Update document where a is 2, set b equal to 1
collection.updateOne({ a : 2 }
, { $set: { b : 1 } }, function(err, result) {
assert.equal(err, null);
assert.equal(1, result.result.n);
console.log("Updated the document with the field a equal to 2");
callback(result);
});
}
can you do console.log(client.channels.cache)?
How can i fetch a channel last message?
@limber swan cat.name.slice
also did you console.log it? why did the uppercase error suddenly disappear?
did you forget to save the file and restart the bot before?
yes
it sent this to teh channel: MEMBER-LOGSember-logs :notes: MUSIC 3 Music 3 :tools: LOGS logs REACT-HEREeact-here AUDIT-LOGudit-log PARTNER-BOTSartner-bots TESTING-MASTIVEesting-mastive PARTNERartner :bell: INFORMATION INFORMATION COMMANDSommands :notes: MUSIC 2 Music 2 NEWSews UPDATESpdates :closed_lock_with_key: VERIFY verify STAFFtaff ANNOUNCEMENTSnnouncements PARTNER-SUPPORTartner-support :speech_balloon: GLOBAL Global MEMESemes :speaking_head: VOICE VOICE CHAThat PRIVATErivate BIG-PARTNERSig-partners MEETINGSeetings :incoming_envelope: SUPPORT support HELPelp GIVEAWAYSiveaways SMALL-PARTNERSmall-partners PARTNERSHIP-REQUESTSartnership-requests FREQUENT-QUESTIONSrequent-questions CHAThat INFORMATIONnformation STAFF-APPLICATIONStaff-applications STAFF-UPDATEStaff-updates :notes: MUSIC 1 Music 1 :speech_balloon: CHAT CHAT
alright
Anyone?
uppsercate
still returning the same message,
show updated code
const info = client.channels
.cache.map(cat => stripIndents`${cat.name[0].toUpperCase() + cat.name.slice(1)} \n${commands(cat)}`)
.reduce((string, category) => string + "\n" + category);
console.log(client.channels.cache);```
no error now, its sending the messague I sent before when it shoudl send this:
https://gyazo.com/6094d958d6cc470b5e012c0a70fa1c7b
its sending this https://gyazo.com/99c84b63791e11a247ed90c2268e9ec3
well, you're doing client.channels.cache.map
you're mapping channels
not commands
oh
lmao
so I change channels to comamnds, right?
ok
readdirSync("./commands/").forEach(dir => {
const commands = readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js"));
for (let file of commands) {
let pull = require(`../commands/${dir}/${file}`);
if (pull.name) {
client.commands.set(pull.name, pull);
table.addRow(file, '✔️');
} else {
table.addRow(file, `❌`);
continue;
}
if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
}
});```
you save them in client.commands
so you should be able to do client.commands.map()
There thanks
check if the message contains the mention before initializing prefix
i want it to respond to mentions besides the prefix
you can easily integrate that
Isn't it just a true false thing
yeah plus make the length mention length
can be as simple as ```js
if(message.content.startsWith("<@BOTIDHERE>") || message.content.startsWith("<@!BOTIDHERE>")) {
run command
} else {
prefix = get prefix from db
if(message.content.startsWith(prefix)) {
run command
}
}
hmm?
264811613708746752
Luca
1375
Luca is a bot for managing and informing members of the server
discord.js
- or @Luca#1375
334
13
2 Servers
@fossil oxide

@languid dragon 
@bitter sundial 
Invite | Website | GitHub | Support Server
@gentle wyvern #265156322012561408 and #commands for bot commands
Sorry
dw, just sayin
how do I see how many bots are in all of the servers my bot is in?
@earnest phoenix
.
?
does anyone know how to svg
use an illustrator
awesome
@hushed cypress Not the place for it.
How would u do an if statement that determines if data is != to soemthing
return a message and if its = return an other
if (message.content !== something) {
} else {
}```?
mhmm
if (you != gay) return send("you're not gay");
else return send("you're gay");```
also im confused. i finished setting up the environment for my bot, but i dont know what to do after
im stuck at bot-env again

what the actual hell do i do
i am stuck stuck
I have servers update (api for fortnite server).
And if the servers change
It goes like
Old: v10
new : v11
so how to do that ?
no no i meant like this
i only have the new 1 without old
Update
but why ?
there's api for autoupdate
Idk y is that happen
oh i got a new errror this time
.addField('``servers``', `[ ${client.guilds.size}]`, true)
.addField('``channels``' , `[ ${client.channels.size} ]` , true)
what's wrong ?
it goes like
Servers:
[undefined]
@rancid spade in v12 of discord.js its client.guilds.cache.size
@rancid spade in v12 of discord.js its
client.guilds.cache.size
@steel drum what about channels & users
thanks
nvm i cant install pip
damn
the rest of this channel is actual questions revolved around bots that already work
ive never gotten my bot to work because they never gave me any clue on what the actual fuck to do
why does it say i have python 2.7 when i have python 3.8.3
owner id command only
What command handler are you using also check the docs there should be a bool option for inline
hi, does a bot need the "manage messages" permission to delete its own messages
no
ok ty
i still dont know what to do after i create the environment
@winter basalt the bot.py file i "found" was something else that i dont even know why it exists
no docs i can find has any sort of thing telling me what the fuck to do
it doesnt tell me where to go
well
it just expects me to know all that shit like ive done this before
it's not the library's job to teach you language fundamentals
it's expected of you to already know that
but it is the documentaries job to teach me language fundamentals
how do valorant stats work with discord bots?
not the lib docs
how do valorant stats work with discord bots?
@earnest phoenix
those two aren't related whatsoever, what is your actual question
wait
how do i gain access to valorant stats
look for an API that offers that
yes
riot has one
valorant has one just like youtube, osu!, discord bot list, and many other products do
i dont feel like submitting anything
...
wait so
it says i need saome
client.py file
but like idk what to put in it
do i put my client id
What is inline in embeds?
Hey! I started making my first discord bot yesterday and I am having problems with making embeds
const bot = new Discord.Client();
const token = '';
const cheerio = require('cheerio');
const request = require('request');
const PREFIX = ("b!")
embedhelp = new Discord.RichEmbed()
bot.on('ready', () =>{
console.log('Im alive! woop woop!'); // do node . to run
bot.user.setActivity('**b!help**');
})
embedhelp.setTitle("Help! :clipboard::banana:")
embedhelp.setAuthor("Banana")
/*
* Alternatively, use "#00AE86", [0, 174, 134] or an integer number.
*/
embedhelp.setColor(0x00AE86)
embedhelp.setDescription(":banana:About Banana!: \n Banana is a bot bases on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
/*
* Takes a Date object, defaults to current date.
*/
embedhelp.setTimestamp();
/*
* Inline fields may not display as inline if the thumbnail and/or image is too big.
*/
/*
* Blank field, useful to create some space.
*/
bot.on('message', message=>{
if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n ");
if (message.content.startsWith("@Banana#2028")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
if (message.content.startsWith(PREFIX + "image" )) image(message);
if (message.content.startsWith(PREFIX + "help" )) message.channel.send({embedhelp});
}) // commands```
this is all the code around the embeds and commands it just doesnt work
How to check our bot server list from eval command
@spare mirage try the code brackets (3x ` at the front at the end)
@regal raven you can get 3 Fields next to each other with it instead beneth each other
is that better @lusty quest
yes better to read
Yes that is to me
Can you help me
what is your exact issue?
How to check our bot server list from eval command
I have eval command
How to do command for other command beside ping and help
I want to add new command
what exactly doesnt work @spare mirage
something with the variable
there are like 5 variables in the code
discord.js V11 or V12?
Who?
you
nvm package.json
Which is command of these 2 '!' or "!" for adding the new command
none of them
do i need to pay for a ssl certificate to get this shit to work
How
you can get a free one with Lets Encrypt or if your domain is listed at Cloudflare you can get a free one
but like its not a domain its a whole fucking bot wth
@dusk sphinx do you already have 1 command?
can i get a ssl cert for discord.com
@spare mirage what is now your D.js version?
You can get an ssl cert for free too
hm
I am using glitch.com
You don't own the domain so you can't get an ssl for discord.com
What are you even trying to do
@lusty quest I dont know how to find it
I need example command type please
im dumb how lmaoooo
you need to install the package in order to use it
@dusk sphinx https://discordjs.guide/ they have a good tutorial
I already told you that i use glitch.com
this doesnt change the fact that you need to learn how to code @dusk sphinx
I suppose its version12
@spare mirage try to run your bot again
yes
its possible that there are more missing packages
its free
nope :/
is 15 usd a month
right change it rich to Message
@earnest phoenix get certbot (on linux idk windows)
probably wrong site
@earnest phoenix you're getting scammed
right change it rich to Message
@lusty quest wait what?
what the hell is certbot
certbot is a linux tool to create free lets encrypt ssl certs
instead of Discord.RichEmbed()?
You can do that or you can use a website to create a free ssl cert
yes
And is the M capital?
yes
alright.. what do I do now
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.HasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
It this correct
I guess u need to do
if (!botChannel)
That's what I did
why did you send a message if the bot is not in a channel? Would it be better to check if the bot has permissions to connect and if they are not there throw a message?
If I run my bot now I get this error
S C:\Users\Edwin\Desktop\Banana> node index.js
(node:1204) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\Edwin\Desktop\Banana\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\Edwin\Desktop\Banana\index.js:85:5)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(node:1204) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1204) [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.
What is that code ?
how the fuck do i use certbot
const permissions = voiceChannel.permissionsFor(msg.client.user);
if (!permissions.has('CONNECT')) {
return msg.channel.send('I cannot connect to your voice channel, make sure I have the proper permissions!');
}
if (!permissions.has('SPEAK')) {
return msg.channel.send('I cannot speak in this voice channel, make sure I have the proper permissions!');
}
``` as example checks that the bot can connect and can speak
@spare mirage did you login properly?
oh lmaaooo
What
I deleted my ticked so it wouldnt get leaked
Why I need this
token*
See wait
im pretty sure if (!Bot.HasPermission = "Connect")) just checks if the bot doesnt have the permission, and if (Bot.HasPermission = "Connect")) checks i9f the bot does have the permission
It already has a command
or maybe im just dumb as shit
im pretty sure
if (!Bot.HasPermission = "Connect"))just checks if the bot doesnt have the permission, andif (Bot.HasPermission = "Connect"))checks i9f the bot does have the permission
@earnest phoenix
Yes
:o
learn linux
no
its a linux tool. i dont think you can use it on Windows
Lol
I Dont get a response but its online
it can be used on windows
Every platform can use it
Scam website is not allow to have
i never used it on windows bcs its dumb to use a Windows server for most Web Applications
Have you put join command for voice
No
Doesnt CodeLyon have an tutorial on music bots?
That's what happen
you dont need a join command
its saying i need a http website
you can have the bot join on successful search query
this isnt a fucking website
There's 2 type..so.
can any1 help ?
https://dontasktoask.com @viral iris
It says unidentified token
Return
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.HasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
I couldn't focus at it if some1 in real life bothering me
In this ^
@lusty quest My bot logs in but the command still doesnt work :/
I am thinking something is wrong here
if (message.content.startsWith(PREFIX + "help" )) message.channel.send({embedhelp});
what
how to do custom prefix for server
only 1 server
Why don't you make a command holder ?
Who are u talking to doggo
Yo
remove startsWith
You
remove startsWith
@lusty quest just?
anyone can help me in making login with discord feature i dont know much about oath2
yes
You need this ! After the command
@viral iris get some sort of DB and then store the prefix in there
@spare mirage make a command holder
i have none of these things
yes
@lusty quest ```js
if (message.content === "-help") {
or
```js
if (message.content === "help") {
Lol...i found it but..
you dont need a website
ok'
Can anyone help ?
for certbot? yes you do lol
if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://www.youtube.com/channel/UCI3uMSDZzJ8T2X_r0PZEzWA?view_as=subscriber ");
if (message.content.startsWith("@Banana#2028")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
if (message.content.startsWith(PREFIX + "image" )) image(message);
if (message.content(PREFIX + "help" )) message.channel.send({embedhelp});
}) // commands```
if (message.content === `${prefix}help`) {
@delicate shore breh
@delicate shore
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.HasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
What is wrong I. This
ez
It says return token didn't found
if (message.content ===
${prefix}help) {
@lusty quest but i need custom prefix for this server only
Like invalid toke.
@viral iris not you
you're not closing your if statement @delicate shore
@surreal notch what is your client id
Why?
What
you need to get some sort of DB and store your prefix in there @viral iris
Where ?
well
No begging for code
you said something that was incoherent @surreal notch all i could read was oauth2 which probably means bot invite
you need to get some sort of DB and store your prefix in there @viral iris
@lusty quest what's DB
Database
@earnest phoenix 
or
but heroku don't save DB
ik how to make bot invite
if it's this server only
you need to do it yourself
uhh I use
if (message.content(PREFIX + "help" ))
should do the same
ik
(Ō~Ō")
const PREFIX = ("b!") maybe my prefix is just weird
Else if for seperate command?
make sure there is not somewhere a space
use a switch case
Else if works too but ends in spagetti code
bot.on('ready', () =>{
console.log('Im alive! woop woop!'); // do node . to run
bot.user.setActivity('**b!help**');
})
embedhelp.setTitle("Help! :clipboard::banana:")
embedhelp.setAuthor("Banana")
/*
* Alternatively, use "#00AE86", [0, 174, 134] or an integer number.
*/
embedhelp.setColor(0x00AE86)
embedhelp.setDescription(":banana:About Banana!: \n Banana is a bot based on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
/*
* Takes a Date object, defaults to current date.
*/
embedhelp.setTimestamp();````
maybe this is wrong
did you get any error?
replace the embed with a simple message just for checking
or run your ping command and see if it works
lemme try doing if (message.content.startsWith(PREFIX + help)) message.channel.send("hello!")
help needs to be a string
Wait what... it goes onlie if I dont use message.channel.send({embedhelp})
kinda weird
?
I think I found whats wrong
if (message.content(PREFIX + "help" )) message.channel.send("Hello!");
it has to be if (message.content(PREFIX + "help")) message.channel.send("Hello!");
right?
^
reeeee
your issue is that you're trying to send the embed wrapped inside of another object
just pass the embed directly as an argument
oh nvm
v12
None commands work rn
var wallet = db.get(`${message.author.id}.balance`)
var bank = db.get(`{message.author.id}.bank`)
console.log(db.get(`{message.author.id}.bank`))
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.tag}'s Balance`, message.author.avatarURL)
.addField("Wallet", `**${wallet}** Skiddo Coins`)
.addField("Cloud", `**${bank}** Skiddo Coins`)
.setColor("GREEN")
message.channel.send(embed)``` bank returns null while its 2 when i eval
could it be because the embed is made before the command?
const request = require('request');
const PREFIX = ("b!")
embedhelp = new Discord.MessageEmbed()
bot.on('ready', () =>{
console.log('Im alive! woop woop!'); // do node . to run
bot.user.setActivity('**b!help**');
})
embedhelp.setTitle("Help! :clipboard::banana:")
embedhelp.setAuthor("Banana")
/*
* Alternatively, use "#00AE86", [0, 174, 134] or an integer number.
*/
embedhelp.setColor(0x00AE86)
embedhelp.setDescription(":banana:About Banana!: \n Banana is a bot based on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
/*
* Takes a Date object, defaults to current date.
*/
embedhelp.setTimestamp();
/*
* Inline fields may not display as inline if the thumbnail and/or image is too big.
*/
/*
* Blank field, useful to create some space.
*/
bot.on('message', message=>{
if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://www.youtube.com/channel/UCI3uMSDZzJ8T2X_r0PZEzWA?view_as=subscriber ");
if (message.content.startsWith("@silk moat")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
if (message.content.startsWith(PREFIX + "image" )) image(message);
if (message.content(PREFIX + "help")) message.channel.send("Hello!");
}) // commands```
Youre missing the $
hey guys.
var wallet = db.get(`${message.author.id}.balance`)
var bank = db.get(`{message.author.id}.bank`)
console.log(db.get(`{message.author.id}.bank`))
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.tag}'s Balance`, message.author.avatarURL)
.addField("Wallet", `**${wallet}** Skiddo Coins`)
.addField("Cloud", `**${bank}** Skiddo Coins`)
.setColor("GREEN")
message.channel.send(embed)``` bank returns null while its 2 when i eval
@surreal sage
quickdb?
guys
yes
i have a question.
tell
like, rlly i can't solve it.
anyway.
what it isnt bruh
@surreal sage youre missing $ before the bank part
its a sqlite database
thanks lol
p much the same thing
anyway.
you see those commands like... "oh you really want to do this action" and then the user or the member that is using that command have to say "yes" or "no".
like, where i can find how to achieve this?
language?
js.
await message
ah sh
use a message collector
any1 know how to do custom prefix without DB ?
i got a ssl cert for my bot without a domain
oh, nice.
i put empty for domain
@viral iris if it is a single server you need a custom prefix check if the guild the message is run in is the guild for the special prefix
then use the special prefix instead of the normal one
if (message.content(PREFIX + "help")) message.channel.send("Hello!");
^
TypeError: message.content is not a function
@viral iris if it is a single server you need a custom prefix check if the guild the message is run in is the guild for the special prefix
@lusty quest no only 1 server i need custom prefix
i got a ssl cert for my bot without a domain
@lusty quest how ?
Oh
@viral iris i told you how
@viral iris i told you how
@lusty quest i don't get it
@spare mirage, there's an operator you need to add first.
fucking linux
ok...
yk what
Pls help guys
fuck linux
how do I do that
ima use mac os
We are a community pls help
jk jk
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.hasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
check the guild the command is used in. if it is the guild for the special prefix use the special prefix if not use the normal prefix
People are saying I have not closed my if statemnt
But it is
Oh
Wait
Nvm
Me need
check the guild the command is used in. if it is the guild for the special prefix use the special prefix if not use the normal prefix
@lusty quest i guess no 1 use my commands
why did you then want the extra prefix? also adding a small DB for it is not hard
then every server your bot is in can have a different prefix
(its a qol thing)
why did you then want the extra prefix? also adding a small DB for it is not hard
@lusty quest but the server not saving DB
you need to add it yourself
how the fuck
there are different ways to add a Database
@spare mirage, there's an operator you need to add first.
how do I make this server operator
stack overflow
I want my site to use URLs like http://192.0.2.2/... and https://192.0.2.2/... for static content to avoid unnecessary cookies in request AND avoid additional DNS request.
Is there any way to obta...
you got your answer
then use a different cert as discribed
but the easy way would be using a domain
you can get a free TK domain if needed
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
fyi free domains are often associated with scam websites so they'll automatically be blacklisted on a lot of services
google also knocks down the SEO from those sites
@lusty quest so far almost everything youve told me to do doesnt work
i cant get a free tk domain but i can get a tk domain
https://www.freenom.com/en/index.html?lang=en 30 seconds on the internet
any1 know quick.db ?
then either get a paid one or find a way that you dont need SSL
there is no way
idgaf about xyz
@viral iris I do
@golden condor can u come dm ?
i dont like xyz
I'd prefer just to stay here but if you must
Look on namecheap there are plenty of domains under $2
const embed = new MessageEmbed()
// Set the title of the field
.setTitle('Help! :clipboard::banana:')
// Set the color of the embed
.setColor(0xff0000)
// Set the main content of the embed
.setDescription(':banana:About Banana!: \n Banana is a bot bases on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now thanks!');
// Send the embed to the same channel as the message
message.channel.send(embed);
}```
Im getting 2 errors can anyone find them?
this happens every time i try
@spare mirage what errors?
@earnest phoenix yeah the site seems to have stopped working recently
Yeah it's definitely broken
try godaddy
Or namecheap
if(command === "leave"){
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.hasPermission("Administrator"))
return msg.reply("Bruh Contact an admin; instead")
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");};```
This is my code
For what


