#development
1 messages · Page 1649 of 1
how about on the message event
probably, it's been awhile without working on this one
i'll check real quick the whole thing is a big mess
@slender thistle how can i replace a thingy in a dict?
so its kinda complicated but like i have a dict
and i have a nested dict inside
message.mentions.users.first()
^
Any example you can provide?
okay so lemme get it up
yes 1 sec
https://mystb.in/IncludesShakeFotos.python this is the dict
i want to make another "role" in it, that copies whichever role has the default tag as True
with another name
? they want the first channel mentioned
what?
that has nothing to do with anything lol
i don't want no user i just want the channel.
lol
alr
yep i got all the time in the world
take ur time lol
alr just ping me or dm me whenever u can
cuz its some pretty bigbrain stuff
i think the problem is with me not having message defined properly
ohhh fff
i forgot i am using a command handler that's not mine
// this not like this
callback: async (message, args)
// this like this
callback: async ({ message, args })
forgot that this project is outdated as hell
lol
Well, I moved to discord.js and am facing some errors
Whenever i type node .
It shows CANNOT FIND MODULE
Can someone help mw?
Me?*
wut AI?
@earnest phoenix I used your own code to code the nuker lol and yes I know it was from you give me 1 day
uhmm this is the wrong place for that
well, what module?
just do pip install the missing module
lmao
what
Big brain lmaoooo
do pip install discord.py
you just said you're using discord.js and node
Wtf
I mean , yeah
yep
u can't use discord.py in node lmao
why the fuck are you using a discord.py module
wtf
I mistyped
he probably uses them both lol
lmao
then install it
npm i discord.js
ohh ye
that's how u install modules in node
@sick fable https://docs.npmjs.com/cli/v6/commands
write one yourself
u say it as if it was the easiest thing
@earnest phoenix @client.command()
async def ban(ctx):
for member in client.get_all_members():
await member.ban(reason=.)
await ctx.send(Banned All)
Does using $push in mongodb create an array if it doesn't exist?
try it and see
if you use mongoose, you have to define an array in your model first
i want to start a bot
read the docs for the Bot from where you downloaded it (if you wrote it yourself, most good docs tell you how to start a bot)
@vast ingot write some code
yes, you need to write code
Read this #502193464054644737 message
Then read this #development message
@vast ingot ^^
thanks
One message removed from a suspended account.
One message removed from a suspended account.
apparently aye
One message removed from a suspended account.
I have class with static async functions, How can I acess a function in the class, which is in the class
Ex:
class test{
static async hello(){}
static async bye(){
hello()
}
}
can I access hello in the class?
test.hello()
oh, thx
this is really sad, I scroll down the channel and see tim with a green name
lol
*mint green
xd
Are you not able to change the background color with HTML?
It works in preview but when I save it doesn't apply.
How can I export my client in a file without passing client in a fuction?
can I do const {client} = require("./bot.js")?
test.hello()
about this solution, I am already informed. But I am searching another solution. without requiring client in every file (plugins like welcomer ...)lol
I already got anwser lol 
lawl im l8
- why would it matter if you require the client
- what are you doing that needs a client export rather than just passing the client through a function
well that's all on how u build it.. you can have your auxiliary files take in the client function as an argument
I load every function on the client and every plugin is Connected
Module
-> Global Guild
-> Moderation
-> Event Logging
yes, ik lol
I found another solution
kill
pain when you have 2 pcs and 2 different keyboards 
this seems like terminal to me
index
const {Client}=require('discord.js')
const commands=require('./commands.js')
//do things
client.on('message',(msg)=>{
//do things
if(howeverYouPlayWithText===someValidCommand){
commands(commandArgHoweverYouDo,Client)
}
})
commands.js
//now you don't need to require Client here
function commandHandle({prefix,text},Client){
//do your stuff here(Client would be the Client of your index.js)
}
module.exports=commandHandle
Yours Truly typing..... | Since 5 minutes lol
do you guys have any recommendations on documents on how to make a discord.js ai?
ik
it would though
its pseudocode
try it
is that a question? thats the method I already use lol
i have something that works that uses the concept of passing vars through just like that and it works smoothly
I would just load your plugins dynamically in your index
oh.. yea it's just psuedo lawlll
ah
I mean mine is pretty simple
i was late again? ;-;
no I don't think so
import TeranoWorker from '../lib/TeranoWorker';
export default (worker: TeranoWorker) => {
worker.on('READY', () => {
// code here
});
worker.on('SHARD_READY', (shard) => {
// core here
});
};
this is what I do for events
just pass the workers
I need to change it to more of a ```js
export default {
event: "READY",
exec: () => {
}
}```
ooh typescript
look into tensorflow.js
ye
but AI stuff is not really easy,
and "AI" is vague
should I export a function and use the file name? or should I do what I was saying
if you want a filter you could use Regex
ex.
// READY.ts
export default () => {}```
also if you use a "Free" host they wont allow you to run Tensorflow on it
regex for a filter instead of a ai?
regex is possible, and way easyer
bruh you basically said you wanna build a vehicle.. and ur asking us how as though it's so specific
either that or im misunderstanding what u mean by "ai"
Dude you type so sloww
what of it
but u can bypass regex cant you?
he wants to use an AI to detect bad words. it works, did it myself, but if you have no idea how to use js better use simpler stuff
No
you can bypass everything if someone is bored enough
Regex wont work here well
you can do an imperative approach
As you need to find play on words: fuc k f ck fuuck
and regex allows this, but is probably a pain to setup
Regex is strict
the imperative approach isn't strict but it will probably cost u 50 lines
you can set ranges
and braincells
im just stupid-
there is no way im just hard coding an imperative approach on picking up cursewords
it's possible.. just think through the patterns
the logic of how it seems on a string
you can even make it array like and examine that way
there is a npm libary for that lol. I use my own regex xD
so i should make a regex which detects these patterns?
should I send you a link of all bad words lol in a array?
then you do not need a regex
That wouldnt be good
hold up.. an npm library for picking up cursewords? pls send xD
I can stil do fu ck
ok.. if you split the text and filter off anything that isn't a letter you can pick it up
^^method 1
I had one for java
uh sure thanks
It chopped the letters
and u get back the curseword
also number one thing before these steps.. text.toLowerCase()
i'd actually really appreaciate that
you could also use some bad word detection API, but this will get you rate limited rather quickly with a Discord bot
Make your own api
u mean module?
Either works
rn im just removing all symbols and cases and detecting if the word is bad words
but "fu ck" can bypass it
ive made myself an AI Powered API for detecting bad behavior, its possible
remove all spaces then too
but then u make so many mistakes
like "son i got ..." gets censored
like grape==rape to it
I split at each letter with regex
Then added them into many differnt combinations and then checked them
That uses custom chat
any word that doesn't belong in their dictionary is censored
but theres a lot of non bad words-
it's so good you can't curse
i mea
u can say for fox ache
or mike oxlong
but any variation of any curseword
aint happening
interesting..
like i mentioned earlyer the fastest aproach with a low amount of needed coding would be an API for detecting bad words with the Downside of rate limits,
the other way would be making yourself a dictionary of blocked words and check against it.
the other way is tedious and not as result bearing
are their any API's you reccomend?
idk like i said ive made my own
lemme research some stuff rq
an api is a link to communication between to processes.. like a server connecting a database to a user.. im not sure what you made but high chance it's a module(or depending on how much things there are.. a library)
for (File file : folder.listFiles()) {
final String jsonString = Files.readString(Path.of(file.getPath()));
final JSONArray array = new JSONArray(jsonString);
jsonFiles.put(file.getName().split("\\.")[0], array);
}
Is this a good way to read multiple JSON files, im not sure about that
(is Java)
hi
Does the npm keyv protect against sql injections?
Almost 100% no
because the SQL injection prevention is the job of the database using it's placeholder and string literal system rather than anything you npm
wdym
hey guys do any of you know how to make your own bot reward users for voting your server ? i'm trying to make it so it gives other roles the more they vote
so if they vote 2 times they get etc role if they vote 4 times they get etc other role
Is there any npm that has sqlite that does the protection for you?
(Checking in the npm itself)
no because thats your responsibility?
unless you're using an ORM that should auto generate the queries with placeholders
looking at keyv 's docs it's a key value pair so i assume it's going to use pre-defined queries with placeholders
if i ever find a Bot with open eval command i guess i will try and see if they use quickdb and dont protect it
but i would check 
no idea what that means but ok (i dont know how sql works that well)
include("name")
@rustic nova why this happening?
Hi! It seems like you are looking for information on how to get your bot verified.
Once your bot reaches 75 servers or more, you are eligible for bot verification. On October 7, 2020, bots with 100 servers or more that are not verified will not be able to be invited to any more servers. You verify your bot on your bot's application page, under the "Bot" section in the sidebar.
If you need more information, check out this article written by Discord about The Future of Bots on Discord and you can ask questions in the Discord Developer Server.
We cannot provide support on how to get your bot verified.
not that kind of verification
if you're using a privileged gateway intent you need to also be verified for them if you didn't request it during bot verification
oh, how many days will it take?
ig kadybat verified my bot
many
almost as lengthy as normal verification
oh no
you can, however, disable them and try to work without member caching/presences for the mean time
^
use ./
i tried that -.-
but anyway, you didn't say what's wrong at all
actually
your path is very wrong
dist is two folders above
not in the same dir
so ../../dist
how do that?
i have disabled the presence one
smh no
adapt the code
how?
code
-.- ok
bump
what does copyfiles do
copy files
idk, isn't that your own code?
my discord bot doesn't return commands
are u executing commands correctly?
yes
show code regarding the code you're trying to run
all codes of the bot
the whole bot is not running?
yes
any errors?
no
No error
Does somebody use Discord-passport ?
did u even execute the code?
yes
so how is the bot not working if u could execute the code?
ı don't know
hi
hi #general and #general-int
ok bro @exotic galleon
< 3
is the code yours?
no someone else
so, you want help about a code that you know nothing about nor have any error?
the code is working i don't get errors but my bot is not working
no
if the bot doesn't work then the code doesn't work
unless it's a permission issue
can't help u, ask for the code owner to ask for help please
but I am not like that either
There is no problem with the code I made, I am not getting an error.
but i can't run the bot's help command
so the code have an issue
simple
also, you're contradicting yourself
the code, is yours or not?
I made the code myself, you have a hard time understanding my friend
so the code is yours, correctly?
yes
show the code regarding help command
wtf is that description?
does not work on all other commands, not just help
I don't even know where to start with
im coding in java with JDA and is there a way to edit a message to remove an embed? right now im suppressing it, but this action requires the manage messages permission and id like to get rid of that
turkish
I don't mean the text actually
@quartz kindle is it possible to fetch all of the guilds that a bot is in at the same time?
hello @opal plank
hai
goodbye @opal plank
bruh
legit

if you join stream
lol
You get all guilds when you connect to the gateway, there's no way to get all guild objects via REST

spend like 20 minutes on it
and see how much easier it is
npm i ts-lib
npm i typescript
npm i ts-node --dev
ok but what is ts-lib?
huh?
hmm
useClusterClient: true,
Does somebody use Discord-passport ?
is the equivalent of shards: 'auto' for djs
🤣
why do they call it "cluster"?
because it makes more than 1 process
cause it uses the clusters api
cuz it is a cluster
Does destritus have custom caching?
what the fuck are these docs
lol
it does
commandClient.commands
here
like discord.js-light?
tim already said it before, one sec
what the fuck is the learning curve on this lib?
lol
@crimson vapor #development message
@tired panther #development message
my bad
wrong person
lets see
@crimson vapor #development message
there isnt much
guilds.get
cache.get
users.get
commandClient instead of client.commands
message.channel.createMessage() instead of message.channel.send()
its very small things
can you show me the caching option, I cant see any. I am blind lol
whut, I have to change my whole code 
@tired panther
CTRL + H to find and replace
^^
whats the main purpose of typescript
coding

wow, Can I uncache members , channels , everything without roles and guilds?
async run(payload: Context, __args: ParsedArgs) {
const message = payload.message;
const cc = message?.client.commandClient;
if (!message || !cc || !message.channel) return;
let args: string[] = __args[this.name].split(/ +/g);```
@tired panther use this as your base command
and continue after that
ignore genshin
thats mine
but the rest is the same you're used to
message
client
args
thats all
does it have this
?

