#development
1 messages · Page 1182 of 1
Yes
;-;
Yes.
whats the best hosting website?
Do the funny -vps | talking to mod
-vps
-vps
lol
@silver lintel man host using RDp
its powerful and u can add commands to ur bot from it so no need for wait to host
np
👍 .
Hello
I am v12.. and this is my code await member.setNickname(nick); mentioning this error, Cannot read property 'setNickname' of undefined
member is not defined
Member is undefinded
Ok, Ill check it out
member is undefened
It doesnt work
let user = message.mentions.users.first() | message.guild.members.cache.get(args[0])
if(!user) return message.channel.send("Please mention the iuser who you want to change the nickname of.")
let nick = args.slice(1).join(" ")
if(!nick) return message.channel.send("Please enter a nickname.")
let member = message.guild.members.cache.get(user.id);
await member.setNickname(nick);
return message.channel.send(`Successfully changed ${user.tag} nickname to ${nick}.`)```
This is my code..
also bad operator
| is bitwise
also i dont know if u can search members cache with id
Hmm.

you're never checking if your bot has CHANGE_NICKNAMES permission
Ill check that
Check this out

completely abstracted framework for making bots in Go using JS for the dynamic scripts
at that point why not just use JS
Only supports Ecma5.1 unfortunately but its a much easier and simpler handler but also faster
You just throw shit in a folder, for both commands and listeners, each command has a prop file and it just sorts it
thats almost what i do
While the language is in JS the main way you program is synchronously even with async going on in the background, its simpler to write and easier to understand
commands / handlers
throw it in the folder and it'll import it dynamically with the event you require
Mainly I did it for concept and embedding tho. But yeah it has surprisingly good performance and ill make an extendable library loader later

Wasn't made to be better. Was made to be an option
meh, fair
The way it works is kinda cool imo tho
Its mainly meant to replace things like discord bot maker. More advanced but still easy

And better
Could also implement scratch like UI
Idiots can make discord bots too with things like that and this
i was about to say ' arent you dumb proofing / spoonfeeding it too much?', but then i remember my experience with similar things
very straightforward
check your permissions
How....

aight, now back to patching this lib
@opal plank you mean increasing CPU usage :^)
check your intents too
Me, bot, everything is admin
kek
who the fuck bundles INFO with all channel events?
thats retarded
'info' is bundled with all the channel status changes
including messages
Anyway my idea is to make a simple tool for discord bots and basic scripts. While being good at it and fast

Beginner library
imagine if discord bundled message and voice updates along with channel create/delete, all into 'message' event
thats basically whats going on here
discord api is a very interesting thing
im not deaing with discord's api
discord side is fine
its the other shitty api thats breaking my legs
I am not able to add Axdin Bot in my seever@opal plank
Someone please send me the embed code, I can't find it anywhere.(JAVASCRIPT)
@wet stag make a proper invite
@opal plank how
document.getElementById("embed").setColor(0x999999);
go to the portal, under aplication and create your invite under your app @wet stag
what did i just send
@zinc condor u french?
Hi
@zinc condor yes, ts
@pale vessel your pfp and what you just said match perfectly
Someone please send me the embed code, I can't find it anywhere.(JAVASCRIPT)
CSS
Is there a way to apply styling to h1 and h2 elements without doing .myclass h1, .myclass h2? As in, is it possible to make it more compact with pure CSS?
can send u the docs if you want
@real nacelle Did you completely ignore my message about rule 7
Did you completely ignore my message about rule 7
@slender thistle bruh i am in #development

I'm pointing at rule 7b
@real nacelle https://discordjs.guide/popular-topics/embeds.html
who can help me?
b. If you are a beginner, have a will to learn and do not expect to be spoon-fed.
^^
thanks @opal plank imma try out
he bout to copy that, i can feel it
CSS
Is there a way to apply styling toh1andh2elements without doing.myclass h1, .myclass h2? As in, is it possible to make it more compact with pure CSS?
@slender thistle what is the point? what are you trying to do?
What I'm trying to do? be an ass and make my CSS more compact :^)
It's no big deal considering I only need to style h1 and h2 in a div
@opal plank no bro it is not working
was just wondering if it's possible
like get the first div
shiv, offtopic a bit, is that bootstrap studio good?
It's fairly decent with the templates and stuff
worth a try?
I'm trying to create private voice channels, via a voice channel (Voice Create) and I have a bug in the code that I don't know how to fix, so if anyone can help me
Sure, if you wanna go for the trial or got it with GH Student Pack :p
Will the v11 bots be shut down, folks can say that the knowledge?
@wet stag then you dont a: have proper permission to invite bot
b: your invite is wrong somehow
i'll give it a try
👍
@timid forge they'll start to be deprecated cuz of major api changes
actually v11 is already deprecated iirc
How to do that in discord js v12? client.userVoices.push(channel.id);
@wet stag cant send invites here
i want to move in channel
@opal plank Thank You
@timid forge 
No invites
you need to make a proper invite
depending on how you generated it , it might be why its error'ing
@opal plank I want to send the pic that what the prblm
as long as it doesnt include the invite its fine
v11 will likely no longer connect in october 7th, possibly throwing an error like "intents required"
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
then we need to make a v12 bot 🙂
@wet stag
I have this buy command error where it says i bought one item instead of 2
if you have a bot already, its not too hard to port it
no need to remake it @timid forge
what should i do
do you have a v11 bot working already?
@opal plank I have a Member count Bot I want to add subscriber count bot
@timid forge if you do : https://discordjs.guide/additional-info/changes-in-v12.html
Yes there is
check that and patch as needed
there arent too many major changes iirc
i barely got v11 myself, so i cant give you further details
Oh, fucking hell. my content isn't under the same div as my table of contents. That'll be a pain to style.
Thanks for informations
@opal plank Do you know how to do that in discord js v12, i want to move in channel: client.userVoices.push(channel.id);
i do not, i havent played with voice myself
Oh, okay
@opal plank plz tell me a name of a YouTube subscriber count bot except Axdin
@slender thistle do the funny -how2search
-how2search @wet stag
@wet stag
To find a bot that you need please try searching on the website the main feature you need. You may need to refine your search term, but with just a little effort you can find the bot you need. If you still haven't found a bot that suits your needs, then try searching google for it.
yooo lets gooo pogg
You fix what was wrong and apply again
hm,ok
Im trying to store my second item into my inv but im not sure if this is right. https://hastebin.com/xifawazowi.js
var sql = `SELECT JSON_ARRAYAGG(JSON_OBJECT('prefix', name)) from configuration WHERE guild_id=${message.guild.id}`
connection.query(sql, function (err, result, fields) {
if (err) throw err;
});```
i copied this from here: https://stackoverflow.com/questions/41758870/how-to-convert-result-table-to-json-array-in-mysql
prepared statement 
ähm how can I fix this?
Is there anyone who knows how to make a !invites command?
What is it for?
invite bot?
invitemanager 💩
Ikr
hi, anyone know how to delete cache (for example the chace from members) bcs the bot gets too much and is over limits and i cant host it, all i want is how to delete cahce from users, i tried client
.on('ready', () => {
for (const guild of client.guilds.values()) {
guild.emojis.disable();
guild.emojis.clear();
}
})
.on('guildCreate', guild => {
guild.emojis.disable();
guild.emojis.clear();
});
but i want to delete the users one and idk how
Anyone know how to make a !invites command?
So u do !invites and you get the ammount of invites you have

