#development
1 messages ยท Page 1741 of 1
getting off topic
Ok... So what am I doing wrong? I can't figure out how to do the commands like muting I can even show what I have as coding. If anyone would like me to
well, we can't tell you what you're doing wrong if you don't show us what you're doing in the first place ๐ง
True one sec
import discord
import os
from keep_alive import keep_alive
from discord.ext import commands
class MyClient(discord.Client):
async def on_ready(self):
print('Logged in as')
print(self.user.name)
print(self.user.id)
print('------')
async def on_message(self, message):
# we do not want the bot to reply to itself
if message.author.id == self.user.id:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello how are you? '.format(message))
if message.content.startswith('$I am good'):
await message.channel.send('Excellent '.format(message))
keep_alive()
client = MyClient()
client.run(os.getenv('token'))
First I got this however
keeeeeepppppp allllllliiiiiivvvvvvvvvvvveeeeeeeeee
When I do the commands part it don't work. I follow it on YouTube so....
I need it because that way it stays connected on discord online
Now when I follow the tutorials on YouTube... I do what it says but it don't respond to the commands. I see the YouTubers using command prompt. Which I can't do unless on a computer
Send me the link
also
you need to be on some kind of a pc for this
using any other platform (i.e. a phone) is trivial and you're going to rip your hair out
This will help
dpy really needs to organize their docs better
I bet it's a Flask app
lol
can we split a string, on every nth index? in js
You can both by using a loop or with regex
uk regex method?
.{length}
It'll create capture groups for each N characters
Although you could really just use a loop with substring
This going to take me a while.....
like this? 'somelongtext'.split(/.{4}/)
Thanks for the link....
Yes but like, why?
In that case, it'll only get tge first 4 letters
You're not storing the capture groups
it gives empty strings
Hm, weird, but it did get 4 results
Wait
Hm, brb gonna make regexr a visit
It did work here
Matched groups of 4 characters
Don't u need to use //g?
like how
/g
/.{4}/g
The global flag has no effect in String.prototype.split()
stackoverflow is your best friend
Just
const str = '...', splitBy = 3;
Array.from({
length: Math.ceil(str.length / splitBy)
}, (_, i) => str.slice(i * splitBy, i * splitBy + splitBy));``` :mmLol:
No need for regex
yuck
not really cause rld is not in the array
The string length will have to be a multiple of 4
Or you can just https://stackoverflow.com/a/7033662/14695788
/.{1,4}/
Surprisingly enough a for loop is faster, at least on chrome
It is
Anything is faster than a regex
no surprise
Nothing can win against raw loops
The regex seems simple enough tho
Also Voltrex's version is 3 times slower than the regex version oop
It is, like, you choose between speed or readability (kinda)
Loops are a lot larger, but faster
is there any npm package or method to stringfy a function?
for a function it parses it into a string which can again be converted into a fucntion by parsing it again
Regex is oneliner, but slower
you can use toString on the function
He got is question answered already 1 h ago
really?
for a function it parses it into a string which can again be converted into a fucntion by parsing it again
If you want to convert a string into a function, may I introduce you to our dangerous buddyeval
And yes, you can stringify a function with toString()
and again into a function?
eval
hmm.... but can I eval it with arrguments?
You eval it to get the function
and then you call it
let str = fn.toString();
const fnAgain = eval(str);
fnAgain();
i'll check
Google is evil, very evil.
Keep that in mind
thanks
Huh, I tested and the only difference was 23ms, however, I think its because of calling ceil too many times
ยฏ\_(ใ)_/ยฏ
The regex version takes around 22ms, while yours takes 60ms
yea, calling Math.ceil() too many times screws it up as it seems
I got a flashback to the day Voltrex, Tim, a few others and me did that weird micro optimization just to see who was the fastest
Same lmao
Donโt actually remember who won
Tim
Didn't Tim win?
Tim has the optimize-inator 3000
Tim is the optimize-inator 3000
So question for here more about preference
Should I put my captcha under anti-raid or create a new category for it
Just create a function and use it instead \:D/
What does it do?
The captcha?

Yes
Like your normal one sends to users DM and once verified will auto role
Put under moderation
I thought about that because my antiraid run as a way to moderate admins more so with setting action limits
Such as you ban 3 people it will strip your roles, etc
If it requires mod privileges, put under moderation
Ah true thx
If it requires admin privileges, put under admin
Ahhhh
Basically, the only kind of commands that'd be split into named categories would be user commands
(those which don't require any special perm)
r u talking about this? #development message
is there a way to set every property of an object into a non object variable
like const {*} = myObj
where myObj is any object
I want a variable for each property without accessing it using the object
like if the object is {foo: "bar"}
I want variable const foo = "bar"
const { a, b, c, d, e } = myObj
Nope I think it was back in 2020... who knows
without specifying each one
let me try
Why not just access the obj tho?
you can't then
can't...
u have to define a variable at least
can you tell us why you think you can't?
lmao... need a solution not a question...
But we need the answer to know how to help
I need something like this.... but which is real
There are 0 scenarios where property accessing is not an option
Hi
One of my friend is saying he will just take code from GitHub or any yt video and make bot from that and then he will public it .. is this fine? I guess it should not ๐ค
Or just because it wonโt work 
Alright I will tell him ty
If he's not adding it to a bot list that rejects plagiarized bots and is using whatever licenses provided correctly, he probably could host it.

Is there any botlist that allows plagiarism tho?
probably not
That's very risky for the site
Yea
How so?
so you want to destructure an object and access all its property without creating any variables?
that's not possible
Idk but sites/services that allow such stuff never live too long to tell the history
People get upset with it

Darkweb 
That's what I was thinking about

I'm thinking more about the licenses for the work (e.g. MIT and Apache) that allow you to use the software with a few restrictions (so if it could be downloaded that would be the creator's problem anyway). No bot site is going to allow plagiarism anyway since it encourages generic bots
Well it has nothing to do with the common web so itโs irrelevant
Well yeah
hmm... thats sad
It's possible.
explain why you want to do that...
But you probably don't need it.
You likely would not be making your code any better and more difficult.
Given you're relying on JavaScript's dynamicness to create variables from identifiers (strings in this case) then (most likely) wanting to use it as a regular variable.
You can get all the keys off an object with Object.keys
You could then do something like eval or use global/globalThis/window to set it globally
Then figure out how to use it in your program
Unless your intent is to populate it with variables you don't explicitly access or need to do arbitrarily.
gross
global[key] = obj[key]; also works, but here's the thing...
you cannot access those properties if you don't know the keys
so why the fuck won't you do
const {key} = obj
It'd actually be like those diy videos where the dude use a soldering iron and a shitton of materials to make a soldering iron
A $5,000 gaming PC to play Minecraft.
has anyone worked with tailwind's headless-ui?
what type of color is this called; 0x3498db
i dont think its hex or rgb
its used in lua but i forgot the name
It's hex
0xRRGGBB is the same as #RRGGBB
Technically, you could also call that byte notation nvm, byte notation would be binary
ah i see
So yeah, hex
#4b8 == #40b080 OR #4b8 == #4fbf8f??
y though?
Idk, css thing
let datajson;
let myVar;
var request = require('request');
var options = {
'method': 'GET',
'url': '',
'headers': {
'Authorization': ''
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
myVar = response.body
});
const m = myVar.find(json => json.metadata.discordid === message.author.id);``` why is this last line giving me the error: cannot read property find of undefined
Three digits are taken as doubles
the console.log(response.body) logs perfectly fine.
bytes*
And white #fff
because callbacks are not immediately resolved
also don't use the request library.
so i should await the myvar
in order to get a 16 bit color you need to have 2 bytes, hence why the notation is RRGGBB
You should see https://dev.to/neisha1618/callbacks-vs-promises-4mi1
Also note while #f00 is red, 0xf00 is actually green
dude stop using request oh my fucking god this is the fifth time you got told
Because it'll be left padded to 0x000f00
That's annoying af when dealing with int rgb and byte shifting
Someone make the calc to convert f00 to decimal plz
It's not 4 actually, was thinking with binary
google 0xF00 to decimal
am on mobile data
delete x plus 1 messages
wut
oh you're fetching them beforehand?
you dont need to
if you want to fetch them beforehand, you can fetch with before: message.id
otherwise you can directly use bulkDelete(number)
instead of a collection of fetched messages
nope
Just remember max will be 99 not 100
you can run bulkdeletes in a loop until you reach the amount
dpy does that automatically for you
djs doesnt
Hi
ifaik, bulkDelete has a option to fetch the required messages to delete
without it, it only deletes the already fetched messages
it automatically fetches them
Turns out writing a recursive descent parser for a pretty dynamic language is pretty hard
Descent?
const m = myVar.find(json => json.metadata.discordid === message.author.id);myVar.find is not a function. Does anyone know why this is happening>?
myVar is a long list of arrays
Are you sure it's an array?
Then you need to get Object.values() of it
How can I convert snowflake to the timestamp?
if you're using discord.js you can use the snowflake util functions
okay one quick update, i used typeof and came to the conclusion that it is an object only. {}. How do i loop through an object to find something?
getting this error trying to push to a github repo
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/twtg93/funkinsrc.git
nvm
it works
whats ur file name?
thats a ptero problem
open package.json and send the code
only package.json
which 1 the one inside of node_nodules
whats ur main file name?
?
index.js
ah
?
send beg.js
huh i did
ok i will try again
the problem's in ```js
const ms = require('parse-ms')
i told me tochange parse-ms index.js to idex.cjs
I'm so confused

