#development
1 messages · Page 1545 of 1
@opal plank not yet
oh that looks like 25px
aight
Uhhh whatever the default response from discord.js when you use displayAvatarURL() is
png format
25px iirc
from discord.ext import commands, cooldown, BucketType
I will soon probably tho erwin, have something in the making 
uh huh
that isn't what you need
you're supposed to set the proper dimensions in drawImage()
well in your code you used 200x200
I did 25, 25, 200, 200
you call it like this
extensions = ["cogs.SomeCog", "cogs.SomeOtherCog"]
for extension in extensions:
bot.load_extension(extension)``` @sacred trout
wherever your bot is run
No
That'll just draw the image from right to left
It's be canvas.width / 2 - 100 actually
im just waiting for yoroshi to finish the artifacts
so i can finish my wiki

enemies is another im looking foward to
but thats going to be later down in dev
we are working in something a bit more...spicy
that is indeed funny
youre trying to import commands from discord.ext.commands
see the logic there?
it would be from discord.ext import commands...
lol
someone been using too much cpp or ts
actually
just ts
the other one is import name only
Time to utilize oauth tokens I guess
dont even remind me of auth
Unless I somehow manage to grab IDs from usernames with the osu! API
also @sacred trout I cans ee you're trying to import cooldown from discord.ext, you import coooldown from discord.ext.commands
partially, Erwin
though holy shit it was worth the trouble of writing it
well, yeah
something like
from discord.ext.commands import cooldown, BucketType
@cooldown(1, 1, BucketType.user)```
though it was sooo worth the blood, the tears, and the backdoor gaping
my status looks neat as fuck now
🙏
@lyric mountain ah
It's so easy to set them
it updates every minute
never seen anyone do anything similar, figured i'd try
SDK fucked me up nicely though
I can try that
there isnt support for node
seems pretty cool
no
Set an interval using discord-rpc and request activity change

rpc is deprecated
only SDK
Since when was RPC deprecated
hehehe
how can i run c# in node tho
cuz there isnt fricking node in it
tough life
good luck loading dlls with node
sad electron noises
I'll make it tomorrow
seriously tho, how come there isn't a node lib
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

its a new feature, its not very used, and its more complicated since it uses ipc and not http requests or websockets
@opal plank Do you know canvas
yes
oh damn you hit 1k server pogu
do you still have that problem
Yes
I edited it
debugging is your friend
still not working?
hmm try drawImage(image, 0, 0, 200, 200)

nah nah nah it's not a copy
if i see you advertiisng ur botum with it imma be mad
and go back to previous code
reverse engineering yaknow

remove clip too
I'm pretty sure it's not going to be difficult
no copy, originality
1 file only 
make your arc middle too
meth

