#development
1 messages · Page 1621 of 1

parle français pour voir ? (baguette,fromage interdit)
Hello to you too
if "cod" in [role.name.lower() for role in ctx.message.author.roles]:
That will loop through the member's roles and check if any of them are named "cod"
The long version would be
for role in ctx.message.author.roles:
if role.name.lower() == "cod":
await ctx.send("You can play cod")
break
in js is it possible to access a static property on a class with the instance?
I think accessing .constructor on an instance returns the class.
But if you know the class, you should just type it out like MyClass.myStaticProperty
will it also work on the class which inherits a parent class
here, I want to access the child class' static property
How long does it take for a user reactions rate limit to time out?
If the property is on the parent class, yes.
message.channel.awaitMessages(filter, {
max: 1,
time: 7000,
errors: ['time']
})
.then(message => {
message = message.first()
knockCameFrom.send(message)
})
.catch(() => {
message.author.send('Times up!');
});
})```why does this only check the server and not the users dm?
Wonder which one is faster between that and any(role.name.lower() == "cod" for role in ctx.author.roles) or discord.utils.find(lambda r: r.name.lower() == "cod", ctx.author.roles) is not None, but I doubt they make significant differences 
Yeah, there shouldn't be any noticable difference. It's just that one of them is in one line and imo that makes it less messy
y ts doesn't hv static abstract members? 
im really concerned about that indentation @earnest phoenix
also ts supports asbtract classes/interfaces
so not sure what you mean
not the indentation itself, but the fact that it has so much space leads me to believe your code is getting enourmous
which is a red flag
One message removed from a suspended account.
yeah I need to separate it into other files
One message removed from a suspended account.
I meant this
abstract class A {
static abstract absValue: null;
}
class B extends A {
// should through an Error for not defining the absValue
}
One message removed from a suspended account.
i dont think abstract type is a thing
which is what you're trying to do
abstract simply merges an interface/class
yeah, that's what I was expecting to be a thing in ts
it cant be initialized itself
so using a non initialized class as a type will likely fail
what you're saying is that it SHOULD error but isnt?
yes
so we could define a same static variable for all the child classes
🤔
thats a bit too far for me to tell tbh, so i cant give much input, i'd recommend creating an issue on the ts repo
to ask about it directly
as far as my understanding goes, you can only abstract a class or an interface, not a type
so using the keyword abstract inside there should throw an error
thats what i meant, you cant abstract a type
static is fine
abstract is the issue
since it doesnt initialize itself
so you shouldnt even be able to abstract it inside there, as it has no extension
yup, just like i thought
you're calling it as a type, which should give this error
hmm ok thanks 👍
Cool
if you compile this(without the last line) it should throw
cuz im calling an abstract class
actually my bad, this is referred to type
like i mentioned, abstracted classes/interfaces cannot be initialized
though you can still infer to their types
"composition over inheritance" -anonymous
how can I define a type of "any Child class of a particular abstract Parent Class"?
You would have to use Child1 | Child2 | Child3
that would be cumbersome task
also is it possible to change the typeof abstract class to a normal class, temporary?
If you just want a generic type, you can just use the parent class
class two extends absparent {...
const thing = new Map<string, absparent>();
thing.set("pog", two); //valid since two is an instanceof absparent
not while a process is running unless you unreference every instance of that class to the root scope and re-initialize every extension of that class with a new resolved module after dropping require cache
if a process isn't running, then yes
actually Im trying to create a FactoryClass
A factory function is any function which is not a class or constructor that returns a (presumably new) object
That was just from a quick google search, because I have never heard that term ever
Is it possible to ignore a particular error on a line? Not all of them
do u hv realised that, I was asking all these in ts context
Yes
ooh ok
is try catch not apart of TypeScript
I want to ignore the ts error
So then. What's the error
I want to ignore just this "Cannot create an instance of an abstract class."
That's not a TypeScript error. That would be a runtime error as abstract classes usually don't have any constructor signatures. You shouldn't try to instantiate one
abstract class dont exist in js
The JS equivalent would be a function
so it wont through an error I guess.
And I know, I'm not gonna intantiate the abstract class, but its childs
You should just resolve the error, but if you REALLY know what you're doing, you can just put a // @ts-ignore over the error
yeah, but that would ignore all the errors on the next line
I just want to ignore a specific error, on next line.
If there's a thing like that
Phhheww! finally. Thanks though 👍
has anyone used paypal node sdk for integration?
i would use something like chargebee, paypal can be easy abused since you have to handle a lot of stuff yourself
i have no other option
so my question with paypal is that, when you have the return url they dont send the price with it, but in the return url i need to call some execute method to execute the payment which requires price
regional issue ig?
i'm not sure if its available in my country
will have to check
i tried stripe, but they were not allowing individuals to receive payments in my country >.>
lol
pain
chargebee is quite nice, i dont use it for now but brain uses it for Trivia bot
@crystal wigeon bro, use razorpay. It supports all payment gateways
paypal also has high tax %
i tried razor pay
but they couldn't verify
my bank
🤔
they took weeks to respond
yeah
they dont have a "gaming" business model support
finally my paypal got verified but only accepts international payments
like bruh
they shutting down domestic
payments
turkey? ohh wait its banned there
lol
i might try brainTree next
so coming back to my original question
how would i get the price in the success return url
never worked with it ¯_(ツ)_/¯
just ask
#justask
Somebody is spamming get requests to my server(100 per second)
What should i do?
its from google console
i want to write a defender to defend it
I find that, read and would be util
Hello, this is what I am facing when I am removing reaction first time it's showing name: emoji, but when I again remove the reaction after adding it's showing name: false due to some reason. Code output: https://pastebin.com/VraTGgxJ
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I have more of a question regarding Code Convention. I use the ImageIO class in Java to draw and it needs exception handling on read and write. Should I put a try catch block only in these operations or put the whole part in one big try block?
i'm trying to do an animeme command but everytime i run it i only got 2 memes, i got 2 memes on eveyr subreddit, help ?```js
const Discord = require("discord.js");
const randomPuppy = require('random-puppy');
module.exports = {
name: "animememe",
cooldown: 1,
aliases: ["animeme", "ameme", "animem"],
description: "Anime meme",
usage: "animememe",
run: async (bot, message, args) => {
randomPuppy('goodanimemes')
.then(url => {
message.delete().catch(O_o=>{});
const p = new Discord.MessageEmbed()
.setColor("GREEN")
.setTitle("**Anime Meme !**")
.setTimestamp()
.setImage(url)
.setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL({ dynamic: true }));
message.channel.send(p);
})
}
}
Like i got the same 2 memes everytime
sorry for resend
client.user.setActivity
do you get any errors ?
It should work
yeah, with not working u mean the bot has no status ?
ı tryed this too
and nothing happened
can I see the code
Want a github sources?
No I want to see the client.user.setActivity line
ok
`const ;chalk = require("chalk");
const moment = require("moment");
const Discord = require("discord.js");
const ayarlar = require("../ayarlar.json");
var prefix = ayarlar.prefix;
module.exports = client => {
console.log(
[${moment().format("YYYY-MM-DD HH:mm:ss")}] BOT: Aktif, Komutlar yüklendi!
);
console.log(
[${moment().format("YYYY-MM-DD HH:mm:ss")}] BOT: ${ client.user.username } ismi ile giriş yapıldı!
);
client.user.setStatus("online");
var oyun = [
"3",
"2",
"1"
];
setInterval(function() {
var random = Math.floor(Math.random() * (oyun.length - 0 + 1) + 0);
client.user.setActivity(oyun[random], "");
}, 2 * 2500);
};
// Set the client user's activity
client.user.setActivity('discord.js', { type: 'WATCHING' })
.then(presence => console.log(Activity set to ${presence.activities[1].name}))
.catch(console.error);
n`
my ready.js
try crypto currencies
Can i attach an image to an embed without have to locally save it? (using JDA)
im doing some imageio work with it, so i have a bufferedimage
¯_(ツ)_/¯
Yeah uploading an urls are working, maybe im finding something
because i want to minimize the ImageIO calls
Hey, I have a problem to my snipe.js
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = {
name: "snipe",
description: "Affiche le dernier message supprimé du channel.",
usage: "snipe",
run:(bot, message, args) => {
const msg = message;
if (!msg) return message.channel.send("❌ Il n'y a pas d'ancien message supprimé !")
let SnipeEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.addField(msg.content)
.setColor("RANDOM")
message.channel.send(SnipeEmbed)
}
}
Error:
Error:
(node:1870) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘tag’ of undefined
11:56 AM
Jump Toat Object.run (/app/Commands/Moderation/snipe.js:14:35)
11:56 AM
Jump Toat module.exports (/app/Events/Messages/message.js:46:11)
11:56 AM
at processTicksAndRejections (internal/process/task_queues.js:93:5)
11:56 AM
(Use node --trace-warnings ... to show where the warning was created)
11:56 AM
(node:1870) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see Command-line options | Node.js v15.10.0 Documentation). (rejection id: 1)
11:56 AM
(node:1870) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
message.author is undefined
o
yes but
oh wait, I modified:
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = {
name: "snipe",
description: "Affiche le dernier message supprimé du channel.",
usage: "snipe",
run:(bot, message, args) => {
const msg = bot.snipes.get(message.channel.id)
if (!msg) return message.channel.send("❌ Il n'y a pas d'ancien message supprimé !")
let SnipeEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.addField(msg.content)
.setColor("RANDOM")
message.channel.send(SnipeEmbed)
}
}
same error to the tag
with message.author
if you want to show the deleted message's author and icon
Why
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = {
name: "snipe",
description: "Affiche le dernier message supprimé du channel.",
usage: "snipe",
run:(bot, message, args) => {
const message = bot.snipes.get(message.channel.id)
if (!message) return message.channel.send("❌ Il n'y a pas d'ancien message supprimé !")
let SnipeEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.addField(msg.content)
.setColor("RANDOM")
message.channel.send(SnipeEmbed)
}
}
line 10
just change it back to msg
did u type some in index.js
and use .setAuthor(msg.author.tag, msg.author.displayAvatarURL()) instead
here
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = {
name: "snipe",
description: "Affiche le dernier message supprimé du channel.",
usage: "snipe",
run:(bot, message, args) => {
const msg = bot.snipes.get(message.channel.id)
if (!msg) return message.channel.send("❌ Il n'y a pas d'ancien message supprimé !")
let SnipeEmbed = new Discord.MessageEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL())
.addField(msg.content)
.setColor("RANDOM")
message.channel.send(SnipeEmbed)
}
}
cannot read porperty 'get'
Full error?
just the line 10
Are you sure bot.snipes exists?
in discord.js yes