?
also
try parse-ms index.js since its trying to find that.
What lib are you using
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
discord.js
Discord.SnowflakeUtil.deconstruct(id).timestamp
hello there, i would like to start using ninjabot, i want try free trial key, where can i find him? ๐
peek-a-boo ๐
wow
you're in the wrong channel
Thanks a lot
atom?
?
is that a discord typo?
that u made accidently rn
or the file name
in the folder
?
was the file name index.cjs or idex.cjs
eeeeeeeeeee
should i try and download npm i ms
idk
@earnest phoenix install ms then
they
use
const ms = require('ms')```
once upon a time when i used windows
i couldnt install quick.db
;-;
๐ฆ
did u do this?
Did you actually read the error message and use import instead of require?
ok i will try
I mean the explanation is absolutely accurate
Well then youโre probably use import wrongly in your daily.js
If not try the suggestions the error message is giving you.
im good i think i am just doing more packajes
what is eris? never heard of it
One parses ms the other is milliseconds
ah it's a library
To quote Mr Erwin: Your solution is called Detritus
No
yes
shut

Liar



Yes
One message removed from a suspended account.
One message removed from a suspended account.
functional programming in a nutshell
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
same xd ive been so busy recently
One message removed from a suspended account.
One message removed from a suspended account.
my school got me busy working on a chrome extension that helps out dyslexic people
and for my final programming project
i made a hand gesture detector with opencv
specifically opencvsharp cause not working with c# is lame
so uh
that's fun
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
make a cheat with unmanaged c#!!
One message removed from a suspended account.
One message removed from a suspended account.
:((
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
at this point you need to be really creative because windefender detects almost all patterns related to malware, especially in c#
C++
One message removed from a suspended account.
One message removed from a suspended account.
ive had someone sent me an app that has a compiled dll in the code as a byte array and then uses that, the dll is what had malware inside of it but windefender detected that too
One message removed from a suspended account.
One message removed from a suspended account.
practice practice and practice
One message removed from a suspended account.
One message removed from a suspended account.
a big problem here is that people are afraid to try and afraid of their code not working
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I got a channels error
My bot said this
Sorry we detected a error cutie here is the error senpai: TypeError: Cannot read property 'channels' of undefined
That's a cringe error message
Lol
You're trying to get channels of an invalid object
Ok so how me fix
It worked with my jail command
null is a billion dollar mistake, and undefined is just as bad.
How I can extends typings of https://npmjs.com/package/eris ? 
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

I don't want extend Eris Client
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

One message removed from a suspended account.
okk
One message removed from a suspended account.
hello
i need help
is this good for vote webhook?
// Install discord.js module with `npm install discord.js`const Discord = require('discord.js');// token is the discord bot token, apiToken is the top.gg API tokenconst { token } = require('./config.json'); // Create Discord Bot Clientconst client = new Discord.Client() // THIS IS THE IMPORTANT PART // Variable for the channel were we'll send messages when users vote for the bot, this wont be used if you don't set a value for it as we do in the client.once('ready') event in this filelet channelForWebhooks; // Get the top.gg API token from the config fileconst { apiToken } = require('./config.json'); // Make sure to install this with 'npm install dblapi.js`const DBL = require('dblapi.js');// The webhookPort can be whatever you want but make sure you open that port in the firewall settings (for linux for example you can use `sudo ufw allow 8000`)// The webhookAuth is set by you, make sure you keep it secure and don\'t leak itconst dbl = new DBL(apiToken, { webhookPort: 8000, webhookAuth: 'anyPassword' });
// When the webhook is ready log it to the console, this will log `Webhook up and running at http://0.0.0.0:8000/dblwebhook`dbl.webhook.on('ready', hook => { console.log(`Webhook up and running at http://${hook.hostname}:${hook.port}${hook.path}`);}); // This will just log errors if there are anydbl.on('error', e => { console.log(`Oops! ${e}`);}) // When the webhook receives a votedbl.webhook.on('vote', async vote => { // This will log the whole vote object to the console console.log(vote) // Get the Discord ID of the user who voted const userID = vote.user; // If the channel to send messages in exists, we send a message in it with the ID of the user who votes if(channelForWebhooks) await channelForWebhooks.send(`User with ID \`${userID}\` just voted!`);}) // END OF IMPORTANT PART // When the bot is ready...client.once('ready', async ()=> { console.log('Webhook Bot Tester launched!'); // Get the Discord Channel were we will send the message whenever a user votes for the bot // Replace channelID with a valid Discord Channel ID were your bot can send messages too channelForWebhooks = await client.channels.resolve('channelID');}); // Login into the Discord Bot Client with the tokenclient.login(token);
damn you didn't even bother removing the comments from whatever you copypasted
a new level of shameless