I could probably make it now
imma bonk you
but....no brain power
im warning ya
uh i forgot the syntax
you'd want it to be on the middle
i have an idea
add the clip() back
and add ctx.stroke() after clip
2 * Math.PI is crucial
is the circle in the template even centered
reduce the height then
ah you're centering it
never mind then
ok
np
Okay so:
I get this error in visualstudiocode
logChannel2.send(logEmbed2);
^
TypeError: Cannot read property 'send' of undefined
at Client.<anonymous> (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\bot.js:48:15)
at Client.emit (events.js:315:20)
at GuildMemberRemoveAction.handle (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\discord.js\src\client\actions\GuildMemberRemove.js:22:51)
at Object.module.exports [as GUILD_MEMBER_REMOVE] (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\discord.js\src\client\websocket\handlers\GUILD_MEMBER_REMOVE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\marti\OneDrive\Escritorio\Escritorio\Bot La Mafia de los Mundos\node_modules\ws\lib\websocket.js:825:20)
P.s: Help, this occurs randomly and the event actually works, idk why does this happen.
And this is the code
let logChannel2 = member.guild.channels.cache.get('533799941437521930');
let logEmbed2 = new Discord.MessageEmbed()
.setTitle(
"Adiós " + member.user.username + "!"
)
.setColor("RED")
.setDescription(
"Hasta pronto jóven guerrero."
)
.setTimestamp(new Date())
.setFooter("|Bot Oficial|");
logChannel2.send(logEmbed2);
Sometimes it happens a few minutes after starting the bot and sometimes a few hours later
that's kinda easy
yea
Yeah I jus never done it before xD
nah percentages were always cool
what i don't get is why tf i need to know the pythagorean theorem
i'll probably never use it even as a programmer
How do u guys make a role cmd that will only show half of it and also shows the remaining ones
Ex.
The server has 20 roles
In the embed the bot shows 10 of the roles and ....10 more
Like what method do u need?
you mean a "paginated" embed?
Nope
it's useless because realistically you won't ever work with 90deg angles lmfao
Lemme ss the example
oh show 10 first roles and if there's more say ...n more?
use the power of ✨meth✨
Like this
"Cultural Hentai Leader"
a anti drug commercial for Methamphetamine, isn't the commercial supposed to make you not want to take meth?
This video was produced to educate the Louisville community about the common objects used in making crystal meth. The client is the Louisville Metro Police Department: LMPD. A huge Thanks.
1995 PSA from the Partnership for a Drug-Free...
I need to join this server
mmmm meth
it's called truncation btw
Sure wait
hol up it was a joke
Yeah but like how do I make it after that
use meth to calculate the rect sizes and coords
full width x (1 - percentage) is the rest
pure math
fillRect
oh
for rectangles
that
you can also set the stroke width to thicc and draw lines
would recommend enabling line rounded borders for that
i thought they meant what function to use to calculate the percentages, like miss... 🧐
const sum = (a, b) => a + b;
const substract = (a, b) => a - b;
const multiply = (a, b) => a * b;
const divide = (a, b) => a / b;
const exponentiate = (a, b) => a ** b;
const mod = (a, b) => a % b;
there you go
bro where is power of!!!?11
aight
@commands.command(name='ascii')
async def ascii(self, ctx, image_link: str=""):
if not image_link:
user = ctx.message.author
image_link = user.avatar_url_as(size=1024)
try:
user = ctx.message.mentions[0]
image_link = user.avatar_url_as(size=1024)
except IndexError:
pass
url = 'https://useless-api--vierofernando.repl.co/imagetoascii'
async with self.client.get(url, params={'image': str(image_link)}) as r:
if r.status != 200:
return await ctx.send("Failed :x:\nMaybe url is wrong :link:")
else:
result = await r.text()
ascii_file = io.StringIO(result.replace('<br>', '\n'))
em = discord.Embed(color=discord.Color(0xFFFF66))
em.set_thumbnail(url=image_link)
await ctx.send(file=discord.File(ascii_file, 'ascii.txt'), embed=em)```
please help
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'get'
simply don't copy paste code 
lmfao
Oops I don't really know Python so I can't help
please help me fix it tho

@earnest phoenix knows
you can do either async with aiohttp.request('GET', url... or create your own aiohttp.ClientSession and assign it as a bot attribute.
Too advance for me lol
I thought you were supposed to use .request on a ClientSession?
Hello
you can do either way
@slender thistle How can I install discord.js
In my pc
with ClientSession, you can do get instead
Oh, so
async with aiohttp.request(...):
...
is similar to
async with aiohttp.ClientSession() as session:
async with session.request(...):
```?
technically
if we don't care about cookies and stuff, we can do it without session
kekw, I personally don't do a 1 time use ClientSession, I instantiated it without the context manager
kek
npm install discord.js
It's as simple as that
@opal plank I'm almost done 
All I need to do is make my requests to discord and itll be working