@opal plank My question pls
i think so yeah
lemme check the docs
@tired panther check stream
another question: chn.permissionsFor(message.guild.me)
this gives me a bitfield. But I want to check if it has send embeds link......
export interface ShardClientCacheOptions {
applications?: ApplicationsOptions;
channels?: ChannelsOptions;
connectedAccounts?: ConnectedAccountsOptions;
emojis?: EmojisOptions;
guilds?: GuildsOptions;
members?: MembersOptions;
messages?: MessagesOptions;
notes?: NotesOptions;
presences?: PresencesOptions;
relationships?: RelationshipsOptions;
roles?: RolesOptions;
sessions?: SessionsOptions;
typings?: TypingOptions;
users?: UsersOptions;
voiceCalls?: VoiceCallsOptions;
voiceConnections?: VoiceConnectionsOptions;
voiceStates?: VoiceStatesOptions;
}```
thesea re your oiptions for caching
chn.permissionsFor(message.guild.me).has(...)
ah I am dumb lol, thx 
It is better than discord.js-light 

lol
what in the fuck how do I even get my user's name?
lol
fomr message or your bots?
bots
How much ram does your bot use @opal plank ?
client.user
800mb from 4gb that d.js was using before
not commandClient
ShardClient
(commandClient.client as ShardClient).user
commandClient.client can be either Shard(if you dont have sharding) or ClusterClient(if you enabled sharding)
what would be the best way to check permissions? an interface method which returns a list of permissions which contains the permissions the bot needs for the specific command? (java)
payload.client should give you always the ShardClient
for how much guilds lol?
lol
soo how do I get the user?
commandClient.client => either gives you a shardClient or a ClusterClient
which user?
did you enable sharding?
if not, its the same as discord.js
<ShardClient>.users.cache.get(<user>)
do you cache members and channels?
i do
ah thats way it is so high
800mb from 4gb?
this is a 1 to 1 comparison btw
i did not disable caching on detritus when comparing
mines used 6gb on discord.js lol
now just 700 mb discord.js-light
unlimited
i need a bunch of cache, though not most of it
roles
emojis
presences
edits
i dont need any of that crap
which?
how many guilds is it in?
the startup is always lenghty
well im not sure
use ur bots token and check the performance hit
ok
79
{
rss: '171.3MB',
heapTotal: '104.3MB',
heapUsed: '101.2MB',
external: '2.0MB',
arrayBuffers: '0.0MB'
}```
discord-rose test now
?
rip use discord.js light
nope
@crimson vapor now try this if you wanna give d.jslight a test
yeah I will test different libs rn pog
{
rss: '173.7MB',
heapTotal: '103.3MB',
heapUsed: '100.9MB',
external: '2.0MB',
arrayBuffers: '0.1MB'
}```
test token 1-4 servers
which options you have for disabling cache on ur bot?
if you have d.jslight with stuff disabled, make sure to disbale on detritus too
actually
@quartz kindle
oye
const master = new Master(path.resolve(__dirname, './bot/worker.js'), {
token: config.discord.token,
log: (...args: any) => { logger.debug(...args); },
shards: SHARDS,
// intents: ['GUILDS', 'GUILD_MESSAGES'],
cacheControl: {
guilds: ['name', 'description', 'preferred_locale', 'unavailable', 'icon', 'owner_id'],
members: ['nick', 'user'],
channels: ['nsfw', 'permission_overwrites'],
roles: ['permissions']
}
});```
come defend your lib
this is discord-rose
benchmark detritus vs djs-light
is this discord.rose?
yes
then make sure to disable the same on detritus
wow you can control what to cache, cool
@opal plank send
,
nope
lol
@quartz kindle Could you add this in discord.js-light tooo 
unlikely
where you can choose, what to cache
no
you cant have dynamic types based on what you set for your client
interesting