Not in discord.js for sure
It must be custom
Add console.log(bot.user.id, bot.snipes) above const msg
Run the command again and check the output
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
O_O
I don't defined user I think
wait
its client
but the same error with id
oh
@pale vessel I changed bot to client and I have this: const msg = client.snipes.get(message.channel.id)
error with get
It doesn't matter what you call it
The problem is your handler not passing the correct reference to client
my event message.js?
Yes
my command.run?
Try console.log(client) and check what it actually is
Yes
this first
See
You need to pass client OR remove client from your run function
bot and client is the same, depends on which one you name it
yes but client is not defined so
command.run(bot, message, args, prefix); or command.run(client, message, args, prefix);
Whatever you called your client
yes I think
Like your ping command
wait
but
my ping command
has error
(node:6248) UnhandledPromiseRejectionWarning: TypeError: command.run is not a function
at module.exports (/app/Events/Messages/message.js:46:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:6248) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
my ban command: async execute(message, args, prefix) {
Check your exports
It's called execute on that one
but you use run
Change it to run
so I use: run: (message, args, prefix) { ?
The ping command still doesn't work?
all commands don't works
You said the ban command works
yes i tested but no

with the error command.run not a function
run
You sure you haven't missed a command?
Add console.log(command) to check which command threw that error
yes
wait
const discord = require("discord.js");
const { discordInviteLink } = require('../../config.json');
module.exports = {
name: 'discordserver',
description: `Envoie un lien d'invitation au serveur support de Synapse.`,
usage: 'discordserver',
guildOnly: true,
async run(message) {
message.channel.send(discordInviteLink);
}
}
@pale vessel cannot read property 'send'
or undefined
command.run(client, message, args, prefix);
If you remove client, you can still access it by using message.client
All right
Do it to all commands
oh
ban command
(node:9855) UnhandledPromiseRejectionWarning: Error: val is not a non-empty string or a valid number. val=undefined
at module.exports (/app/node_modules/ms/index.js:34:9)
at Object.run (/app/Commands/Moderation/ban.js:15:21)
at module.exports (/app/Events/Messages/message.js:46:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:9855) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9855) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ban command: https://hatebin.com/olqaeonqsy
and mute commande don't works too
does node.js is running on multi-cores ? or I have to setup it?
oof
But I have a problem:
My code: https://hatebin.com/soevascgit
My error:
(node:13342) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'users' of undefined
at Object.run (/app/Commands/Fun/hack.js:7:35)
at module.exports (/app/Events/Messages/message.js:46:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:13342) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
just ask
If you're here to only say "hi", please go to #general
This is development channel, not a place to have a conversation about life.
bruh, everyone takes tim's help but no one asks how is he or how is his day going
ok ok
I tried to run discord bot in a multi processor and this happend lmaoo
how can i get the number of servers i am in from this console?
i tried
const id = "my id";
id.guilds.cache.size;
you ran it wrong then lul
xd
It's not that easy.
wait what
but for my bot all i do is bot.guilds.cache.size
command.run(message, args, prefix);
you cant
what all can we get from that console then?
is there any way to run like one processor is for d.js and another is for express server (dbl stuff)
no
your run function is (client, message, args)
you execute it with (message, args, prefix)
Yes
thats your problem
Just run it in different processes
you can use pm2/screen or 2 terminal if you have gui
Run it separately
or use worker threads if you want everything to be tied together
oh thx
but i want to pass variable between it
but
...
you need ipc
@quartz kindle
(node:14711) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'bot' of undefined
at Object.run (/app/Commands/Fun/hack.js:33:20)
at module.exports (/app/Events/Messages/message.js:46:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14711) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14711) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
inter process communication
I need to add "bot" to my command run and execute?
bro, you have not defined bot
you defined it as client not bot
do
const bot = discord.Client
You need to practice and learn ig.
i started with java
Oh and also be expert at searching google
oh
my command is a fake hack but I can "hack" bot and client so how to use bot and client?
???
wait, i have something for name not to be taken
like the dank memer?
eh, do i mean, you have defined it as client, so use client, no bot
you did mentions.users
so member is a User, not a Member
then you do member.user.bot
I think i will go back to 1 processors, this makes my brain explode
yes but if its a bot
which is the same as user.user.bot
that member is not a member, its a user. you are doing user.user.bot
you can do member.bot yes
oh
tim, my bot shows the slash command bot it doesn't work
but you should probably clarify that its a user and not a member
the code
Also, what are you doing, lmao? Generating fake token / client ids for bots?
what do?
i've never used interactions, but you have an error in your terminal, how about showing that error?
alright
yes, meme line 12
then check the return value of the api call
its a promise, you should at least resolve it and/or catch it
also log interaction.data.options to make sure thre really is an index 0 with a name
this the code
ofc man
i was talking about client.api.interactions
but you can fix that one also while you're at it
wait, can you also correct my meme command?
show imageapi
yes
its attempting to parse a response with json
but the page is not returning a json response
oooooooh
how fix?
catch it
ok
img = await api().catch(() => null)
if(!img) return message.channel.send("failed to get image")
@river panther Your token is invalid wherever you're trying to login
oh
or
it didnt get a token
@river panther did you make the code yourself or is it a tutorial?
a friend
whats their name coz we might have the same friend l0l
Salvage_Dev?
looks like his tutorial
i used to moderate for him
Oh well
@river panther did you fix it?
lol no
yes, he is, he banned me because i was trying to ask him if i can ip ban a guy using anip grabber
and he banned me for it
tf?
yes
Can we go to dms coz i used to be his mod...
yea i quit
coz i was bored
but ok
thats off topic
Did you fix the token issue? @river panther
yes
dont show ur token here tho
whats token defined as?
?
but my token is there
Hi milo
remove it smart guy
oh wait, bro unban me