Hello?
Hello, how can I add a stream status in my bot?
client.user.setActivity("",{
type:"STREAMING"
})```
This is my code
What should I add
???
client.once('ready', () => {
client.user.setActivity("text here",{
type:"STREAMING"})
That
You need the text
Where i put text here
But it says Watching
Hm
You cant put a streaming status without a valid stream url
Pls send the right code
you could even put a rick roll link lol
Yup
Pls send the right code @golden condor
docs?
client.user.setActivity("twitch.tv/powersand14701",{
type:"STREAMING"
})```
@earnest phoenix i use mine bcs its the only twitch ik so dont go there
But u can change it
U said that
You didn't add a twitch/YouTube url
@golden condor ...
?
I dont use streaming so idk it well
But who knows how to make a !invites command that tells u how many invites you have?
client.once('ready', () => {
client.user.setActivity("status here",{
type:"STREAMING",
url: "twitch/YouTube url"
})
But who knows how to make a !invites command that tells u how many invites you have?
@marsh sapphire
What do I need to do to get verified bot/ bot developer tag?
Awh
bruh
Both?
am i using Try Catch wrong?
But u dont get a badge
should any error skip to the catch block?
But who knows how to make a !invites command that tells u how many invites you have?
Tyyy, how does the bot get that?
75 servers then you need to do verification
@opal plank trycatch doesnt work with then. Its either one or the other
Alright thank you!
But who knows how to make a !invites command that tells u how many invites you have?
@marsh sapphire pls help
fuck the problem is that even without the catch it just throws error in console
maybe awaiting?
Yes you need to await
Its gone
@marsh sapphire
Either await try catch or .then.catch
aight lets try that
@marsh sapphire
@earnest phoenix
hi,@quartz kindle do you know how to delete the cache?
i thought any errors in the try block would cause it to skip to the catch
the chace from members, i have too much and i over the limits of the hosting site
But who knows how to make a !invites command that tells u how many invites you have?
@marsh sapphire Pls help idk how to im using javascript
i cant find anywhere the sample for it
All collections in djs have a sweep() method
Check the docs for collection
You will need to sweep both users and members
client.users.cache.sweep(user => something here)
i c
this is the error
thanks @quartz kindle can i @ u if i need help? about this problem?
lmao
But who knows how to make a !invites command that tells u how many invites you have?
@marsh sapphire so...
You can, but i wont guarantee a response lol
lol ok
isn't that a memory leak
How many guilds is yout bot in? Where is it hosted? How much ram does the host give you?
isn't that a memory leak
@pale vessel yes it is
is in 92 servers, is private rn and over 240k users online
But who knows how to make a !invites command that tells u how many invites you have?
and about the ram i think is around 512 MB and obv i use heroku
@marsh sapphire open the discord.js website, click on documentation, then search for fetchinvites
no upgraded, thats why i want to clear chace, users cache or all i dont mind
Ok
i mean is other solution on leak of memory?
@earnest phoenix does heroku give yoi any sort of memory monitoring? If not, if you have an eval command you can check your memory usage with process.memoryUsage()
@marsh sapphire open the discord.js website, click on documentation, then search for fetchinvites
@quartz kindle now?
Now read
var prefix
var sql = `SELECT * FROM configuration WHERE guild_id=${message.guild.id} LIMIT 1`
connection.query(sql, function (err, result, fields) {
if (err) throw err;
prefix = result[0].prefix;
console.log('1.' + prefix)
});
console.log('2.' + prefix)
why is in the console
- f!
- undefined
?
@marsh sapphire https://www.youtube.com/watch?v=lfsfga-YxzI try this idk try some videos on youtube
In this video we go over how to create an invite tracking system. This can be a powerful feature to help grow your Discord with referral contests.
PLEASE DO NOT LEARN DISCORD.JS WITHOUT LEARNING THE BASICS OF THE JAVASCRIPT LANGUAGE FIRST.
🖥️ Source code:
http://wornoffkeys....
isn't that a memory leak
@pale vessel yk how to fix it?
look in your code
but isnt about the code is it?
bcs i change the code and put another bot token and all was good so the problem i think is about memory from caching bcs of the number of users using the bot
like when i changed the token with a bot that was in only 1 server the code was running perfectly
(on host obv)
look in your code
@pale vessel u had this problem before?
maybe
like when i changed the token with a bot that was in only 1 server the code was running perfectly
@earnest phoenix not to mention then i changed the code with a simply statement 10 lines of code and same error
so thats why im asking idk how to fix it
maybe
@pale vessel u solved it(if u had it obv)?
look in your code that handles something big
oh i c
look in your code that handles something big
@pale vessel you think i collect some data i c, that would be a solution but the truth is i dont from the beginning, all i do is on if or other statements and should show the error when u do a specific message, like i get this error from the moment i deploy
@pale vessel what was your problem on this error?
i cannot believe i actually did that
big ass leaderboard
and u fixed it by?
Why I have only one dyno?
@earnest phoenix
u need to have in Procfile node Worker: "name of the file".js
just watch some tutorials on youtube is full of heroku deploy
I have
I do
I have in a Procfile file this Worker: index.js
@earnest phoenix
just screenshot the code
of the worker file
I can't screenshot
I'm on windows and I can't take screenshots
windows has native screenshots
@opal plank PrtScr not to mention about snipping tools
@earnest phoenix Try win + shift + s Or Win + prt sc
would've typed faster if MY FUCKING HANDS WERENT FREEZING i were faster
would've typed faster if
MY FUCKING HANDS WERENT FREEZINGi were faster
@opal plank
just PrtScn and paste here with ctrl + v
however i still have no idea how to deal with the error xD
enlighten me
an usual heap of memory @opal plank
prob need more ram
There is my code @earnest phoenix
im about to bonk bogs
you forgot node

There is my code @earnest phoenix
@earnest phoenix are u connected to github?
not u
prob need more ram
@opal plank yeah
zenistu
i have 512 mb
zz
not sure you can handle it, you could reduce mem usage tho
optimize the code till it runs fine
not sure you can handle it, you could reduce me usage tho
@opal plank yeah i wanted to delete the cache bcs this is only cache
isnt about the code
yeah thats what i meant
theres a lot of no cache(ISH) libs out there
bcs are many users the memory is too big and goes to the limit
and i want to delete the cache this is possible but obv nobody knows how
fetch them instead of cache
or some
@earnest phoenix try this
worker: node index.js
fetch them instead of cache
@opal plank explain
@ripe iris I already did
Still
instead of caching users
@opal plank the think is i dont cache users i dont have a statement where i do it
i think thats the problem
which lib?
which lib?
@opal plank me?
yup
i use .js
yeah
eris.js?
djs
im pretty sure u initate the options via client constructor
@earnest phoenix Try disabling web npm start and redeploy if you can
check client options in docs
this is at least a bit of it
xD i was reading that rn
but thanks
so like u were talking about fetchAllMembers?
this
idk where else the guild and channels cache options are stored
if tim said it, its right
ik that guy 1k iq
can someone help with this error discord.py
TypeError: on_member_ban() takes 2 positional arguments but 3 were given
Here is my code:
async def on_member_ban(self,guild,member):
why does the bot send 2. before 1.?
(it is async)
i need a await. But where does i need the await?
Because the callback function doesn't get executed immidietly
you can also assign it to a variable and await it
Or you can put all the code that needs to executed after the database call in the callback function
are there any free hosts that support databases
@quartz kindle @opal plank after 3 hrs i solve it, i did: const myIntents = new Intents(Intents.NON_PRIVILEGED);
const client = new Client({ ws: { intents: myIntents } });
client.messageCacheMaxSize =100;
thank you so much for all!


are there any free hosts that support databases
@restive willow
is this correct? {member.created_at.x.strftime("%x")}
@restive willow LoC
what's that mean
I'll send an invite
alright
I have a vps myself, I'm asking for somebody else I made a. bot for
LoC is probably your best bet
LoC?
Library of Code
ah
loc is probably the only free host which runs 24/7
I have a premium version of my bot and I want only certain servers to be able to invite him (those who donate or other stuff), is there a way to restrict a bot to certain servesr in the discord developer page or do I have to code it myself?
you have to code it yourself
ok
Why I can't see the other dyno?
@restive willow
@restive willow mongodb Atlas
@opaque seal there are certain ways to restrict who can invite it, but coding it yourself can give you more flexibility.
Step #1 would be making it a private bot. It'll make it so only you can invite it. If you use teams, I think anyone part of the team will be able to invite it, which will give that private-ness.
If you end up needing to code it yourself (since you're making it for donators only, you'll probably need this option), it's as simple as keeping a list of guild IDs for whitelisted guilds. If the bot joins a guild not whitelisted, it should immediately leave. You should also check for this when your bot starts up in case it has some downtime.
Yeah, I would also need a date timestamp for each guild ID, because the bot will stay only a month in certain servers
I can make a cron job that checks every 12 hours for that whitelisted list probably
That's one way. Another way would be to check when a message is sent if you'd like to cache the list of donator guilds (if you don't want to cache it, crons like you said are suitable). Personally, I'd make an SQL table for donator guilds which holds the guild ID and the donation timestamp. Then it's as simple as selecting every guild where the current timestamp minus the donation timestamp is larger than one month.
Yeah, caching is not an option for me atm, it would be easier with a database, I'm using mongoDB but the concept it's the same
Should I make a support ticket on discord website
It's been one month and 7 days since I applied for verification
Tbh just be patient
^
I recommend waiting like a week or more then make a support ticket if you're still waiting
what events are there?
can i use on_channel_create
or on_channel_re,pve
remove
or on_role_added
docs gang 
Why doesn't the song is playing, and the speaking events is also not triggering. I'm getting the debug info, and the audio file is in the same directory.
let connection;
try {
connection = await voiceChannel.join();
} catch ( error ) {
return console.log( error );
}
connection.play( 'nokia_ringtone.mp3' );
connection.on( 'speaking', ( user, speaking ) => {
console.log( user.username );
} );
connection.on( 'debug', error => {
console.log( 'Debugging Information', error );
} );
Did you mean to use ./ instead of /? Are you sure the code is being run // reaching the scope?
It's been one month and 7 days since I applied for verification
@delicate shore mine took around 2 months
then we got a response back
Did you mean to use
./instead of/? Are you sure the code is being run // reaching the scope?
@sudden geyser Yes I'm sure.
I'm getting the debug info, but the audio is not playing.
I also tried doing ./, / and no-slash.
How to add value in mongodb ?
$set?
im trying db.updateOne({ coins: db.coins + "10" })
It seems the speaking event is only triggered when the state is changed (not when a user starts speaking and when they stop speaking)
it return 1010 and if im run again, it show 101010
Because db.coins is a string and/or you are adding a string to it
Edit it in the database and use + 10 instead of + "10"
and change type of coins to Number ?
As for why the audio is not playing, I don't know myself. It looks correct from my perspective (and if it's in the same directory as where your file is being run).
ok so i might need to repost my ques
how can i hide commands.html
i only wanna show commands
and change type of coins to Number ?
@earnest phoenix mhm
@slender thistle Sorry for ping, i need to say Thank You very much 😄

zz
It seems the
speakingevent is only triggered when the state is changed (not when a user starts speaking and when they stop speaking)
And how to change state?
Guess i need to wait 
How's possible to construct an eval command that supports both JavaScript and python? I've seen some bots to be able to do this
Some middleware that sends the script string to a processing backend
A shitter method would be compiling
Pretty sure theres some py interpreter written in js
Check npm
Otherwise use exec and run the code with python
Can you see this message ?
because i think my discord is lagging
I am sending these messages at 6:38 pm IST
tell me when they reach you
wtf, the discord will be deleted on nov 7?
No, restrictions for bot verification will take place
your bot won't be able to join more than 100 servers without being verified
bruh been trying to my eval run async for the past 40m and no success
F
ok so i might need to repost my ques
how can i hide commands.html
i only wanna show commands
@quartz kindle os.fork() gang 
tim i require basic js help
Is that how you fork in py?
basically yeah
wouldnt say basic though
Pretty mcuh same in node, just using child_process instead of os
tim send help ty
oh, was it another module?
>>> import os
>>> os.fork()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'os' has no attribute 'fork'
``` 🤔
Lmao

var welcomemsg
var welcomechannel
console.log('2. ' + result[0].welcome_message)
if (result[0] == undefined) {
return
} else if (result[0].welcome_message == undefined) {
welcomemsg = 'Ein neuer Nutzer ist auf **{guildname}** erscheinen.\n Sein Name lautet {username}'
} else {
welcomemsg = result[0].welcomemsg
console.log(welcomemsg)
}
console.log(welcomemsg)
Where must I set the await, that the second console.log(welcomemsg) is not undefined?
tf
tim help pliz
the fuck IS THAT
yese
What iz the problema
async eval ma fren'
been trying promise.resolve
async function with return inside
nothing seems to allow eval to run with await

Why doesn't the song is playing, and the speaking events is also not triggering. I'm getting the debug info, and the audio file is in the same directory.
let connection; try { connection = await voiceChannel.join(); } catch ( error ) { return console.log( error ); } connection.play( 'nokia_ringtone.mp3' ); connection.on( 'speaking', ( user, speaking ) => { console.log( user.username ); } ); connection.on( 'debug', error => { console.log( 'Debugging Information', error ); } );
Hey Tim , can u help me with this
bruh that indentation tho
tim legit carrying this whole chat/channel on his back
ok so i might need to repost my question for 4th/5th time
how can i hide commands.html
i only wanna show commands
in link
🥺
@opal plank show your eval code
Before anyone asks me to google - Read pin (Do not assume people haven't already Googled their problem. If they're asking here, they've likely already Googled their problem. Telling someone "google it" is run and unhelpful.)
i reverted back to sync
well, not like i ever managed to run it async in the first place

evaled is the thing i was trying to change
using eval() util
How are you
gay
@opal plank Smart to filter those out ngl lol
@delicate shore I still can't understand your problem
I still can't understand your problem
@rocky hearth ok so my website link ishttps://blacksheep.glitch.me/commands.html
I just want it to show ashttps://blacksheep.glitch.me/commands
let evaled = await eval(`(async () => { return ${code} })()`)
@delicate shore Than you need to work with routes, don't serve the html file
how
@delicate shore Are you using express?
@delicate shore Are you using
express?
@rocky hearth nah
in javascript, i have an array like, let's say, this: js [{song: "rickroll"}, {song: "stickbug"}, {song: "thomas the tank engine"}]. How can i move an element of the array somewhere else in the same array?
Wow
@quartz kindle sankyu so much
why star
You want to reorder/sort the entire array or reorder a single item?
a single item
Use splice
Tim you hvnt answered me..
What is the question
scroll up 15mins back, or I quote it again?
What does the debug info say?
express let's u work with routes, and serve different pages based on it
Hey Tim, bye
@quartz kindle something like js let o = serverQueue.songs[args[0]] delete serverQueue.songs[args[0]] serverQueue.songs.splice(args[1],0,o)?
Nothing interesting, only the usual stuff, Tim
Use splice for both deleting and insertjng
something like
@tight plinth
U could also just swap the array elements, like u do withaandb
How can I add at my status how much users use my bot and in how much members the bot is?
You mean number of servers your bot is in?
yup
U could also just swap the array elements, like u do with a and b
nah, i dont want to swap elements
<client>.guilds.cache.size
Not required, u should when passed 1000
okie
@rocky hearth if the song is not even playing there could be a problem with the file encoding. Try moving the debug listener to before the play call, so it also catches sync debug info if any
Nah, it also didn't helped. Lemme try to play some other file
My bots being completely irresponsive to commands, Can someone help pls-
const Discord = require('discord.js');
const bot = new Discord.Client();
const token = 'just a normal token';
const prefix = '!';
bot.on('ready', (ready) => {
console.log(`${bot.user.tag} is active`)
})
bot.on('message', (message) => {
let args = message.content.substring(prefix.length).split(" ");
if (!message.content.startsWith(prefix)) return;
if (!message.author.bot) return;
switch (args[0]) {
case "hello":
message.reply('Hello World!')
break;
case "beans":
message.channel.send('Beans on toast is yummy :D')
break;
}
})
bot.login(token)```
SyntaxError: Identifier 'Discord' has already been declared
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
What does that error means?
Youve already defined discord
Wdym?
It means youre trying to declare Discord twice
Also Thanks Tim
How can I fix it?
Dont redeclare it
And why the stupid, speaking not triggering. Even though I'm updating my voice state
@quartz kindle how?!
@earnest phoenix do you know what declaration is?
@earnest phoenix Learn to use a Linter, it'll help you alot in debugging
Declaration is when your create something in your code, for example you declare a variable
This is a variable declaration: let a = 50
So you declared Discord somewhere in your code: const Discord = require("discord.js")
The variable declaraton keywords let and const do not allow a variable with the same name to be declared multiple times
So you cannot do
const a = 10;
const a = 20;
Because you already declared a
And how can I fix it?
I do
And remove it
const Discord = require('discord.js');
const client = new Discord.Client();
I do this
@quartz kindle what should I delete?
But your error is saying that somewhere in your code you are trying to declare Discord again
const Discord = require('discord.js');
const client = new Discord.Client();
console.log('Logged in as BOGSCAMs Ultities!')
bot.user.setActivity("Hello", {type: "STREAMING", url:"https://twitch.tv/bogscam"});
client.on('message', msg => {
if (msg.content === 'b!ping') {
msg.reply('Pong!');
}
});
client.login('MY TOKEN');
Is that all there is in your code? Theres nothing more in that file?
Nope
Did you save it?
Me either, lol. He's devoted for sure
devotes time to helping noob devs since like since he was born
@quartz kindle what should I delete?
thats fair
sharing is caring
uh oh
spaghettio
hehe my bot said cool joke
@earnest phoenix there is nothing wrog with the cpde you posted, either you didnt save it correctly or there is more code youre not showing
const Discord = require('discord.js');
const client = new Discord.Client();
console.log('Logged in as BOGSCAMs Ultities!')
bot.user.setActivity("Hello", {type: "STREAMING", url:"https://twitch.tv/bogscam"});
client.on('message', msg => {
if (msg.content === 'b!ping') {
msg.reply('Pong!');
}
});
client.login('MY TOKEN');
this is my code
@earnest phoenix what is the problem
Also, I have auto save
what is the problem
SyntaxError: Identifier 'Discord' has already been declared
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
This is the problem
are you sure the error is coming from that file
Do you have any other file?
This is the error that is shown now
C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:7
bot.user.setActivity("Hello", {type: "STREAMING", url:"https://twitch.tv/bogscam"});
^
ReferenceError: bot is not defined
at Object.<anonymous> (C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:7:5)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
I have a test file that I have some notes
Ok now were getting somewhere
but he's referring to it as bot instead of client
yup$
client.user.setActivity
👀
bruh
l0l
no advertising
no ads
bruh indeed
now this error
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:7:17)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
@earnest phoenix try setGame
you need to place that code in your bot's ready event
That means its trying to set activity before the client is ready
Bruh
like how you have an event for messages client.on('message', ..., make one for the ready event: client.on('ready', ...
const Discord = require('discord.js');
const client = new Discord.Client();
console.log('Logged in as BOGSCAMs Ultities!')
client.user.setActivity("Hello", {type: "STREAMING", url:"https://twitch.tv/bogscam"});
client.on('message', msg => {
if (msg.content === 'b!ping') {
msg.reply('Pong!');
}
});
client.login('MY TOKEN');
Stop posting your token lmao

its just client.on('ready',
You should probably reset it
It says "MY TOKEN" though
There are bots who snipe tokens
Now that is useful, wow
What should I delete to fix it?
Do you know what an event is?
Nope not yet
how do i send a custom emoji?
.on("something")
That would be a something event
So...?
As you can see, you have an event on your code, right? Can you tell me which event do you have?
me?
No, bog
no
hint: client.on('message', msg => {
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:7:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47\
Now this is the error
.on("something") would be a something event
.on("a") would be an a event
Which event do you have?
Or are you not interested in learning?
Tim how can I record audio of all members present in a voice channel in a single file?
I'm sure there is an audio stream you could write to a file
Audio Stream??
yeah, like a bytestream
Check connection.receiver.createStream
Yeah, that only records a single user in one file
but it doesnt send the emoji
Hm
@drifting wedge your bot needs to be in the same server where the emoji comes from, and also have permissions to use external emojis
https://hastebin.com/juquyakaki.js why is client undefined?
well it does
it has admin
so it should have external emoji
omega lul
im dumb
Ik I could have multiple receiving streams, but how can I merge them in one file?
1 sec
If you can only get streams for each individual user... You'd have to save/cache them and for merging you'd probably want to look into a library to help with that, then output to a single file @rocky hearth
@rocky hearth you need to look into media libraries on npm that can combine/merge media streams
Media streams are encoded and encrypted in various ways so you cant simply write them to the same file, they have to go through a media processor to be properly transcoded and merged
@fringe axle you use commando right?
how do i get who created a channel
@drifting wedge That'd be in the audit log, yeah?
Yes
any1 uses PIL for python?
@drifting wedge That'd be in the audit log, yeah?
@faint prism id think so
but its in the channel create evebt
{member} doesnt work lmao
@drifting wedge there is a channelCreate event, but the event doesnt give you the creator
Yes
Just add a args
if the event is fired, try reading the audit log maybe if the event doesn't include the creator
Look at the guide too
Just add a args
@dire obsidian means?
how would i read it?
dunno, might be in the docs if you can
@fringe axle the guide bro
Send link
Read it, is on GitHub
Okay
@fringe axle -> https://github.com/discordjs/Commando-guide
How can I end a readable stream, manually, causing the event to be also triggered??
Still the same @dire obsidian
@rocky hearth stream.destroy()
But using this, the end event doesn;t gets triggerred
@fringe axle Show code, I also use Commando
use the close event instead of end
You're not using Commando to its full potential
I do
**NO **
how can I check if my bot has the permission to send a message in a specific channel?
You can get the permissions for any users, then just compare it
a JS dev might be able to share the insight on it. But it's in d.js docs assuming that's what you're using

https://hastebin.com/cosapemawe.js
@steady anchor Actually there is an example in this code snippet posted earlier
Channels have a .permissionsFor(user) method
How do you make a premium database so only premium members can use it?
A database is a tool, a means to an end. What kind of premium features do you want to offer?
uh
Youll have to do that at the code level, it dpesnt have anythong to do with databases
How do you make a premium database so only premium members can use it?
@knotty quartz User's should not have access to the db directly
any interaction should be via the logic you define
I mean I got confused on making one for premium commands like role all and premium stuff.
you mean you need a user database with privileges flagged?
code says "can this user use this command" -> check db -> yes or no
Like command that only work with my server premium role.
I mean I got confused on making one for premium commands like role all and premium stuff.
@knotty quartz Why not just have a boolean field in you db called "IsPremium" ?
And check that before executing a premium command
that's pretty easy to do for 1 role on 1 server
yeah, or check if they have a role, either or
I saw someone who used roles in their support server for premium status. But tbh another database field is a better approach
roles are a bit of a pain to start working with, but extensively covered in api
that's pretty easy to do for 1 role on 1 server
@maiden mauve It keeps saying error in code so I deleted the base.
if you are familiar with how to use a database, then like Auger said it's just a boolean
I deleted the base
if someone actually paid, they need the role on every server your bot is in
there are many ways to solve this problem
or check the support server for the role every time
But like i said, the db field is a good approach
but depending on where the "access to premium" comes from (guessing a website) you would need a database between HTTP and Discord
okay thanks
if your just making this for fun on your own server, a specific role id is what you want
process command
check user role
exit structure if false
Okay now I need to try to get the ban command working normally if I make a mistake my hhost dsiables the bot but I made a mistake in ban so it not working.
Don't test in prod
Don't test in prod
@faint prism I am using my rtesting bot so it doesnt go straight on the main bot.
That works
That a kick command tho that dopes work.
Okay. I will go try make a ban command.
Would it be against the rules to give to allow myself access to change the prefix of the bot in a server regardless of my perm as the owner?
Not a bad code snippet
Would it be against the rules to give to allow myself access to change the prefix of the bot in a server regardless of my perm as the owner?
@fierce arch no
at least not afaik
it’s not like a ban command or nothing
Nah
I have it
Just mainly for botlists so I can make it different here so it won't be a common prefix
Which one of you care to help with my ban command?
I can give some docs
guys is it .hasPermission() or permission.has() i forgot
I have a scripty I just need to know what part to change to make it ban
d.js btw
.permissions.has() iirc
I have a scripty I just need to know what part to change to make it ban
@knotty quartz instead of <member>.ban use <member>.kick
.permissions.has() iirc
@misty sigil This.
oh
is it m.delete(5000) or something else i forgot
m.bulkDelete
is it
m.delete(5000)or something else i forgot
@hazy sparrow message_delete=15
<Guild>.emojis returns a collection with the guild's emojis, mapped by their ID
deletee after 15 secs
use an if statement
<Guild>.emojisreturns a collection with the guild's emojis, mapped by their ID
@cinder patio does it send the emoji
or the id
@earnest phoenix
0Exe, which library are you using?
it have a problem
@earnest phoenix you need brackets when you set the token
@earnest phoenix you need brackets when you set the token
@wooden ember no you don’t
const token = ('token here')
that too
const token = ('token here')
@wooden ember no
How can I check if some has the permission SEND_MESSAGES. I have the Number (it was a bitfield) 104318529?
How can I check if some has the permission SEND_MESSAGES. I have the Number (it was a bitfield)
104318529?
@steady anchor .has()
<permissions>.has("SEND_MESSAGES")
@client.command()
async def emojis(ctx):
await ctx.send('<Guild>.emojis')```
so this?
@earnest phoenix It literally says you're missing a closing }
Close the message event
Habviel, do you ONLY have the number and nothing else? If you are using discord.js, you can instantiate the Permissions class to work with the bitfield easily
delete it
@slender thistle token leak
anyone giving token
so
<permissions>.has("SEND_MESSAGES")
@misty sigilwelcomechannel.permissionsFor(member.guild.me).has('SEND_MESSAGES')?
Close the message event
@misty sigil
welcomechannel.permissionsFor(member.guild.me).has('SEND_MESSAGES')?
@steady anchor that should work yes
nope xd
ah
message.channel.send(`Successfully purged **${deleteAmount}** messages.`).then(m=>{m.delete(5000)})
its not deleting after 5 secs
SEND_MESSAGES is invalid?
@misty sigil the bot has not the permission send messages. how can I check if the bot has the permission or not?
if(!welcomechannel.permissionsFor(member.guild.me).has('SEND_MESSAGES'))return
or something
EAZY BLACK you have a syntax error
@earnest phoenix you forgot a }
Not only a }
thing(pars, (pars) => {});
how do i send a servers emojis?
guild.emojis
i have that
I have a working prototype and this is day 1 so