i copyed
i didnt say it is my code
now pls answer
I hope you know we can't read it as is.
@ember lodge can you talk to me in dms
Current CSS:
margin-top: 1cm;
height: 30px;
width: 10cm;
border-radius: 20px;
border-color: #e6e5ea;
background-color: transparent;
outline: none;
font-size: 30px;
padding: 10px;
you mean the blur?
I mean the input field
what about it?
the border color is th same one
hey @lyric mountain can we talk in dms for a sec
the top one is blurred, that's why it appears lighter
about?
when in doubt, just press f12 and use inspect element to see the field's css
Anyone know what font discord used here?
if(msg.content === "!gif"){
msg.channel.send(searchForGif("spider"));
}
My command
var GphApiClient = require('giphy-js-sdk-core')
const configg = require("./config.json")
const client = GphApiClient(configg.GIPHY_API)
const searchForGif = (gifName) => {
client.search('gifs', {"q": gifName, "limit": 1})
.then((response) => {
var gif = response.data[0].url;
return gif;
})
.catch((err) => {
return err;
})
}
module.exports.searchForGif = searchForGif
And my module
Its showing searchForGif is not a function
I think its called "Whitney"
Ok, thx
It is Whitney. They default to a few other fonts as well
Hi I'm using pluris with typescript and I'm getting this error:
node_modules/eris/index.d.ts:2222:16 - error TS2428: All declarations of 'Message' must have identical type parameters.
2222 export class Message<T extends PossiblyUncachedTextable = TextableChannel> extends Base {
~~~~~~~
node_modules/pluris/index.d.ts:111:13 - error TS2428: All declarations of 'Message' must have identical type parameters.
111 interface Message<T extends Textable = TextableChannel> {
~~~~~~~
node_modules/pluris/index.d.ts:112:82 - error TS2344: Type 'T' does not satisfy the constraint 'Textable'.
Type 'PossiblyUncachedTextable' is not assignable to type 'Textable'.
Type 'Uncached' is missing the following properties from type 'Textable': lastMessageID, messages, addMessageReaction, createMessage, and 12 more.
112 awaitReactions(options: ReactionCollectorOptions): Promise<ReactionCollector<T>>;
~
Found 3 errors.
~~@earnest phoenix I'm not experienced with TypeScript, but if I had to infer,
- The first error means you're using type parameters where you don't need them (since you never go generic over a type other than
TextableChannel). - Same as first bullet.
- The type you're giving a type parameter does not satisfy its requirements (aka what it has on it). The issue stems from
Uncachedmissing properties thatTextablerequires.~~
In fact, this is occurring from a library. Dumb me.
Disable library type declaration checks in your tsconfig
@lyric mountain hey, here you can see the problem better
There is like a dark gray line
The input value should not have that
lol
aaa alg
Right now I'm using sqlite3 to create a db. My issue is that whenever I reset the program I get the exception:
Exception has occurred: DatabaseError file is not a database
The program runs fine if the db is stored in the main directory. However, it fails on reset if it's stored in my child directory.
Functioning file structure and code:
โโโ main.py
โโโ arcade.db
# code works perfectly on reset
connection = sqlite3.connect('./arcade.db')
Non-functioning file structure and code:
โโโ main.py
โโโ db
โ โโโ arcade.db
# will run the first time without issues if the file doesn't exist
# will fail on reset since the file now exists
connection = sqlite3.connect('./db/arcade.db')
If anyone knows the issue and can help, I'd greatly appreciate it.
buy i need the border to add the light gray color
not the dark gray
maybe that's the border-top?
try inherit or use the same color as the primary one
they have the same color
What is normalizedField?
context?
Are you relying on a host that resets your project directory every once in a while?
I figured out the issue, it wasn't happy with me making it an s3 object
the only reason why it worked in the main directory was because I didn't change the s3 upload code to access from there
so I just scrapped it and put it on a vps so I won't have to upload to s3
const { MessageEmbed, MessageAttachment } = require("discord.js");
const fetch = require("node-fetch");
module.exports = {
name: "kill",
description: "kill someone",
category: "gifs",
async execute(client, message) {
let keywords = "anime wasted"
let url = `https://api.tenor.com/v1/search?q=${keywords}&key=${client.configg.TENORKEY}&contentfilter=off`;
let response = await fetch(url);
let json = await response.json();
const index = Math.floor(Math.random() * json.results.length);
const c = json.results[index].url
const user = message.mentions.users.first() || message.author;
const b = message.author.id === user.id ? "themselfs" : user.username;
const embed = new MessageEmbed()
.setTitle(`${message.author.username} killed ${b} oops!`)
.setFooter(message.author.username)
.setColor("BLUE")
.setImage(c)
.setTimestamp();
message.channel.send(embed);
console.log(c)
}
};
Its not showing me the gif
Its showing like this
Have you tried logging c
uhm look at the last line Lite, they do log c
Well tenor doesn't return a buffer
Is it a link to the regular site or a link to the direct image file
Yup its giving me the url
Are you sure the gif is in url property
Like this
https://tenor.com/#####.gif
Lemme see the docs
Ok i will check out also
The gif is in media[index].gif.url
Can I get docs?
Tenor Search delivers the most relevant GIFs in 30+ languages. Integrate Tenorโs GIF API into your application in a matter of minutes with this handy guide.
So how can I solve this ๐ค
Tenor is veeeery troublesome sometimes
I have no other choice
Itz not giving me anime gif
what's the problem
1 more thing when I use this without embed it showing me the gif
But not in embed
Btw, I'd not trust sites like tenor, giphy or imgur for stuff like reaction gifs
You never know when an image will have the wrong tags in it
I mean like just use express and create an endpoint
then just get a random url from an array of the gifs
How can i delete an array object by the name?
elaborate
Hi, I have a question, is there a way i can get the id of the user who reacted to an embed in the following code:
embedMessage.awaitReactions(filter, { max: 1, time: 10000 }).then(collected => { HERE is where i wanna use it })
I can use it inside the filter but i cant return it (?) or i dont know how, i can insert imgs of the code if necessary
console.log collected
use collected.first().users
hmm
that would be a collection of users that reacted that emoji
i think it's a manager
you need to access cache
that would be the collection
collected.first().users.cache.first()
Does anyone happen to know if a bunch of Timers in NodeJS occupy a lot of cpu time? I'm considering changing an implementation to do Math based on Date entries to determine a value instead of using a Timer to reset a value.
Okay I'll try those options, thanks for the responses guys
collected.first().users.cache returns that, finally i found where the user id reaction is
collected.first().users.cache.first() doesnt seems to work since the first id is the bot's one
@cinder stratus @pale vessel thx
I was just telling you can filter bots reaction tho and then use first or do it other way upto you
Oh okay that will be useful too ty
Im using 3 timers and they do not occupy much cpu
Using math on dates is always better than using timers imo
You can use .first(1) to get the second entry
you don't need to filter
Okay
I made an avatar command and it works.... But the avatars are small and are stuck in that size, is here anyway I can enlarge it?
if (prefix.some(word => msg.content.startsWith(word + " avatar"))) {
const avatarEmbed = new Discord.MessageEmbed()
.setColor(0xf5d6ea)
.setTitle(msg.author.username + "'s pfp")
.setImage(msg.author.displayAvatarURL())
.setFooter(msg.author.username + (`'s pfp`))
msg.channel.send(embed=avatarEmbed)
}```
how can we use emojis on our server globally through the bot?
@feral perch wdym
Check the options
ok
*displayAvatarURL
ok
Well you can get it by using the ID of the emoji
Eg: ```js
<Client>.emojis.cache.get(id).toString()
It's not a getter
displayAvatarURL({ size: 4096 })
you spelt it wrong in the documentation link
i will try this, thx
Oh my bad
and im 10% sure displayAvatarURL is djs v11 and avatarURL is v12
No it is in v12
nvm use displayAvatarURL
ohhkk so that will work everywhere ri8?
Yeah if the Bot has that emoji in its cache
ohkk thanks i'll try it out
Is it possible to use djs commando and command handler together
How do I use Await Message?
@feral perch if u put a \ infront of an emoji and then paste it itll give u the id. Eg: \:DancingMonke:
I know how to get an emoji's id
Alright
djs commando is a command handler
Yeah it has one inbuilt
Hej wiecie jak dziaลa yt bot?
Can you help me with a PC config?
Intel i9 10900X series or Ryzen 7 3700X
why
gosh i hate these pro programmer guys
is there a way to make variable from a string?
like
let str = "var1"
and I want a variable called var1
yes
@old cliff globalobject[string] == value
you have to use the same method to get the variable value back
no in object form....
I dont think that's possible
nvm... its impossible
@old cliff why do you even need that
You could prob do it for local variable reference in a function or loop
It would be useful tbh
hello
can i get help?
hello?
@cinder patio
@earnest phoenix
isValidURL(testContent) &&
msg.channel.id !== '836159363872849980' &&
msg.member.hasPermission('SEND_MESSAGES')
) {
msg.delete();
msg.member.hasPermission('MANAGE_CHANNELS')
msg.channel.send('You are not allowed to send links in this channel.');
}```
what is the issue?
issue is if the member has manage channels permission
the bot delete that link too
what is the code for that
Idk
bcs you delete the message and then check if he got the permissions
yeah.... but I wish they added it
add a check around the url check that checks the permission of the author
ok
global["thing"] = value
But why tho
There shouldn't be a reason to be doing this
Can anyone tell me the code, if bot deletes an message then bot need to send it again
any code
coz idk
so if the bot deletes a message you want to send the message again?
Lmao
trying to do things the hard way in js lol
store the message, delete it and then send it again
ok
message.delete().then(msg => msg.channel.send(msg.content)) ยฏ\_(ใ)_/ยฏ
Been playing around with a slash command / interactions API implementation. Open to feedback! https://www.github.com/tim-smart/droff/tree/main/example%2Fslash-commands.ts
-botinfo 832937425515970582
832937425515970582
Queen Olivia
1924
Welcome images, memes, giveaways, Economy, fun, high admin info, moderation ,nsfw and many many more!
undefined
.
1
0
No server count
@quick helm
@hushed sun
Invite | Website | GitHub | Support Server
kk
How do I get the current day/month in java
820977858344255499
Supernova
4218
Supernova is a small but useful bot, it includes | Moderation | Emotions | Games | music| everything that your server needs!
undefined
~
4
2
No server count
@cold meteor
Oh snap im so sorry weong channel
Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (C:\Users\Lan\Desktop\jancok kau\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_DLOPEN_FAILED'
help plz
Just convert all the members collection into array and choose one from it and mention it
Hnm
i have 0 experience with bots
uh
๐
Read the doc
Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (C:\Users\Lan\Desktop\jancok kau\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_DLOPEN_FAILED'
help
asap
send ur code
code wat
you can just use <collection>.random()
He don't have any coding experience
Sounds suspicious like making a raid Bot or something
yeah it's more simple
(node:12448) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit (Use node --trace-warnings ...to show where the warning was created) PS C:\Users\andre\OneDrive\Desktop\BOT DISCORD\ZeraBot>node --trace-warnings ...`
ode : Termine '
ode' non riconosciuto come nome di cmdlet, funzione, programma eseguibile o file script. Controllare l'ortografia del nome o verificare che il percorso sia incluso e
corretto, quindi riprovare.
In riga:1 car:1
node --trace-warnings ...-
+ CategoryInfo : ObjectNotFound: (
ode:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException` i have this problem when i digit my command for reddit's meme and install the **got **library
is in italian sorry
lol i want to put it in my anime review server and also theres a youtube video by discord about adding @ someone as a meme
thought i'd try to ask for some help on achieving that
Add max listeners, there's a memory leak in your code
Why not use an existing bot instead?
Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (C:\Users\Lan\Desktop\jancok kau\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_DLOPEN_FAILED'
that kind of bot exists?
that just pings some random dude when you @ someone
Stop spamming erroressages without any context @earnest phoenix
i create a own bot
require('events').setMaxListeners(0)
``` iirc
Yes, that's a trivial feature that a lot of bots have
respect gained 
also I'd like the bot to be called someone so you can actually ping @ someone
well i could just nick it
what bots have that option?
Can't name one of them cause I don't use any bots but surely you can find one on top.gg
ok ill look
just fetch all the members in the guild and then randomly ping someone
i have no experience coding bots 
decent, neither do I
๐
where add this string of code??
That won't solve the error
YES I found a bot that does exactly what I want and its called "someone" les go
good job
First of all it's not a string I added that thing in the main file of my Bot
Like whatever you have index.js
Or whatever
That just avoids the error, If I can't see the errors in the terminal then it's okay amirite
I also used to get memory leaks, idk any other way to solve it
You have too many event listeners, do you have a message event for each of your commands?
oop
?
wrong reply
Wrong message
You have too many event listeners, do you have a message event for each of your commands?
Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
that
u can help me
better_sqlite3.node is not a valid Win32 application.
It's kind of getting annoying
what are a listeners??
@earnest phoenix try using google next time https://github.com/JoshuaWise/better-sqlite3/issues/227
ok
how can fix this problem
did
but how to fix
tf
you need x64 arch
answer my question
So you can't run that on x86 arch
idk, it was mentioned here
You should use Windows x86 OS for building your project because the better-sqlite3 has native dependencies. I use this way for my electron app.
So is he using x64 arch os for x86 arch PC or something like that
Hmm
x86 is x32 yes
Yeah made me confused for a sec
i don't understand your question, can you repeat please?
Do you have a message listener for every command? Do you have multiple client.on("message" in your code?
x64 is the architecture name for the extensions to the x86 instruction set that enable 64-bit code.
Interesting
yes, i have multiple message listener
As long as you're removing the listener at some point events inside eventa are fine
but using multiple message listeners for every single command is bad
Well he has so many events in one file
ah
there are a methods for substituting this multiple listeners??
@cinder patio would you have my bot code on github link??
?
can you elaborate
and?
oh geez
https://srcb.in/wJl7Y2MeiA
Pls help with my leaderboard, I have a lot of trobles!
In the sourcebin link there is the mongoose schema and the leaderboard code.
The leaderboard code outputs only me
I found a way to access all properties of an object without using an object
for(prop in myObj){
global[prop] = myObj[prop];
}
๐ง
you never really call the data from the database.
also imports are case sensitive
you probably want to change your export in the model to something more meaningful
is for this that I see all the people in my server with my ammount of coins?
you never really call the database, you just get a property without telling MongoDB what you actually want
and how can I fix it?
read the mongodb docs for how to query MongoDB, also like ive said your import of the model probably dont work
i should do like const leaderboard = await profileSchema.findOne(?
fineOne will only find one document
profileSchema.find() should return all documents
but if I found all the documents and I map them?
is one way to handle it
guildID: message.guild.id
}, (err, guild) => {
if(err) console.log(err)
if(!guild) {
const newGuild = new Guild({
_id: mongoose.Types.ObjectId(),
guildID: message.guild.id,
guildName: message.guild.name,
prefix: process.env.PREFIX
})
newGuild.save()
.then(result => console.log(result))
.catch(err => console.log(err));```
for example calling like this in a variable and after doing, in this case, settings.map
should work?
try and see
but what should I put for
userID : member.user.id?
and for bank?
are thaths the thing that I dont get
and mongo docs says to use $sort but when I tried never worked ๐ฆ
just just use it wrong then
but for me that I'm a newbie are super hard thats docs
const leaderboard = await model.find({},{$sort: {xpfield:1})
``` replace 1 with -1 if its the wrong orientation
the MongoDB docs are not this bad, ive encountered other docs that are just horrible, like Google APIs
and after this, I do something like this
dont make think again about that docs, I've tried
try harder
I told u, I'm a newbie, in 1 month I've learnerd a lot of things
my bot is 1 month ppld and works
We suggested that twice yesterday lmao
const leaderboard = await profileModel.find({
userID: member.guild.id,
bank :
},{$sort: {bank:-1})```
In bank, what should i PUT?

did you have a plan what you do there?
like you tell mongoDB that you want only a document where the userID is the given id and then also it has to be a spezific bank thing?
yes thanks lol..... will be using in my child processes prj
child processes dont share global variables
in easier words?
I'm not english and somethimes I dont get some questions
ok to simplifie it, imagine MongoDB is a Grocery store, you go there and tell them you want a only a Package of Milk, with the exact Barcode ID. But in reality you want to get all the Milk they have.
the way you do it currently asks for one spezific thing, but you want it not this precise for the leaderboard.
is there only one document or mutiple?
multiple, but all the console.log gives me 3786 coins for everyone, but outputs Only me
at the beggining was an output made by 10 people with 3786 coin
bcs like ive told you, you narrow your query to a point where it only returns one document
instead of userID and bank i suggest to use guildid only so you get the leaderboard for this one guild
this Is a very good idea but for asking to mongodb the documents I need Also the user.id because It Is my primary Key
Is the unique that made al the documents different
you dont need the userid
but why not
bcs mongodb will then only get the document where the userid is present
if you pass the guildid it will return all documents with the guild id
I should use userID or guildID withoht difference Only if my bot Is in One guild
right?
i think you dont really get how mongodb works
I think the same
that you have unique IDs for the userid is ok, but will cause issues if your bot goes into mutiple guilds
my bot Is in 2 guilds right now
what if 1 user is in both guilds?
he wont be able to get data stored for both guilds
a lot of users are in both
One guild Is made by 250 people and the second One Is made by 50
there are mutiple ways to solve the issue. one is nesting object, the other one is using a unique id for each guild. like guildid+userid
for examole my .beg and .bal works in both
this is probably down on how you query the database.
I should put also guild.id like unique ?
no
If I change in my actual code the user ID with guild ID It could work?
const profileSchema = new mongoose.Schema({
serverID: {type: String, require : true, unique : true },
users: [{userid:String, Bank:Array}],
});```
this is one way to solve it, but a bit harder to use if you dont know how.
what trynna do
All started here
const profileSchema = new mongoose.Schema({
uniqueID: {type: String, require : true, unique : true },
serverID: {type: String, require : true },
userID: {type: String, require : true },
coins: {type: Number, default : 10 },
bank: {type: Number, default: 0 },
tier: {type: Number, default: 0 },
nlavoratori: {type: Number, default: 1 },
});
``` would also work
as unique ID you can pass something like guildid+userid
would make a snowflake that wont cause issues if your bot and users share mutiple guilds
but, if I change the schema rn, It Will change in mongodb?
trying to make a lb command and post top like 10 highest numbers?
yes, but there are a lot of issues.
i just tell the truth lol
np
i would say a lot of it is down due to language barriers
what do you mean?
i think a lot of the stuff ive told you you dont really understand due to a language barrier.
I think the same, and I'm really sorry for this, U really tried in helping me and I'm very grateful
nah no problem
the thing with the snipped you provided initially is that your code doesnt call the database at all
oh I might have an idea
I'm here for listening
I would prefer both, but if It Is easier I can use Only bank
Total
ok
ah ffs, for me to help you would need to add to the schema a totalAmount
which is basically .coins + .bank
I add in the schema Total ammount and how I secolare It?
secolare?
you can try using .updateOne, but I cant help rn
lets make easier, lets use bank for leaderboard
because for my .double command I use bank I and I would like to do somethin like .rob in the future
so lets use bank
Upto you
ok bank it is
Concurrency - async
and since the whole .py is async
yeah
I use requests in my cronjob that runs every hour 
Since I'm not doing anything that needs concurrency, I don't need to make it asynchronous
so since you have done most of it its basically just editing some of your code but for me the easiest way to probably do it is to first get the guildID from the database
let user = await profileModel.find({
guildID: message.guild.id
})```
then use `let index = 0;` which will help with the leaderboard numbers
then all you need to really do is sort the users in order. Then user `.slice` to get the first 10 users.
You already did some of it so all you really need to do after is map it
```js
let user2 = user.sort(function(b, a){return a.bank-b.bank}).slice(0, 10).map(user3 => `${++index}. <@${user3.userID}> - ${user3.bank}`)```
arr.map((elem, index) => `${index + 1} foo`)```
you know you could just use $sort right?
I mean
true
but I find that this way was easier, but if theres an easier way
then add onto it
for the leaderboard i would use find not findOne
yee my mistake typing findOne
async
depends on the context, some stuff makes no sense to run async
well requests do
@earnest phoenix dms dude
Requests don't always need to be async
https://srcb.in/KPK02AJDwT
Like this?
don't you have to, like, configure your server and authentication when you use mongoose? I don't see you doing that
I want replace all occurrences of stroke-[a]bc to stroke-[A]bc. Where a is any letter which gets capitalize.
You'll need a regex for that, make sure to escape the brackets with \[ and \] because those are special regex characters.
Raw strings ftw
you mean the admin user and password?
I mean... an actual login. the URL to mongo.
thx
It might be in some other file
No because they're importing mongoose here and doing a Collection initialisation.
which would be more better? mongoose or firestore?
firestore is a cloud database, mongoose is an ORM for mongodb - which could be on the cloud, or you can host it yourself
if you're looking for a cloud database, I think either one is fine
but honestly it's better to host the server yourself for bigger projects
though cloud services make scaling a lot easier
eh, both are good choices
cloud services get too pricey tho
sqlite is more than enough for most projects tbh
kinda hard to scale though, no?
depends on your needs
the only thing sqlite cant do is concurrent writes, but most projects wont ever reach such scale
Depends on what you mean by "scale" because really sqlite can store terrabytes of data and be read on a pretty massive scale before it has any issue.
sqlite with sychronous:off will queue all writes at the OS level, so it doesnt block your app, even if you multithread
Just because it doesn't have a special TCP protocol and server, doesn't mean it's not a perfectly valid database ๐