;help
Can i complain for mod back
@icy maple
#test
show us how you defined the token variable
oop
like const token = xyz
ty
i have done it as
{
"token: "the token was here"
}
lol
omg not the json file
thats not what im asking
then?
oh
const token = something
yes
should look like that
whhats the erorr you having

Hi
the bot is not getting the interaction token
yes
wait for v13
oh interaction
when its stable
yes
thats what my friend said
thank you
and unban me
STOP IT DAMN IT
Leave it for DMs
@nocturne peak gib mod back (im joking i quit for a reason)
Hi, may I ask question about bash development or is this channel only for bots ?
General development questions are allowed
I'm testing something. If it doesent work ill ask here
can someone just remove that (bot) in the topic since that shit always confuses everyone
cc @modern sable
2021-02-28T12:42:50.045160+00:00 app[worker.1]: url: item.channel.thumbnails?.default.url,
2021-02-28T12:42:50.045161+00:00 app[worker.1]: ^
2021-02-28T12:42:50.045162+00:00 app[worker.1]:
2021-02-28T12:42:50.045162+00:00 app[worker.1]: SyntaxError: Unexpected token '.'
wat i do
yup
const img = await fetch('https://example.com/example.png');
typeof(img) //Buffers
@earnest phoenix how
Update you node.js version
if you use axios const response = await axios.get(url, { responseType: 'arraybuffer' }) const buffer = Buffer.from(response.data, "utf-8")
solved
my package is got outdated
thats why
message.channel.send(new Discord.Attachment(buffer, "image.png"));
ok ok
https://discord.js.org/#/docs/main/stable/class/MessageAttachment buffer first, actually
oh yeah 🍭
sorry, I use { files: [{ attachment: buffer, name: "image.png" }] }
just thought MessageAttachment would be easier to use