yeah just don't lol
writing in rose is a shitshow from what i understand
Ye I switched devices
can anybody send me a list of channel perm ?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
or this
idk why you even bothering with rose million
rose isnt a fullfledged library, much less a finished one
@crimson vapor
it almost is
its not out
its a WIP lib
no
it is
release very soon
where is voice support
\

then it's not "finished"
^^
lol was searching and searching xD. Thx for the right link 
no probmlomo
also the wiki is 3 pages
even the generated garbage docs from detritus is better

its 3 from what i can see
the basics
the npm
and the commandhandler
thats all
theres 3 pages with 50 lines each
yea true
the commandHandler wqith roughly 100
theres no docs at all
just examples
detritus is the opposite
its all docs
and few example
d.js has both, hence why its liked

wdym, i sent you how
,
hmmm
the reply is all the options you have
ok
@quartz kindle you're leggaly required to benchmakr this
d.js vs djs-light vs eris vs detritus

dont you dare run away
benchmarking is your job, and you know it
how is it too small?
how is it NOT small?
its not even out
theres probably 20 people using it at best
and most of them cuz they're here hearing about it
well yeah
I thought you meant small as in like capabilities
i dont keep up with rose development, so i cant comment on it
lmao
right
does eris seriously not have bundled types
lol
nu
back to the basement you go
benchmark moke
Hi
detritus should win anyway
You're going to Brazil
wait rlly?
with equal caches yes