Hey guys
Somebody know wtf, why im getting this error
at /home/container/node_modules/crowdin-without-vulnerability/node_modules/unzip/lib/parse.js:59:13```
I googled it, but nothing helped
I want to make a registeration bot which will open the channel in every 24hrs using interval and close it using timeout and go on ...
I want to set it into a database cauze If bot gets restarted it won't work
let channelID;
let channels = guild.channels;
//console.log(channels)
channelLoop:
for (let key in channels) {
let c = channels[key];
console.log(c)
if (c[1].type === "text" && guild.channels.get(key).permissionsFor(guild.me).has('SEND_MESSAGES')) {
channelID = c[0];
break channelLoop;
}
}
let channel = guild.channels.get(guild.systemChannelID || channelID);
let embed = new Discord.RichEmbed();
//embed.set....
channel.send(embed);
})```
I want to find a channel i can send welcome message whenever my bot joins the server, the code is in js. I am currently getting error missing permission, but I want to send only in that channel where I can send messages.
channelLoop: doesn't seem like JS
You can make multiple condition checks and if one channel fails, then the bot can try sending to a different channel
If you want to find a channel where the client has permission to send messages, use <Collection>.find() on <Guild>.channels.cache
ok, what should i write inside find ? to check for send messages permission?
I think find(), finds for names
Example:
const channel = <Guild>.channels.cache.find(c => c.type === 'text' && c.permissionsFor(<Client>.user).has('SEND_MESSAGES'));```
wow okay thanks, lemme try
This is how I do mine
the one said above could work as well
that's too many lines of code
It only is too many lines of code because of my huge embed
lol
Anyways that's nothing compared to my serverQueue file for music
you don't have to multiple check i think you can just make an array
I tried it But it did not work it came error
It works either way 
You Should Type this in mode.js
for like ["gen", "lounge", ....]
If it ain't broke don't fix it
I don't know what error you got
For typescript, how to decide when to use interface and type
there are some differences, but for the most part they're the same
for example, if there are two or more interfaces with the same name, they'll be merged
to define react props, can I use any of them?
they just kinda do the same stuff but differently
yeah
i prefer using interfaces as a convention tho
i think they look better
and interfaces can hv nested objects, and type dont. right?
type Example = {
foo: string;
};
type Extended = Example & {
bar: number;
};
and
interface Example {
foo: string;
}
interface Extended extends Example {
bar: number;
}
they both can
Ooh Ok, thanks
np
user = user[0].split("<@" && ">")
``` how do I remove from a user id the <@>?
use regex to replace the <@>
yes, ik, but split works with regex to? then it is good lol
why did you want to split?
I have in a message.embed a user mention and I want to get it out, th user id
so you only want the userid not the mention?
yes
if yes how did you get the user?
If you want to get their ID why not do .id
I have just mention in the embed
how did you get the user?
user.replace(/[\<>@!]/g, ""); have created my own lol
this is not even in any context lol
idds = message.content.split(' ')
channel = client.get_channel(idds[1])
msg = get(client.get_message(channel,idds[2]))
await client.add_reaction(msg, "❤️")
error name get not defined in
msg = get(client.get_message........
^^^
You have not defined get
isn't it suppose to be a keyword
I don't know but that's what the error seems to be saying
what should i do
i tried 10 diff version of this code
😭
Did you make this yourself
not this one but previous version
google says get is a keyword for dictionaries
ie
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
x = car.get("model")```
You haven't defined the get function
its suppose to be a keyword
it's not if you are getting that error.
why do you need that get()
to get message from id
@pale vessel here
I define a tag of div.overflow-hidden in the crawling div (main) but I try to load other tags in the profile-header to get the name of the person to be crawled from the profile-header and other information but it doesn't not.
getHtml()
.then(html => {
let ulList = [];
const $ = cheerio.load(html.data);
const $bodyList = $("div").children("div.overflow-hidden")
$bodyList.each(function(i, elem) {
ulList[i] = {
title: $(this).find('div.profile-header').attr('data-nick'),
image_url: $(this).find('div.profile-header__icon').attr("src"), //Section where road is not allowed
lankimage: $(this).find('div.profile-tier__tier').attr('src'), //Section where road is not allowed
lankname: $(this).find('div.profile-tier__info.profile-tier__info--tier-0').attr('span'), //Section where road is not allowed
//lankstate:
};
});
help me
, it's not just get, go look up the discord.py docs.
yeah that get is pointless. client.get_message already returns the message
await e.awaitReactions((reaction, user) => reaction.emoji.name == '🎫')
.then(async collected => {
if(collected.first().emoji.name === '🎫')
await message.guild.channels.create(`${message.member.nickname || message.member.user.username}`, {
type: 'text',
topic: `Тикет для юзера ${user.tag}.`,
parent: '803142856965488690',
reason: `${user.tag} created a ticket.`
})```
it doesn't react to my collector :(
it doesn't log an error too :(
what should i do?
Are you sure the code is even executing?
but the functions like get_guilds and get_users are about 40 lines together
get_message isn't even a thing anymore
yes..
it's executing but not working
how do you know if it's executing if it's not doing anything?
put a console log in the then callback
$bodyList.each(function(i, elem) {
ulList[i] = {
title: $(this).find('div.profile-header').attr('data-nick'),
image_url: $(this).find('div.profile-header__icon img').attr("src"),
lankimage: $(this).find('div.profile-tier-competitive img').attr('src'),
lankname: $(this).find('div.profile-tier-competitive img').attr('src'),
lankstate: $(this).find('b.profile-tier__name mt-1').attr('class'),
};
});
I want to get the value of lankimage from the ulList[i] list above. How do I do that?
what permissions do you need to do a ticket setup?
idk if it's manage server, admin or even server owner
I'd say admin
for the user using it though
or manage server sounds more appropriate
alright thanks
hey now if the bot has been published to the top, don't get the badge "Verify Developer Bot" again?
i have a question, do you need to be over the age of 18 to verify ur bot on discord?
no, just have to be the age limit for your country to use discord
ok thats a relief
UK, england
that's really cool
it was on 18
hey uys!
hey
f(message.content.startsWith(prefix + 'enable case1')) {
fs.writeFileSync("./cases1.json", 'Enabled');
setInterval(() => {
const data1 = fs.readFileSync("./cases1.json", "utf8")
if(data1 == "Enabled"){
const exampleEmbed6 = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle('Chaos Bot')
.setDescription('**Legacy mode has been activated**')
.addFields(
{ name: '**Information**', value: 'Hello fine member! My name is Chaotic Bot. As you already can see it in my name, I like to create Chaos. We have different modes to create Chaos in this server. Don`t act suprised when you get muted, pinged, killed, insulted... I am created for fun and trolling purposes. May the discord mods be with you....' },
{ name: '**Case 2**', value: 'In legacy mode the Chaos Bot has been defeated by your oh-so loved discord admins. With this mode enabled, nothing can happen as the bot is restrained behind thick steel! Pfeeehw!' },
)
.setImage('https://media.giphy.com/media/3oEduLSwuxfMoTbMQg/giphy.gif')
.setTimestamp()
.setFooter('Command created for Chaos!', 'https://media.giphy.com/media/nrXif9YExO9EI/giphy.gif');
client.channels.cache.forEach(channel => {
if(channel.type === 'text') channel.send(exampleEmbed6)
})}}, 30000);
```` this is my code atm. How do i actually first send one message, and then start the interval?
because now i have to wait the interval time till it sends the message
DAMNNNNNN RANDOMLY?
huh?
Like 100 guilds
idk maybe its easy to get to 100
Nope not really
I have a loop that heartbeats a server and then reads a message, it heartbeats every 15 seconds
hi
the trouble is that the timeout is blocking, so how can i make it read the socket without the interval and write every 15 seconds?
tokio::spawn(async move {
loop {
println!("{}", socket.read_message().expect("Unable to send socket message"));
heartbeat(&mut socket).await;
}
});```
```rs
pub async fn heartbeat(
socket: &mut tungstenite::WebSocket<
tungstenite::stream::Stream<
std::net::TcpStream,
native_tls::TlsStream<std::net::TcpStream>,
>,
>,
) {
socket.write_message(Message::Binary("{\"t\": 1000, \"d\":null}".into())).unwrap();
tokio::time::sleep(tokio::time::Duration::from_millis(15000)).await;
}
is there a way to code auto decancer in Djs?
decancer?
remove fonts in usernames and add a nickname with eng characters
like this one ^^ that is in py so i need some help
They probably just check for characters that are way out of the "normal English" unicode values.
u++
Tysm Cry
lmao "that is in py "
i just realized wait never mind they're probably saying that's in py and they code in js 🤔
what about looping inside the heartbeat function and spawning it so it's not blocking?
What happens if you do not verify your bot? does it get deleted? removed? or just can it not join more than 100 servers until its verified.
the latter
if your bot is on top.gg then it will be removed when someone reports it
a mod might dm, idk, probably not
for ts, how to accept a class (not instances), as a parameter in a function
typeof Class
yes
Ooh! then what is this new () => MyClass type?
ok good
Seems to be a constructor declaration? I've never seen it tho
hi...
are they both same thing?
i just created a bot with node.js and ran the codes but in the console it says token invalid...the token that was copied from the discord developer portal
anyone know whats wrong...coz im confused
let's check ur token 😁
You copied the token inside the "Bot" section, right?
i clicked regenerate
then copy
and i copied for the correct bot
coz i have 3 bots
so i double checked
but i still dk whats wrong
😦
r u saving ur token to an env file?
yes
is it surrounded by quotes?
yea show your client.login function call
its like TOKEN = '...'
oh wait sorry no inverted commas
apostrophe?
that doesnt change anything
T i m
Hey
<@&802585422109736980>
gmornin
so urmm what do i do?
show how you call client.login
so, you have a .env file? and inside the env file you have TOKEN=87t8c27tn923 correct?
and in your bot file you have client.login(process.env.TOKEN) ?
i used the discord.js beginner template
so the last line of code in the main file is:bot.login(config.token);
a config file and an env file are two different things
do you have a config.json file?
or are they 
and what's inside config.js?
If the token is surrounded by quotes, it does added to the token like "6dd7gblablabladfs78". So quotes does gets included in the token.
module.exports = {
prefix: '--',
token: process.env.TOKEN
};
yep
doesnt change anything, cause I got quotes around my token and my bot logins fine
why lol
wrong?
idk in python i have a .env file
but in the template the config file was already there
so if i dont have the .env file
then where do i put my token>
?
or is it the config file thats redundent?
do you have require("dotenv").config() somewhere in your code?
That's the issue then. you have 2 options: install dotenv and save your token in an .env file, or store your token in a .json file
then i delete the .env file
ye
mhm
yeah
a config.json is the same as config.js but doesnt need the module.exports part
ok lemme try...
its just this ```js
{
"a":974792,
"b":"egwegw"
}
but you do have to put quotes around the keys too
"token" and "prefix"
abstract class Parent { }
class Child extends Parent { }
function fun(P: typeof Parent) {
// Error: Cannot create an instance of an abstract class.
const ins = new P();
}
fun(Child);
couldn't create a instance...
abstract classes cannot have instances, they can only be extended
oh
Does Child implement any of the methods inside Parent? cause if not then it's probably considered to be abstract as well
{
"tim": "bla bla bla"
"tim2": "owo"
}```
owo
uwu
get a room
I tried to hv a constructor and some methods, on Parent. But still it doesn't work
for this right i changed 'a' to prefix and put my prefix and ran the code but the console says that the ':' is an unexpected token...
/home/runner/Zero-Chip/config.js:2
"prefix":--,
^
SyntaxError: Unexpected token ':'
Hint: hit control+c anytime to enter REPL.
show your file
{
"prefix":--,
"token":"blablabla"
}
"--"
that looks like a different style for the face ._.
hmmm... maybe typeof doesn't work with abstract classes?
still says the same thing
/home/runner/Zero-Chip/config.js:2
"prefix":"--",
^
SyntaxError: Unexpected token ':'
so this doesn't work for you?js { "prefix": "--", "token": "blablabla" }
hmmm, thats weird... can it be a bug?
lol a mistake on discords faq bot verification page
?
for the token it works but for the prefix it doesnt
so yea
^
it doesnt work
there should be a space
ooo
that worked!
i changed the name to json
forgot about that\
so now its config.json
so u was confused with, .js and .json??
.jason
.jayson
.jax
.jaxson
.jsx
.UvuvwevwevweOnyetenyevweUgwemubwemOssas
confuse him more.
hey that's your old status
in the end yes...just started to learn js
smh tim
sorry
I remember
but thanks a lot
now he wants money
✌️😊
json files are just like, js objects. Just that the keys are surrounded with double quotes.
and u can also store arrays in them
i see...
For abstract classes you have to use new () => Parent
Oh yeah, it workeed
but now I can't instantiate, with params
Types of construct signatures are incompatible.
you also need to add the parameters in new () => Parent
hmmmm 👍
Set channel slowmode command not working, error TypeError: setRateLimitPerUser().
in ts, Can I define all methods of a class to have same type of params, at once?.
how can I color the functions ?
All you can do is change language for the code block
As Tim said
Ah i see you saw
lmao
Tim ok?
new language
ok so guys i want to make a command like x*help math but idk how to make it, this is the code i have so far
const PREFIX = "x*";
module.exports = {
name: 'help',
async execute(bot, message, args, catchErr) {
if (message.author.bot)return;
if(!message.content.startsWith(PREFIX)) return
if (!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES')) {
return;
} else {
if (!message.channel.permissionsFor(message.guild.me).has('EMBED_LINKS')) {
message.channel.send("I am missing the `EMBED_LINKS` permission.")
return;
} else {
const embed = new Discord.MessageEmbed()
.setTitle("Xu Command List")
.setColor("RANDOM")
.addField(`Math`, "`x*help math`")
message.channel.send(embed)
}
if(message.content.includes("math")) {
const embed2 = new Discord.MessageEmbed()
.addField(`Math Commands`, "`algebra` | `calculus` | `combinatorics` | `constants and numerical sequences`")
.setColor("RANDOM")
.setTimestamp()
message.channel.send(embed2)
}
}
}
}
How I code music bot for stay in vc 24-7
make it play music all the time and make sure u have got a good vps?
i mean the first one isn't necessary, not sure either
the reason i am making this command is because my bot will have a lot of categories hence a lot of commands so i thought this command would be helpful for people who only interested in that particular topic
Honestly, a math command is purely pointless on a bot. Like, nobody ever thought "hey I should do math on Discord rather than opening my calculator app"
And also we've denied a lot of bots for having horrible math commands that could be used to crash their bot.
I keep getting this issue. What should I do to fix this?
needs code.
You can't just show us the addMessageCount.js ?
I can
why do I have a feeling you're coding on a phone
Does anyone know how to get a server to run longer then 3 hours?, i coded my bot in Python (stupid I know) and I really want this bot to run 24/7
ok well it's clearly your d.increment that's not working.
How would I fix that?
not that I know sequelize but... maybe you need to make sure the value itself exists or something?
the error seems to tell me it can't increment something that doesn't exist
Hm weird. Cuz it used to work. Not sure why it's just not wanting to work now
"servers" should run nonstop, what server do you have that's closing after 3 hours?
If something stops working and nothing's changed, something's changed.
Yeah true. I'll try to find out the issue
hi
sorry for my english im french : i've recently made a captcha command for my bot which worked only for my server and i've recently tried to code something that would let people use it on their own server. the command to set the member role work but when i want to recup to role on the captcha command to give the role it dont work. i've use .json (i know .json suck) to stock to role
some screens
the 773569261208862741 is the guild id
which is line 26?
how would i do a command that provides help on a category when you type x*help <category>
let memberRole = message.channel.guild.roles.cache.find(role => role.id === client.configcaptcha.server[secondtruc])
So basically, this part is broken, probably because client.configcaptcha.server is undefined.
It can't read the property serverid from client.configcaptcha.server
That would imply you already have a command handler which separates your commands into categories which are stored in some sort of structure. do you?
firstly i tried this : client.configcaptcha.rolename[member.id]
but it wasnt working
Oh god tell me you're not using json as a database. Don't do that.
i know but i dont how to do without a json x)
ty
well that's ok for small projects.
I also did that, when I was a beginner
no i dont
Alright so that's your first step!
type obj = { name: string; };
class Parent<T> {
constructor(readonly val: T) { }
}
class Child<T> extends Parent<T> {
printName() {
// Error: Property 'name' does not exist on type 'T'.
this.val.name;
}
}
function fun(C: typeof Parent) {
const ins = new C<obj>({name:'none'});
}
fun(Child);
Am I doing something wrong with the generics?
how do i do that
Well that's gonna take a lot of work to be honest
Do you even have a command handler at all?
class Child<T> extends Parent<T> { You want to do Parent<obj> here.
i do
ok well, then you need to add a category to your commands, and then place those categories in some sort of in-memory object (like a collection or a set or whatever)
but then I get this on fun(Child)
Argument of type 'typeof Child' is not assignable to parameter of type 'typeof Parent'.
Types of construct signatures are incompatible.
Type 'new <T>(val: obj) => Child<T>' is not assignable to type 'new <T>(val: T) => Parent<T>'.
Types of parameters 'val' and 'val' are incompatible.
Type 'T' is not assignable to type 'obj'.
Generics should only be used when the class itself doesn't use the property with the generic type
because the class doesn't know the actual type
this.val.name; this doesn't make sense because the Child class doesn't know what T is. T could be any type
class Normal<T> {
constructor(readonly val: T) { }
}
function fun(C) {
return new C(0);
}
fun(Normal);
Here how do I make C, to accept any class constructor?
I would just use any
will C: typeof Function work?
nope
hey guys i need help

read the site i sent you, if it wasnt enough
hi Erwin
@crimson vapor hello
is that a puny attempt to make people @ modums?
Erwin in aot ??
any ides for a new command and i ony know how to make it fun
what?
not the place to ask that
nvm not true anime fan
i know attack on titan, im saying this is #development , talk about that in #general
sry my bad
Is there any way to make the bot leave every server that's in?
Erwin I finished it 
I'm just making it into a nice control cli
then ill push to github
dont need it

stop plagiarising my ideas pls
i dont appreciate it
I have one more
this is development
congrats i guess
hey
var myArray = [
"vase","cat","dog","duck","aww","meme","dankmeme","facepalm","hpmeme","wholesome","art","deadinside"
];
var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
let z = api.image.(randomItem)()
message.channel.send(z)``` the normal function calls by: api.image.(name)(). For example: api.image.canvas()
so i tried doin this, but it does not work. Does anyone know how to do it?
that is from a npm package
made by code913
Use api.image[randomItem]()
https://custom.discord.re/ (made by @rustic nova)
Tysm
AHA OKAY
@scenic kelp
hey
var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
let z = api.image[randomItem]()
message.channel.send(z)```i tried it out
but it didn't work out...
it says: cannot send an empty message
hey guys
if(message.content == "!restart"){
setInterval(() => {
const data3 = fs.readFileSync("./cases3.json", "utf8")
if(data3 == "Enabled"){
```
so this is a little snippet
it should check whether data3 is enabled
and if yes, it needs to perform the code between the {}
i literally disable the data3 by command, so instead of Enabled it says Disabled.
it still sends all the commands afterwards
why is that?
ah
bruh if you want to client mod at least make it look good
what??
@pale vessel
lmfao
was that meant for me?
i don't want to client mod or whatever that means.
it sounds negative in that sentence you used
One message removed from a suspended account.
One message removed from a suspended account.
uhh
it's against discord's ToS
bu what about if u dont just tell ur using it or just do not use them at all
my bot was added 3 hours ago, has 8 votes, do you guys think theres a chance its on the trending page?
or maybe close?
15 votes actually
because you're modifying their code and their property - when it's licensed and closed source
nah nah nah
woospie poopsie. My bad then.
you'll only really get banned if someone is that big of an ass to report you
okay i hope no one is going to do that
and if discord decides to respond to that report lmfao
Discord doesn't really care about client mods. Don't abuse their precious API and you're gucci.
i wanna abuse their api /s
okay great thanks!
Also anyone here use Docker?
Because fucking
my container likes to just oof itself
could anyone tell me why my intervals still keep on running eventhough the data3 is clearly disabled https://hatebin.com/ssdmqcbhjf
is that because i need to check the data using an interval or something?
why is that a string to begin with 
because it is saved as a string
not proper json layout
but it does the job
i mean i enable the bot and then !restart
which works, it clearly starts the intervals. But then i disable them by command and hit !restart which doesn't stop the interval.
JS scares me
what is the problem here?
How do you disable them?
!disable case3
do you just do data3 = "Disabled"
which writes disabled in the json file
i clear them at the end
} else {
clearInterval(myVar1);
clearInterval(myVar2);
clearInterval(myVar3);
clearInterval(myVar4);
clearInterval(myVar5);
}```
so if(data3 == "Enabled){
else, that code above (the one with the clearintervals)
const data3 = fs.readFileSync("./cases3.json", "utf8") this returns just a JSON string, and you are comparing it to enabled or disabled
yeah and that string contains:
it worked for cases1 and 2.
already stated that fact.
if thats not json
{
"status":"disabled"
}
Ya
how do you define myVar, myVar2.. etc. because you never define the intervals in the file you sent
yes i do?
he does with magic
async function myTimer5() {
var myArray = [
"vase","cat","dog","duck","aww","meme","dankmeme","facepalm","hpmeme","wholesome","art","deadinside"
];
var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
let z = await api.image[randomItem]()
message.channel.send(z)
}
var myVar1 = setInterval(myTimer1, 40000);
var myVar2 = setInterval(myTimer2, 60000);
var myVar3 = setInterval(myTimer3, 90000);
var myVar4 = setInterval(myTimer4, 30000);
var myVar5 = setInterval(myTimer5, 100000);```
i first start a function
why
that code is so ugly
man's using var like it's csharp
if the whole point of that file is to act as an enable/disable state why not just make a single bit file and just flip that bit
an even better approach would be using a proper db 👁️👄👁️
this is not the age of es5
okay i won't use var.
I live in esnext
but that wouldn't be the cause of that issue
your code is all over the place
yes
You sent this file which starts the intervals https://hatebin.com/ssdmqcbhjf, now you paste more code that also starts the intervals
i've changed it to functions instead
Well fill us in because we can't help you if all we have is outdated code
what's better in esnext compared to es5? tbh i use some es7 features
i forgot
Here's the problem:
You run the command, the intervals are created, HOWEVER, once the function's over, all the variables created it in are lost. So all your vars are undefined, and you're probably not getting an error because you're using var
you have to define your vars outside of the function
let myVar1;
let myVar2;
...
function smth() {
if (enabled) {
myVar1 = ...;
myVar2 = ...;
} else {
clearInterval(myVar1);
...
}
}
An even better solution is to store all of them in an array
instead of having multiple variables
these are literally just js let x = `this is a multi-line template string`;?
yeah
and don't forget template functions or whatever they're called
smth`String`
huh how that works
const name = 'Joe';
const question = `Who's ${name}?`;
const answer = `${name.toUpperCase()} MAMA`;
not sorry
mdn docs being unclear first time for me```js
function latex(str) {
return { "cooked": str[0], "raw": str.raw[0] }
}
latex\unicode
i'd probably use them if i knew how to use them
the first argument are all the strings while the rest are expressions
function a(strings, ...expressions) {
console.log(strings, expressions);
}
a`Hello ${"world"}`;
would return ["Hello"], ["world"]
thats a thing?
actually the first argument isn't a string it's something else
i wasnt even aware you could call functions like that
surprise!
well, today we learned
time to put this to good use to confuse the fuck out of 90% of js devs if they somehow manage to get into my repos
lmao
does react doesn't support non-null assertion operator? in ts
it should work that way too
I've never used that operator personally
yesterday it was working fine.
what age do you have to be to be able to verify ur bot?
i guess 13 according to discord tos
ok
or was it 14
no 13
o
its whatever age you have to be to use discord
ok good
im in uk so its 13
if you have questions about the verification process you should ask in discord.gg/discord-developers
ah ok thanks
they have much more information and the discord devs are actually in that server to answer questions
youre welcome
! is basically assuring that its not gonna be falsey.
var a = document.getElementById('Something_that_may_not_exist');
that would throw an error saying it might be undefined, so you'll have to handle that.
instead of if(a) {}
what you can do is set ! at the end to tell ts that its always present, since it doesnt have a way to import all document hmtl elements. Thats just one example, but it does come very handy when you're certain a promise or a function will always return a value
I know what it does but I've never used it, mainly because eslint tells me not to
oh, then its fine, it does come REALLY handy very often
let me check rq
yeah i use it a few times
When I need to enforce a type I usually use as cause it's cleaner to me
it has some very good cases
type casting works too, but its longer
if you still want the shape but wants to tell compiler it's just assured to return a value
interface Person {
name: string;
}
db.get(query:string) : Person | undefined
var a = db.get('value') as Person
var b = db.get('value')!
yeah it's shorter but I find it hard to read
function getSomething(key: string) {
if(cache.has(key)) return cache.get(key)!;
// return something
}
that shouldnt be needed
it is
your compiler should know if it has, it has it
typescript isn't that smart
it doesn't 
it just knows that map.get returns T or undefined
Sometimes we also don't hv type imported, to typecast it. So ! works well there.
No extra imports and shorter line length.
its very few occasions where you dont know shape
maybe it's strictNullChecks?
i mean the strictNullChecks option
probably a setting then
or is that on by default

let me try rq
im getting a compile error too
yeah it's the strictNullChecks option
oh well that makes sense
well yeah but why would you need that in this case?
in that case, no. But generally...
yeah that's why i always have strictNullChecks on
why do you first check with has??
and not if(!var) return?
that makes working with maps an absolute nightmare though
that's why i use objects now kek
you'll like have to compile extra code and more complexity or slap a no-check tag there
const cache: Record<string, number> = {};
function getSomething(key: string): number {
if(key in cache) return cache[key];
// return something
}
well, if you have the option disabled you lose some of the advantages of typescript
null and undefined safety.. which is a huge part of why typescript exists
normally it will warn about null and undefined
const a = cache.get('');
if(!a) return;
a // a definately has a available now
is it a bad thing?
aight, lets see
yeah that could work in most cases
i find it kinda long tho
but isn't it better not to traverse the map twice?
oh there's an issue on this
none
dont recall
you need to have ur bot approved
oh so you code as if it's enabled? Like if the option is disabled you don't have to use ?. or !
Yeah
you will get the role after it's approved
well, its part of dev to be in mind and do proper checks if a get() or a promise will result in a null or undefined, so i always account for it
so, this options doesnt do anything to me
my vsc is closed, no terminals are open, no process is running. But still my localhost:5000 is running. How?
so keep it enabled 
no thanks, i dislike seeing unecessary errors like that one

if it has(), it exists
there are a couple things i dislike about ts
like array.push() methods not checking typings
nor Object.assign()
since both modify the original
and there isnt type checking on them
those are some easy ways to create bugs in your code if you dont do the type checking of the interfaces beforehand
Ts does have flaws, never said its perfect, but i account for that stuff when im coding, so it should be fine
its like @quartz kindle yolo'ing everything in js
array.push() checks for typings
oh, array does
there was something else that didnt
with arrays, i cant recall what
this shouldnt pass at all
but it does
is there a way to like update google tag manager?
also, my bad
cuz my site is lazy loaded now so it just only runs when you first go to it
yolo
Yoooloooo
assign does work with generics
hmmm that might be the proper way, but the method itself should be shielded
without the need for observables/generics
ye
does that mean i can aboose it without ts screaming at me?
codes in object.assign to avoid ts errors
O^
now i have to wait for the "suspicious growth" thing to go away
code EVERYTHING with object.assign to avoid errors
;-;

what does ts do if you use jsfuck?
will probably self delete