const final = new Uint8Array(result.data);
const img = new Buffer.from(require('../../tools/function/typedArraytoBuffers')(final))
console.log(img)
return require('../../tools/function/sendMessage')(message, {files: [{attachment: img, name: 'image.png'}]} );
https://cdn.discordapp.com/attachments/808732842178773012/815572205547028490/image.png
help it returns me this thing
<Buffer ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ... 262094 more bytes>
smh
Hi, I'm trying to check if nginx is installed and if not, install it. (bash file)
https://share.thehostingbot.xyz/rlTSMYm.png
It always install nginx whether it is installed or not
You're creating a buffer with Buffer.from, what do you expect it to be
the image getting rendered to your console?
The buffer is most likely not correct.
Then pass the ArrayBuffer to the Buffer.from function
I did that
require('../../tools/function/typedArraytoBuffers')(final) Showing that function would help
module.exports = function typedArrayToBuffer(array) {
return array.buffer.slice(array.byteOffset, array.byteLength + array.byteOffset)
}
You can do Buffer.from(final) too, the Buffer.from accepts any iterable
14 adds optional chaining its even better
no it doesn't works
what happens
And what is result.data btw
Are you trying to convert a base64 string to a buffer?
const buffer = Buffer.from(ArrayBuffer, "utf-8") did you tryed this?
how did you make the array?
Where are you getting that from
from a package
const url = user.user.displayAvatarURL({format: "png", size: 512});
request.get(url, async(err, res, body) => {
console.log(body)
const image = await Image.load(body)
console.log(image)
const result = image.grey();
const final = new Uint8Array(result.data);
const img = new Buffer.from(final)
console.log(img)
return require('../../tools/function/sendMessage')(message, {files: [{attachment: img, name: 'image.png'}]} );
});
if you use urls you could just use axios to make an array buffer
result.data is already a uint8 array, so there's no point in copying it
hmm
I think the problem is the lib
Image [IJSImage] {
width: 512,
height: 512,
data: Uint8Array(1048576) [
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255,
... 1048476 more items
],
size: 262144,
components: 3,
alpha: 1,
bitDepth: 8,
maxValue: 255,
colorModel: 'RGB',
channels: 4,
meta: {},
position: [ 0, 0 ],
computed: null,
sizes: [ 512, 512 ],
multiplierX: 4,
multiplierY: 2048,
isClamped: true,
borderSizes: [ 0, 0 ]
}
uhh
show require('../../tools/function/sendMessage')
just a reaction things
basicly message.channel.send()
damm it bro
it hsa built in toBuffer()
@lusty quest can you help me
just ask here
what
(node:6163) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6163) UnhandledPromiseRejectionWarning: TypeError: db.findOne is not a function
at Object.run (/app/Commands/Moderation/warn.js:14:12)
at module.exports (/app/Events/Messages/message.js:46:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:6163) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6163) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
One message removed from a suspended account.
Hey guys, topgg isn't working for me.
My code:
const db = require('./warn.js')
const { Message, MessageEmbed } = require('discord.js')
module.exports = {
name: 'warn',
description: `Warn un membre du serveur.`,
usage: 'warn (membre) (raison)',
requiredPerms: 'BAN_MEMBERS',
permError: "❌ Tu n'as pas la permission !",
async run(message, args, prefix) {
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
if(!user) return message.channel.send(`❌ Je ne trouve pas ${args[0]} !`)
const reason = args.slice(1).join(" ")
db.findOne({ guildid: message.guild.id, user: user.user.id}, async(err, data) => {
if(err) throw err;
if(!data) {
data = new db({
guildid: message.guild.id,
user : user.user.id,
content : [
{
moderator : message.author.id,
reason : reason
}
]
})
} else {
const obj = {
moderator: message.author.id,
reason : reason
}
data.content.push(obj)
}
data.save()
});
user.send(new MessageEmbed()
.setDescription(`You have been warned for ${reason}`)
.setColor("RED")
)
message.channel.send(new MessageEmbed()
.setDescription(`Warned ${user} for ${reason}`).setColor('BLUE')
)
}
}
anyone use grafana?
Git keeps warning me that im exposing my URI connection string, but I'm storing my password in an .env file so im good or?
never commit .env files
unless private
no the env is not commited
not sure then
you will have to show more
i mean besides the password the connection string i a plain string
One message removed from a suspended account.
thats not he case the env is not pushed
One message removed from a suspended account.
are there any forbidden chars in an env file?
One message removed from a suspended account.
One message removed from a suspended account.
footer: {
icon_url: client.user.avatarURL(),
text: "© Its_IsmailZ#8826"
}
Uhm the icon should be my pfp and not the one of the bot
i love how people ping certain people in here who just havent said anything for 30 minutes
client.user refers to your bot
Use message.user
@opal plank sorry for the ping, i saw your earlier messages where you had a grafana dashboard to monitor commands, mind helping me out with that? i got it to install xd
googlefeud do you know anything about grafana?
im desperate for it rn
okay ty
with what?
well yeah, but what exactly
you have multiple ways to do that
you need to add a source
when a suer types some command i want grafana to pick up what he typed etc
do you have some docs?
apparently they have bad docs :c they didnt even specify the port it runs by default
use some time series database like Prometheus
which i found out it was 3000
or Influxdb
too much for them brain
rip
i offered prometheus for Luke which is using for the bdlstats, even he thought it was overkill
i saw the prometheus thing, but i currently dont have time for new things
for tracking commands its way too far
i was thinking quickdb
what db you using hoax?
postgres
/home/container/index.js:50
icon_url: message.user.avatarURL(),
^
TypeError: Cannot read property 'avatarURL' of undefined
at Client.<anonymous> (/home/container/index.js:50:30)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:825:20)
```**ERROR**
query builder should be fairly easily to use
It's author not user mb
oh ok
aight, thanks!
okay, so grafana only does the reading from DB? i have to post my commands to that DB where grafana picks it up correct?
Oke now my whole connection string is an env variable 
weird that it complained in the first try

2021-02-28T15:13:22.663863+00:00 app[worker.1]: ${message.guild.owner.user.username}#${message.guild.owner.user.discriminator},
2021-02-28T15:13:22.663865+00:00 app[worker.1]: ^
2021-02-28T15:13:22.663866+00:00 app[worker.1]:
2021-02-28T15:13:22.663866+00:00 app[worker.1]: TypeError: Cannot read property 'user' of null
message.guild.owner is null since it's not cached
wat i du
Fetch the owner guild.members.fetch(guild.ownerID)
It's a promise so you have to await it
why are you using glitch anyway
in ts I've
const SYMBOL = {
INDRA: 'I', SHASTRI: 'A', CHARAN: 'C', RISHI: 'R',
SENAPATI: 'S', RATHA: 'M', ASHVA: 'H', GAJA: 'G',
PYADA: 'P'
}
type Sym = // How do I grab all the values from SYMBOL as a type here? Like this, 'I' | 'A' | 'C' | .... 'P'
HI
make it an enum, no?
then?
what do you want to use this type for?
as a function parameter type, in switch cases....
enum SYMBOL {
INDRA = 'I', SHASTRI = 'A', CHARAN = 'C', RISHI = 'R',
SENAPATI = 'S', RATHA = 'M', ASHVA = 'H', GAJA = 'G',
PYADA = 'P'
}
type Sym = keyof typeof SYMBOL;
``` something like this should work i tihnk
Except it's key = value but yeah
yeah, but the keys will also be included in the Sym
You want only the values?
yup
i found this answer in SO
type valueOf<T> = T[keyof T];
then use type Sym = valueOf<typeof SYMBOL>
SO moment
it says, Sym = string
try valueOf<SYMBOL>
if not, try the other alternatives here https://stackoverflow.com/questions/49285864/is-there-a-valueof-similar-to-keyof-in-typescript
This worked!
But what does as const do here?
it means the object values will never change
so typescript will think myObj.a is 1, not number
Oh! and how it is different from Object.freeze()?
Object.freeze affects your actual transpiled code, as const only tells the typescript compiler that it will never change
then y doesn't this work?
const myObj = Object.freeze({ a: 1, b: 'some_string' });
type values = typeof myObj[keyof typeof myObj];
Because typescript isn't that smart.
It doesn't know that Object.freeze makes the object read-only
it's just a function to ts
yeah Object.freeze returns a Readonly type, as const doesn't just make the type readonly, it turns the types from number to 1
Object.freeze can't do that cause it's a function
vsc i guess
It's VSC
vsc got so many really good plugins
i like error lens
i know what it's called, but i don't think Atom has a plugin for it
why are you using Atom and not VSC
How do I correctly make a generic?
what are you trying to do here
guys
get the type of a value from array T with [keyof] as the index?
okay
you know typescript?
i don't think he needs to do the keyof typeof T
just have it as keyof
if he's trying to get the typeof for the specific index value, then it's pointless to get that type as well
bug fixes
thays one way to get terminated
exdi
now i want to report him xd
or knows how to edit html
or that
mhm
i can try to add him to see if he does
whats his dicord