if they are really more efficient at storing
djsl just makes caching optional, doesnt make it more efficient
{
rss: '135.2MB',
heapTotal: '85.4MB',
heapUsed: '83.2MB',
external: '2.0MB',
arrayBuffers: '0.0MB'
}``` eris
wait at least 5 minutes
garbage collectors are finicky
bruh
specially when the bot starts
ok
it caches a lot of stuff
I wait for the initial gc
const { Client, Collection } = require('discord.js')
class EconomyClient extends Client {
constructor() {
super();
this.discord = require('discord.js');
this.fs = require('fs')
this.path = require('path')
this.mongoose = require('mongoose')
this.commands = new Collection();
this.timeouts = new Collection();
this.config = {
prefix: 'e!'
}
}
commandHandler(path) {
this.fs.readdirSync(this.path.normalize(path)).map((f) => {
const File = require(this.path.join(__dirname, `..`))
})
}
};
module.exports = EconomyClient
My code so far in my economybot
please don't do this like this
use imports correctly
doesnt look like ts btw
its js
so either way you wouldnt be getting intellisense
what js has intelliense
but yeah, you could use import/export for es6
you wouldnt be able to call the economy class
vscode supports JSDoc annotated code
jsDoc
@sour flame why are you saving require calls to properties?
yes
not autoimports from classes
which is TS light™️
That doesn't have anything to do with the class. You should require it at the top of the file instead.
ik, try the others aftera while
on DJS
yes
it'd be best to test on larger tokens
the commandClient will clearly be heavier than the other packages, but it should put up a fight fairly easily with the other ones
cause I'll be using it later on and I can't put constructers at the top of a file(well idrk)
since the commandClient is heavier than the other libs since it supports a LOT more features
You can require it at the top of your files: ```js
const Discord = require("discord.js");
class A extends B {
// stuff
}
how did that happen
console log guildcount too btw
//stuff does what?
cringe
comments, doesnt get run in code
It's just a comment (only for readability).
oh bruh
how many guilds million?
79
can you make me the example client?
send me what you got
(node:63493) UnhandledPromiseRejectionWarning: Error: > Couldn't find a `pages` directory. Please create one under the project root```
this is next.js
?
@crimson vapor ```ts
import { CommandClient } from 'detritus-client';
const commandClient = new CommandClient(token, {
shardCount: 1,
prefix: '?',
});
commandClient.add({
name: 'ping',
run: context => {
return context.reply({
embed: {
title: 'Pong! DETRITUS',
description: ${Object.entries(process.memoryUsage()).reduce( (T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T), {} as any, )},
},
});
},
});
commandClient.run();
setInterval(() => {
console.log(
Object.entries(process.memoryUsage()).reduce(
(T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T),
{} as any,
),
);
}, 1000);
Says it only takes 1-3 mins this is taking a entire year to finish
uhh what
I should test with deafult cache?
wait lol
Is someone able to assist with this: https://gyazo.com/66e2ccb60930ada361870427a033ba46
@swift cloak https://github.com/vercel/next.js/issues/8893 here a same issue
@crimson vapor use this to see how well it handles with the minimum cache, members, channel, guilds
import { CommandClient } from 'detritus-client';
const commandClient = new CommandClient(token, {
cache: {
applications: { enabled: false },
connectedAccounts: { enabled: false },
emojis: { enabled: false },
members: { enabled: false },
messages: { enabled: false },
notes: { enabled: false },
presences: { enabled: false },
relationships: { enabled: false },
roles: { enabled: false },
sessions: { enabled: false },
typings: { enabled: false },
users: { enabled: false },
voiceCalls: { enabled: false },
voiceConnections: { enabled: false },
voiceStates: { enabled: false },
},
shardCount: 1,
prefix: '?',
});
commandClient.add({
name: 'ping',
run: context => {
return context.reply({
embed: {
title: 'Pong! DETRITUS',
description: `${Object.entries(process.memoryUsage()).reduce(
(T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T),
{} as any,
)}`,
},
});
},
});
commandClient.run();
setInterval(() => {
console.log(
Object.entries(process.memoryUsage()).reduce(
(T, [K, V]) => ((T[K] = (V / 1024 ** 2).toFixed(1) + 'MB'), T),
{} as any,
),
);
}, 1000);
JSON.stringify() btw
inspect
now it will
<a:emoji:id> @quaint wasp
^^
@crimson vapor also add on the console log which branch that it
yes

I tryed it didnt work.

DJS | DJSL | DROSE | IDK HOW TO SPELL | ERIS
so
no-
detritus lower than d.js and rose
id is the ID of the emoji

the id is missing bruh
!pepowot @quaint wasp example
lmao
thats for regular emojis
no
d.js and djs failed
and eris
a planet failed?
yes
there is no eris bot running
get rekt
notes, connectedAccounts and relationships? 
im dumb
dunno
check their server lul
i havce no clue what those things are for
might as well ask the dev directly

on startup
1. discord.js-light
2. discord-rose
3. eris
4. idk how to spell
5. discord.js```
lmao
see?
timmy is better
but i think of hortons when i say that
I'm guessing my bot's working
explain what?
detritus is last
on startup
other than djs
show console
these kind of comparisons are not fair at all lul
^^
shhhh
you're comparing cache vs no cache
thats why i was telling tim to benchmakr it
but he ran away
and even with cache, different libs cache different things