some random server started using my bot API
commands used?
mmk
and the usage spiked
add either a Ratelimit or make it a private API
not accepting friend requests
it relies off of another API
i also have limits
something tells me that this isn't exactly a small server haha
or 3 dudes with no other hobbies
lol
Discord Icons for Servers, Users, or Bots! Use the Discord Avatar Maker to make a cool Discord profile picture for your Discord Servers, Discord Bots, or Discord Accounts! The tool in today's video even allows you to animate your Discord Icon to create a cool picture for Nitro Boosted servers. If you want to create the coolest Discord Icons or P...
his latest video
not something which a developer needs
how Luca got verified??
bad photoshop or HTML edit, the tags are different sizes
the badge looks fatter
the badge looks the same
There we go https://traps-are.gay/
just looks like inspect element
looks also fake
what id
That's inspect element
yea but i have eyes and see the real bot here
the more i think about it, the more useless i see verification of bots being outside of the premise of legality
its a private bot xd
except if they make 85+ fake servers
no
maybe because this server has many members
lol
verification gives discord the ability to have a real person to sue if the bot does some bad stuff
thats
ye
exactly what i just said
the edges look off
is she a bot?
I knew it! iara isn't human!
ye
it's a bad photoshop
the bottom is cropped
lol ghost pinging a community manager
who has a bad pfp
who knew the insult "you're a bot" could be taken so literal here on discord 😳
beuh exdi
I'm just copy pasting element in the dom, why its styling gets changed?
did you use a connection url?
that mostly goes in multiplayer games
its localhost
yea but you can still use a connection url
js?
did you send client.auth?
Pt. 2
client = redis.createClient(port, host)
client.auth(pass)
lmao
yes
;-;
Hey anyone here to help me?
no
hmm looks right
Why?
ikr
is the redis server running?
idk why it keeps
throwing
fkin hell
yeah
it is
i just connected with redis-cli
restart the redis server
what does the error say?
ReplyError: NOAUTH Authentication required.
hmm
or try using a connection url [redis[s]:]//[[user][:password@]][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]]