tim you like benchmarking
like discord rose, caches only a few things, its not a fully featured lib yet
otherwise I could turn off cache and drose would win because there are no classes
benchmakr them
yeah
if you wanna benchmark cache efficiency
get 100k member objects
and cache them in different libs
using their native member object constructors
lmao
i got 560k
@royal knoll
that or whatever
or better yet
xet probably gonna hit me in the head for that one
@woeful pike
I’ll benchmark
would you mind helping benchmark libraries with a bot ONLY on this server?
1. discord.js-light
2. discord-rose
3. eris
4. discord.js
5. idk how to spell```
I don't have guild members or presenses but my bot is here ¯_(ツ)_/¯
same
Wot
rss doesn't matter early on imo
hi voltrex what’s lua
i call bs
tbh heapUsed is a fairer indicator
thats what im using
rss is the majority of your used ram
because you're measuring just js data
do you have guild members?
Huh?
nah
im calling xet for this one
yeah same
you can compare for rss as an indicator of memory leaks on the websocket decompression lol
what benchmark
but the js heap is the actual cache data
to see if xet can get a test bot here to benchmark every js lib
a single bot
no permissions
here
just a bot
why do you need me for this? 😩
having a bot in a single guild will make it a fair comparison
you're admin
because you’re cool
cuz only you can add bots here