only one hour?
fml man
the errors make no sense
i mean 1 hour
to try to get this auth
to work
welcome to programming
its never enough
what do i do if... An error has occurred while validating your input:
Invalid token. Please try again.
the token you provide is invalid
what token
probably discord bot token
where do i find it
you should give more context or code
did you know how to create a discord bot?
i know how
there is already most stuff you need to know, he dont provide any token i guess
then get the token from the developer portal
the bot client ID
oh
dont post the token here
lol
post your token and ill mess up your bot : D
damn ur a big pro wow wow
XD
actually discord has this service if you post ur token on discord or github
it regenerates one for you immediately
how discord know if a token has been published to github?
they probably have a integration with github to scan each repo that contains certain keywords for certain strings
like if a repo gets uploaded using one of the common libs they can see that it is a discord bot
then just look for a token
that must be require a huge computational power.
I posted mine once mistakenly and they regenerated one immed
and sent me a notification on here
One message removed from a suspended account.
not rly yeah
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.
still there are crores of tokens to be search
if (message.content.toLowerCase().startsWith(prefix + "avatar")) {
const user = message.mentions.users.first() || message.author;
const avatarEmbed = new Discord.RichEmbed()
.setColor(0x333333)
.setAuthor(user.username)
.setImage(user.avatarURL);
message.channel.send(avatarEmbed);
}
Why doesn't this work?
you realize a simple query can look through those crores in a few ms?
you dont need this much computing power, like a small webserver can easly handle a few thousand requests at once
One message removed from a suspended account.
avatarURL is a function on the newer versions of d.js
so how to fix?
call it
update d.js?
One message removed from a suspended account.
?
where
One message removed from a suspended account.
ok lemme test
You should read up on functions if you don't know how to call one...

