#development
1 messages Β· Page 1749 of 1
yeah
Even if heβs offline?
FFMPeg takes too long to install cuz it has too many dependencies
What do you mean by "locally"?
@boreal iron It will work exactly like how a user can set its nickname in a guild. It will stay untill the user or the bot leaves the server.
Even when its offline
On the guild only, not for the application if it is a bot.
Alright
Thanks
@earnest phoenix It's loading.
npm install @discordjs/opus all errorrs
@earnest phoenix I think you are having the same issue as these guys in this thread: https://stackoverflow.com/questions/65896154/error-cannot-find-module-discordjs-opus
Try running npm install -g windows-build-tools first and then re-run the install command for @discordjs/opus
I can't read anything here
Is there a fast way to give the user the possibility to use slash commands or normal commands with the prefix.
Because I dont want to rewrite all commands because its a lot of work:
client.on("ready", async () => {
const creditCommand = await createCommand({
name: "credits",
description: "Zeigt die Credits des Botes"
}, "808771611070038046")
});
async function createCommand(data, guildID){
return await client.api.applications(client.user.id).guilds(guildID).commands.post({
data: data
})
}
client.ws.on("INTERACTION_CREATE", async (interaction) => {
console.log(interaction)
switch (interaction.data.name){
case "command":
await sendWaiting(interaction)
await new discordjs.WebhookClient(client.user.id, interaction.token).send("outout")
break
}
})
function sendWaiting(interaction){
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 5
}
})
}
why are you guys installing ffmpeg through npm lmaoo
ara
you're gonna have to rewrite them sorry king
that's the investment you have to make with slash commands
ytdl core are done
hello
npm install @discordjs/opus
npm install ffmpeg-static
those 2 are the one has problems
na ok π

@earnest phoenix Have you tried the solution I send you for the @discordjs/opus package?
i mean if its really that hard to rewrite the way commands are processed and not the actual command logic
yeah
then don't bother looking into slash commands at all
@earnest phoenix How did that work?
it's not like a majority of writing code is you having to constantly modify things as you go
@earnest phoenix Please start sending the entire error instead of a small part. I can't help you otherwise.
Okay so you are going to have to open the terminal with admin privileges and then run that command again.
oh
Yea it might also be smart to start reading the error messages yourself π
ight
do run as admistrator
then run cmds
Or if on mac ios do sudo
and enter username password of mac then do
can we get one more person to tell them to run as admin
LMAO
run as admin /s
Make sure to uncompress π
Hello, someone crashed my discord bot using a math command.. He or she don't want to tell me how. Is there any way to fix it? Or any package to use math commands?
i know what the bug was in your code: you eval the math expression
Mathjs
and here's a way to crash bots that do that: /math process.exit();
dont think it was eval, probably was the math package
But the bot checks for a number. If there are no numbers, my bot doesn't eval it
oh heck its an eval
/math 1 && process.exit()
yeah, tons of ways to crash an eval math command. probably best not to use it.
Hmm yes. But is there any way to use a math command without crashing my bot? If not, I'll delete the command xd
use a math package
Okay, I'll try it. Thanks for the help c:
||or expression.replace(/[^0123456789+-/*]/g, "")||
uhm ok
just a heads up, there are some math packages which also are crash able.
make sure to look at the issues listed.
hmm I think I'll delete just the command. Everyone can use google for Math xD
This
i dont think ive ever seen someone use a math command because they really needed it.
if i would use a math command, there is some fancy code execution engine api that i would use for it
0 risk to kill your system with a bad entry
Hi
or just don't include arbitrary expression evaluation unless your bot is specifically dedicated to mathematics somehow
Don't be general purpose
specialize
my weeb bot is going to make it amongst other 100,000 weeb bots that do the same thing!
fr
or
function math(expr: string): number | Error {
if (!expr) return new Error("no expression provided bruh");
let e = [];
expr = expr.trim();
for (let w of expr.split(/(<=[0-9])\+(>=[0-9])/g)) {
e.push(w);
e = e.join("+");
}
for (let w of expr.split(/(<=[0-9])\-(>=[0-9])/g)) {
e.push(w);
e = e.join("-");
}
for (let w of expr.split(/(<=[0-9])\/(>=[0-9])/g)) {
e.push(w);
e = e.join("/");
}
for (let w of expr.split(/(<=[0-9])\*(>=[0-9])/g)) {
e.push(w);
e = e.join("*");
}
e = e.replace(/^[+/*-]/g, "")
.replace(/[+/*-]$/g, "");
return eval(e);
}
wait you also have to remove extra symbols at the end
too much iteration over the string. You can just capture the operand
Specifically, if you do !math 1:999999999999999999999999999999999999999 it crashes that mathjs library, it's a known issue, the author doesn't really care.
why in hell would you use a ! prefix
It's an example, idc
when will people stop trying to parse math expressions with regex
the 1:99999999 thing is the most common crash for math commands
so you can get bombed with 30 bots dming you that you're missing permissions, 10 of them having a stroke in the channel and only one actually succeeding at the command! duh, obviously

well in that case
function math() {
return 0;
}
That's the thing, Mathjs offers an API but everyone used the npm package instead 
That's what I use for my bot's command
I bet people love it when people crash the api
I bet they blocked out that particular flaw in their own API
lol its on heroku
But that's better than crashing your own bot
ahahahhahah
wow
heroku paid actually is not bad from what ive heard π just expensive.
more expensive than a better vps
so if someone were to make a system that just keep pinging that endpoint...
Β―_(γ)_/Β―
sure, but for someone whos too lazy to fix a simple bug, the ease of just using heroku probably wins.
this is why using a code execution engine works.
i think google has a math api
fill an array then fork
whats a fork
if the process takes longer than 5 seconds it sends a kill signal to the Container running the code
if the code tries to delete the container it stops the container
forking the process is to create an identical instance of the process
will get a kill signal
they had smart people trying to get the service down, but it is quite robust now
cool
Does anyone have experience in discord.js unit testing and could help me with some references or something to get started with optimizing code.
For the math, slash command option is not a bad idea. Though only integer options can be used
I wouldn't recommend it
There's always going to be vulnerabilities
Of course, if you use eval
I assume you don't, like a sane person would
const { SlashCommand, CommandOptionType } = require('slash-create');
const c = [{name:'add',value:'addition'},{name:'sub',value:'subtract'},{name:'multiply',value:'multiplication'},{name:'div',value:'division'}];
module.exports = class Math extends SlashCommand {
constructor(creator) {
super(creator, {
name: 'math',
description: 'Do some math function',
throttling: {duration:5,usages:1},
options: [
{
type: CommandOptionType.STRING,
name: 'op',
description: 'What operand of math you using',
choices:c
},
{
type: CommandOptionType.INTEGER,
name: 'x',
description: 'x quantity'
},
{
type: CommandOptionType.INTEGER,
name: 'y',
description: 'y quantity'
}
]
});
// Not required initially, but required for reloading with a fresh file.
this.filePath = __filename;
}
async run(ctx) {
try {
if (ctx.options.op =="addition") {
ctx.send(`${(ctx.options.x + ctx.options.y).toLocaleString('en-US')}`);
}
else if (ctx.options.op == "subtract") {
ctx.send(`${(ctx.options.x - ctx.options.y).toLocaleString('en-US')}`);
}
else if (ctx.options.op == "multiplication") {
ctx.send(`${(ctx.options.x * ctx.options.y).toLocaleString('en-US')}`);
}
else if (ctx.options.op == "division") {
ctx.send(`${(ctx.options.x / ctx.options.y).toLocaleString('en-US')}`);
}
}
catch (err) {ctx.send('There is an error running the command');}
}
};``` Well, yeah no eval involved
The problem with that is that it doesn't allow complex statements to be made
but it is safe
Can I get docs?
It's a private API. You need to apply to get in.
https://weeb.sh
but it's really good
1k guilds or above only by the way
I am trying to clean up my imports by using the paths in tsconfig, but it doesnt want to work.
https://i.callumdev.xyz/cafw8.png
https://i.callumdev.xyz/m4hy9.png
When I Try To Start My Bot Gets An Error Like This
Please Stop Typing In Pascal Case
update to djs v12
I do not understand what you mean
They're Telling You To Stop Typing Like This
I use google translate so I might have said the wrong thing. I'm sorry if I said someting wrong.
nah it's just annoying when people type like that
ok so it's another indian
So I have to apply in bot lab
@warped ravine apna discordjs ko v12 me update karo: npm i discord.js@^12
i am turkish
are u indian??
anyone?
never seen turkish people typing like that
I use google translation
@earnest phoenix How do I migrate to discord.js v12
npm i discord.js@^12
client.emojis.get doesn't work
still...nobody?
you have to use client.emojis.cache.get
idk how can I help you sry
π pretty sure only a few people use TS here
I do use typescript in my bot actually
lol
my bot is full typescript
Is there is any other port then 3000
1 to 9999
wdym working
soo i created a new bot and started from a new scratch and it was worth trying
I'm confused how Not a Number is a number?
it's really an object
but its type is a number
because the value (NaN) can only derive from numbers
i.e. 0/0
Zero Division error
hang on
Sorry I went offline.
You can do ipconfig in windows and
ifconfig on Mac and Linux
lit vc
@drifting shell undeafen
is this good?
The error says it's looking for stuff in pages
are you using nextjs
if so then pages is the cwd
Try ../src/stuff
How can you remove a undefined value from a array without looping through?
first one, 2 dots as you suggested
second one, 1 dot
@earnest phoenix
I cant find the src directory

in ts I have a variable const VAL = 10, How do I make a type from it like,
type Val = -10 | 10
but why?
I want the type to be dynamic
I guess to use typeof VAL, but how do get the negative part?
Number("-" + VAL)
So VAL can either be positive or negative 10 (and no number in between)?
Like, VAL would be a positive number.
I want to create a type from it, like
const VAL = 10;
type Sign = -10 | 10;
if VAL changes, Sign should also change
Val can't change cause it's const
and even if it could, Typescript is a static transpiler
there'a no such things as dynamic types. You'll have to settle with a specific number or just number
what are you trying to do exactly?
this is technically possible but very difficult to implement unless you're using a library like https://github.com/ronami/meta-typing.
gotta get into type level arithmetic with peano numbers and shit 
lol
oh actually it doesn't work because it's a negative number yeah ok
and it's only supported for very small numbers because of typescript's recursion limit
Does anyone know how to align a block of text like this with an image? I've been trying for hours now
this is what i currently have
flexbox with align-items and justify-content center
Why would you need that anyways... VAL changes during runtime, typechecker can't do nothing about it
I think what he wants is to infer the type of literal values for type safety
I'll try that, thanks c:
uh
what
that is my code for that
display: flex;
align-items: center;
justify-content: center;
}```
somehow my bot is insane slow idk where it is coming from! does anyone knows if there is something wrong with dc api
when my bot turns on is its status online for a few ms then goes to dnd?
Are you setting your bot's status when it's connected (on_ready function or similar) or when it's connecting
api seems fine to me :p
well its not my bot. Im making it for some one but they make their bot is on dnd. Im seeing if for a few seconds on start if its online
there has been some issues with a few vps hosts reaching cloudflare/discord
oh, they are setting it to dnd and you're setting it to online?
What language is your bot in?
js
theirs is py
client.on('presenceUpdate', (oldPresence, newPresence) => {
let member = newPresence.member;
if (member.id === '454323110569574422') {
if (oldPresence !== newPresence.status) {
let channel = member.guild.channels.cache.get('841514123547508736');
if (newPresence.status === "online") {
text = `@foggy crown is back online, The issue is resolved.`;
}
if (newPresence.status === "offline") {
text = `@foggy crown is experiancing an outage. Keep up with this bot for more information on this outage.`;
}
channel.send(text);
}
}
});
if your just trying to determine if the bots online, any status(online, dnd, idle) should be considered online status's.
let ServerEmbed = new Discord.MessageEmbed();
ServerEmbed.setTitle("I'm Currently in ${client.guilds.cache.size} servers);
ServerEmbed.setDescription("Make sure to invite me to your server, My goal is to be in 100 servers!")
message.channel.send(ServerEmbed);``` giving me an error
well why is it
@stray birch why do you do ServerEmbed.setTitle?
@client.command()
async def meme(ctx):
async with ctx.typing():
time.sleep(0.1)
subreddit = reddit.subreddit('memes')
top = subreddit.top(limit=100)
sub_list = []
for submission in top:
sub_list.append(submission)
subChosen = random.choice(sub_list)
subTitle = subChosen.title
subUrl = subChosen.url
embedVar = discord.Embed(title=subTitle, color=0xffa300)
embedVar.set_image(url=subUrl)
embedVar.set_footer(text=f"Result from r/{subreddit} || By {subChosen.author} || {subChosen.score}β² || {subChosen.num_comments}π¬")
This works but it is very very slow.. How to make it faster?
It's python btw
thats how i code it
It's probably the part where you are getting the memes from reddit
Yes PRAW isn't async
How to make is async?
Just plain .setTitle will work
idk how to use async praw
i tried it didnt work
Wdym you don't know
I just don't know
What's the difference that you're stuck on
Isn't there a difference between praw and async praw?
Isn't it like almost the same crap but with awaited methods? 
where do i put them tho?
nope
Weird
Guess your code is set up strange
Anyways what's the error you ran into?
Holy those colors do not go well together
Gonna remind myself never to use repl
lol
Unexpected token interesting
The only thing i can think of is to check your bots token
ok
i changed it but still same error
i found the mistake now
Where was it?
forgot to put }
Ah
lol
Wow repl does not give great errors then
@stray birch ```js
var cfPossible = ['Heads!', 'Tails!']
var cfResult = cfPossible[Math.floor(Math.random()*cfPossible.length)]
const cfembed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setDescription(:coin: **You flipped a ${cfResult}**)
message.channel.send({ embed:cfembed })
This is the code that works for my embeds, try something more like this instead of doing `ServerEmbed.setTitle`
What does the error say about it
You're not preparing the compiler for string interpolation in your string
idk how serverEmbed not defined
You have to use backticks
Check that it's defined
ok
You trying to make a code block @wheat mesa?
yeah, wasn't working
ok now my code is working
Nice
Does anyone know if there's a difference between a surname and a family name? I tried searching on Google, but all I got were answers suggesting it was for formality
seems so, ty
How can I turn this from PRAW to Async PRAW?
subreddit = reddit.subreddit('memes')
top = subreddit.top(limit=100)
sub_list = []
for submission in top:
sub_list.append(submission)
subChosen = random.choice(sub_list)
subTitle = subChosen.title
subUrl = subChosen.url
embedVar = discord.Embed(title=subTitle, color=0xffa300)
embedVar.set_image(url=subUrl)
embedVar.set_footer(text=f"Result from r/{subreddit} || By {subChosen.author} || {subChosen.score}β² || {subChosen.num_comments}π¬")
You'll say it's easy but i am kinda new to coding and I am not that smart
so sorry if this is easy to do
Just call me stupid
I am just stupid
I was wondering about shards. My bot isn't completely huge, but what is the benefit of shards, and what are they used for?
You should shard when Discord requires you to.
oh, alright
How can I do that, when I click the power button, a command is executed (the one I want)
like
html file: ```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Discord bot!</title>
<script src="./index.js"></script>
</head>
<body>
<button id="start">Power on</button>
<button id="off">Power off</button>
</body>
</html>
js file: ```js
const startsScript = document.getElementById('start')
const TEST = console.log('test works')
startsScript.addEventListener('click', TEST)
what I want is to execute the command node bin/index.js
this is the bin/index.js file: ```js
const Discord = require('discord.js');
const bot = new Discord.Client();
const token = require('./token');
bot.ready('ready', () => {
console.log('bot is connected')
});
bot.login(token)
Please? I know I am dum but please?
hey, the docs seem pretty easy to read and understand for praw.
https://praw.readthedocs.io/en/latest/getting_started/quick_start.html might be a good place to go.
Sad
One message removed from a suspended account.
One message removed from a suspended account.
Does anyone know how to put a video of 1.30 min (by link) in an embed cuz i cant figure it out
you can only put images
Fuck
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=setNickname
Can I actually remove the bot's nickname again since nick accepts a string only?
Or do I need to set the nickname as the bot's username?
Can I actually remove the bot's nickname again
Which would restore it's username automatically.
you should be able to just pass null
Hmm well then I need to try it I guess 
If not, I believe that the nickname is a different field(or whatever they might call it on JS) and you can just pass in their username instead
@pale vessel can you share your embed to text with me please 
guys
yall kept telling me to use github
now that I go on it
MHMMM
how useful is it?
tf this
there was a button with github on it and I pressed it
Hi everyone, How can I check if the mentioned user is a bot?
because I did a rob command
And I want to avoid that people try to rob a bot
What language are you using and api?
I've made a bot and added Slash commands and added a String option to add text but it won't show when I run the slash commandI'm using it for an 8ball command and I want it to show what you askedBut it's not working for Slash commands
Can anyone help
best guess, since I dont program in discord.js compare the ID of the client and the mentioned user
Which language are your programming in?
Not really too sure on that, can you send me the docs on slash commands for BD
I did the instructions but it still didnt work
I know, can you send the docs to me?
thank
this is the only one i can find https://nilpointer-software.github.io/bdfd-wiki/guides/slashCommands.html
thanks
its not by discord but its from the app i use to make the bot
I see that now
and its how to make slash commands on BD script
const therest = test.substring(test[0][1].length)```test.substring is not a function
how is that?
The only thing I can think of, make sure that your invite scope is correct(this way your bot can actually use em) Also make sure that you are saving properly @craggy inlet
Not too much else I can say since I cannot see the code they are using etc...
it is on the right scope and im saving it properly. ig the options dont work on BD script
You were right.
it's crazy how neither the api or the lib docs mention it lol
One message removed from a suspended account.
it's kind of intuitive but considering you're working with discord, nothing is intuitive
One message removed from a suspended account.
hello
One message removed from a suspended account.
π€
One message removed from a suspended account.
One message removed from a suspended account.
That is why TS is bae β€οΈ
One message removed from a suspended account.
feel free to teach me C#
lol, u idiot, ur on some fake website
it isn't fake, they're just using some retarded chinese proxy that won't load half the content
are Chinese websites limited to just in chia
china
arnt*
π€·ββοΈ
pretty sure they are but k
yes
i thought they were Russian
either way, yes
has discord finally released a version that supports stage channels?
Yeah ... unfortunately I couldn't test it atm I asked. If so I guess I wouldn't have asked and just tested it out.
``` Umm... wtf does it not know what user is?
Not if you donβt tell it what user is..?
One message removed from a suspended account.
How would the bot get the ID of a role it just created?
What library are you using?
how do i use .push to add a number to a []?
so for example [20], I want to add 40 more:
You could call .push 40 times, but this depends on what you really want to do.
- Do you want to add the number 20 40 times to the array?
- Do you want to add 40 more numbers to the array?
The former is easy to implement:
Array(20).fill(40);
Can any1 help me rq
How would i use the "displayname" in console.log?
I Dont really know if u can even do that lol
Nvm i sorted that out
Is there a way to make this message colored?
console foreground color?
Yea there maybe something in the class console to change the color
In C# it is Console.ForegroundColor =
It depends on the environment.
If you're in your browser console (e.g. Chrome) you can use CSS.
Figured it out
i used this list
if anyone else is wondering :p
Great. I recommend you use constants or a library to store them (since I see a lot of users include the raw color in the string).
Yeah
and less ambiguous
You probably can't tell what \x1b[1m Hello, World! means up front.
Does this library discord.js , is also managed and created by microsoft itself?
or it is a open source project?
It is a library created by the devil himself to cache everything and make the memory suffer 
who's devil
Anyone know why a shard would randomly go down without any caught errors?
Happens from time to time on my bot. I have seen shard disconnect & restart before, but I get all the logs for those.
because u might be not handling them properly
const manager = new ShardingManager('./src/bot.js', {
token: Config.Bot.token,
});
manager.on('shardCreate', (shard) => console.log(`Launched shard ${shard.id}`));
manager.spawn();
Is there a manager.on('shardException') or anything?
idk, what does the error says
There isn't an error, lol
client.on('error', (code) => {
console.error(code);
});
process.on('exit', (code) => {
console.log(code);
});
process.on('uncaughtException', (error) => {
console.error(error);
});
process.on('unhandledRejection', (error) => {
console.error(error);
});
I catch everything from the client itself.
I don't get anything from the shard.
It was just a shot in the dark - I really don't know what it could be doing. I suspect it's low ram.
But, I'm not reaching ram limits π€
Looks like shardCreate is the only event in the docs
Just found it
Well, that should help π
for the manager, yes
Right - so how do we catch errors from the shard manager standpoint?
In an idea world, I would assume there shouldn't be errors π€·ββοΈ
You could listen to the error event in the shard and then post the message to the manager
arbitrarily emit an event through the ShardManager
but that's not type safe
client.on('error', (code) => {
console.error(code);
});
process.on('exit', (code) => {
console.log(code);
});
process.on('uncaughtException', (error) => {
console.error(error);
});
process.on('unhandledRejection', (error) => {
console.error(error);
});
Would none of those already catch the shard error?
I was assuming I was catching everything by those standards.
I could throw in the shardError event as well.
y can't I require all the files in ./events?
it is not giving any errors, and also not logging anything
Btw you're not invoking the console.error method, other than, if it doesn't log anything then have you tried logging something before reading the files?
yes, than it works
I tried logging __dirname at line 6, it does log upto lib path
this time I also got the error, no such file or directory "events"
Because fs targets the root path
does fs default to cwd?
./src/events
@earnest phoenix on the topic of relative paths, check out what I made. npm backtracker
Btw yes
pain
hmm, lemme check 
tldr; you can use that module to have native like file resolution using relative paths based on the previous frame in code execution
aka, the current func
Looks kinda really pog and useful actually, imma see what optimizations I can apply by contributing

I think the first() and last() methods of the Stack class can take a parameter to return the required amount of elements just like the collections in discord.js
Imma PR that real quick
This code isn't working
let res = await fetch(`https://api.pgamerx.com/ai/response?message=${okbrooo}&type=stable&unique_id=${msg.author.id}`, {
method: 'GET',
headers: { 'x-api-key': 'MY API KEY' },
})
let json = await res.json()
let reply = json[0]["message"]
If I fetch the api using my wrapper it works, but like this it returns 504
even tho everything is correct
oh wait
I am dumb
I was using the wrong endpoint 
Hey @earnest phoenix how would you create an embed with 4 fields - only 2 in one line (each).
Discord is forcing as much inline fields as will fit in the embed.
is okbrooo a URI Encoded string or is it arbitrary user input
encoded string
ok cool
const a = enc(b)
Imagine what I will name my child
You would have to use a blank field by \u200b as both the name and the value
well that's not gonna happen anyway
NodeRequire.cache: { [id: string]: Module | undefined }
Module.children
I'm trying use slash command. But my client events are not working
Is this is wrong?
const bot = new Client({ intents: 9 })
what is a intents, actually?
Hi, can you help me know how to get the server icon via the discord server's invite link? I think he will know the forehead with a request, but I couldn't. anyone who wants to help knows how to tag me.
how to make my discord.js bot prefix work on lowercase and uppercase?
I tried some basic stuffs but didnt work
hey how does a bot detect someone voted
always, convert the command name to lowercase, and check only for lowercased string
um for commands I used command handler and made it both lower and upper case
Hmm I was thinking about that already.
Currently I canβt test this but does it create a "huge gap" between the other two lines?
I could imagine the line height wonβt change...
yes, but the gap is not that huge
Alright, thanks I will test it out if Iβm back at my PC
.toLowerCase() I guess
no work I already used
hmmm
if(message.content.startsWith(PREFIX.toLowerCase())){
//The rest
}
It works for me
oh f that's not what you want
What if I put A!ping
gateway intents are sent as a bitfield which can be logic'd down to specific numbers which represent specific settings corresponding to events the client is asking Discord to send instead of sending every event. Most events are grouped together under specific intents. If the client doesn't want to receive VOICE_STATE_UPDATE events, then the client shouldn't identify with that intent in the bitfield. As a consequence, Discord won't send that event
@trail finch
if(message.content.slice(0, (PREFIX.length-1)).toLowerCase() === PREFIX.toLowerCase() ){
//The rest
}
Is Prefix Defined??
What Is The Error @near stratus
??
thanks, and whats the problem in enable all the events?
I am guessing so
Mhm
I am helping Mizuko
message.content.toLowerCase().startsWith(PREFIX.toLowerCase()) would suffice, no?
Yea this will also work
@near stratus Btw Why Would Put js if(message.content.slice()) That should not be correct syntax
Network I/O may become cluttered with events which would not be processed at all by the library or the client. Would also consume more CPU time decoding the messages from the gateway
Fuck
nvm my idea didnt work
typeof message.content is string and you can use slice() on string so I thought that's it. (I don't have a huge brain like flazepe)
btw I was talking about prefix to be both cases so that if I use YK help, yk help and Yk help it will work
because many mobile player's first letter when typed the first letter is upper case so..
yes and that's why what flaze gave would work
*should
but isnt it only for lower case?
It'll turn both the prefix and message.content in lower case too so case won't matter in the end
ok
for slash commands, we can't give alias names yet, right?
create another command with same functionality
Using a library doing it for you or just POST the server count to the topgg endpoint
Repeatedly of course
I'd just post every 10 minutes
- 1 hour
I post once every hour
Also every time my bot is added or removed to a server
It won't matter as long as it's not once every one millisecond
is it against tos to use a user bot to repeatedly use a command on a bot?
I tried but it doesn't work
But a user bot is already against ToS
a bot shouldn't be able to use another bot's command
theyve been doing this every 30 seconds for 5 days
Just blacklist them or add cooldowns
ok thanks, just wondering if there are any other repercussions to this
your bot should ignore other bots by default
my bot ignores other bots, but not user bots since discord doesnt show that theyre actual bots
Just ignore bot user
You can report him If you can prove that he's selfboting
^
I donβt think somebody spams F5 on topgg just to get a boner if the server count is growing 
But who knows...
just keep sending random server counts and see the graph
Also I saw someone writing something with server count graph
Me sir
boi this rlly WORKS! btw can u explain the code pleaseee
it makes the content of the message lowercase which i assume will make it case insensitive
same with prefix
oh
if (!message.content.toLowerCase().startsWith(prefix.toLowerCase())) return;```
this is the way I added it in my code and it works fine!
Well Iβm generating charts myself for my project statistics and they used to scale in days/hours not minutes or seconds.
I would guess the same for server charts printing the server count.
Which means thereβs no benefit to spam the topgg API .
But who actually cares... if youβre below the rate limit everything is fine
A!AaaA (content) to lowercase = a!aaaa
A! (prefix) to lowercase = a!
a!aaaa starts with a! = true
π§
I was talking about this graph dbl-graph BOT_ID servers
Huh what?
wait, you never tried that ?
@kindred lava
It has that command
It'll give a server count graph
Nope... canβt imagine something more useless tbh 
isEven npm
npm i is-even
whats the command?
oh lol
whoops
hm
didnt work
i use dblapi.js
do i need to use the up to date one?
can someone explain how im supposed to integrate webhooks to a bot
im using discord.py btw
im trying to make a roleplay bot for my friend for her server and im making a punch command so you can do _punch and it will send Wow you punched this user and a gif but its not sending the gif
@client.command()
async def punch(ctx, member: discord.Member):
embed=discord.Embed(title=f"Wow! You Punched {member}")
embed.set_image(url='https://images.app.goo.gl/KS7fzgAe5PmvXUHP8')
await ctx.send(embed=embed)
does it have to be an embed?
i dont want it to show the link to the gif and i found thats the easiest way
lemme check the link
ye i got it
ok
ok
did it work?

hmmm
https://cdn.discordapp.com/attachments/272764566411149314/843349780787888148/g91XPGA.gif @thorny arch this is the link that i sent
then it shud work
ok
lol
same
aoba best girl
use this: https://github.com/top-gg/python-sdk
A simple API wrapper for top.gg written in Python. Contribute to top-gg/python-sdk development by creating an account on GitHub.
hmmm ayt
another question what am i supposed to do with the ports
wdym, ports are how your computer connects to the outside world
you can put any port between the given range, most ppl use 5000
hmmmk
the token is for posting your server count
mhm
i just need it to detect votes
it's not necessary for webhooks, but using this lib is ez and gives you some extra functionality so might as well
mmmk
What's the error?
if (cmd === 'play'){
The error is below that
idk why it detects that thing
somewhere in that group
if (cmd === 'play'){
^
// The error is here```
What's the error
https://scs.twilightgamez.net/pW9D3.png the error would be at the top of this mess (my code erroring)
Mine being "Messages" of null
everytime i tried to play a song
Yabe, you're not listening.
I know but what's the error you're getting
ight
Define cmd then
That's your error.
command then
in ts is it possible to define a abstract method's parameter, such that all the child classes has same method signature?
So I dont have to redeclare the parameters in each child methods.

@earnest phoenix https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_defined
ight
I can wait to bug someone about it tomorrow, disregard sorry for ping β€οΈ u
Ah you got offline. 

Lmao, btw I don't mind pings lyt <3
Well I suppose I can ask just incase. So my project is a little price tracking thing designed for me and a friend to use when we're "Flipping" and the bot is basically only 100ish lines long. Specifically I transitioned to an API to get more accurate prices instead of scrapping a certain website. After doing so, a peice of code (Which was unmodified) now cause major issues and ultimately killing the bot. I don't think providing the code itself that's erroring will be much use but I was wondering if I sent you the bot itself or I could even share screens idc it could be potentially an easy fix that I'm just overlooking.
The line that's dying is
async function updateChannelMessage(priceDelta, data, bot) {
console.log(data);
let channel = await bot.channels.fetch(data.channelId, true)
let message = await channel.messages.fetch(data.messageId, true); // <-- messages being null
await message.edit(getEmbedByDelta(priceDelta)).catch(console.log);
}
But I doubt that's much context for you correct
It works fine if I revert code which is why I'm like 
hmm, that's kinda strange; when you log the data at the start of the function after calling it, does it contain the correct channelId property with a valid channel ID?
Well here's the thing.
The bot itself is designed to like "Start the process" on boot so I don't have to re-run code. So when I begin the bot for the first time it's 100% fine.
If i close console then start the bot up again, the error appears.
I do keep the data in a .json it's suppose to look at.
{"currentPrice":550993000,"usersToNotify":["160679942319767552"],"messagesToEdit":[{"messageId":"843330564508876820","channelId":"720571224777949205"}],"scrapeURL":[]}
So the msgID and channelID are indeed there.
So is that what it exactly logs when you log data?
sec.
the log is above the error
I wonder if it's related to the fact the API uses data aswell as it's formatting. but it's in its own function and should not see it.
That is really weird, you said it runs fine on the startup and after restarting; that error starts to appear? Literally the only reason I would think of why this happens is that the bot is logging in to a different application with a token instead of the main one
Or the channel ID is incorrect which I presume is not the case if not changed
Correct. As mentioned in the original message above, I'd be happy to kind of, demonstate it? A gif would take too long to make if you're willing to watch 
I would like to hear you demonstrate it, a gif might also be helpful but nah; that would take too long
Is messages actually a property on the channel instance? https://discord.js.org/#/docs/main/stable/class/Channel
Maybe log the channel variable and see what is going on?
Well again this line that causing trouble was never changed in the first place. I yeeted puppeteer code to use request since API instead of scrapping. Puppeteer code works fine.
no issues what so ever.
That is not the issue they're having
The channel variable entirely returns null
it joined and it plays but it needs more commands 
Well uhh, I have no clue how that changing from puppeteer to API requests could yield this error, the only way I could help at this point is to see more code
20 sec gif oh well.
here goes nothing
Notice that b4 I close the console, it does indeed check the price, returns "Data" and it works. I close console, reopen it and error.
Oh wait, are you those object logs the message ID and the channel ID of the messages the users sent to invoke the command?
No it's the bot embed. It just updates it as prices change
botembed = messageID, channel ID = channel command was ran in to start the process
Oh, lemme check the code you sent me real quick
Sure.
I'm starting to see a pattern here, you're pushing the message the bot sends to an array to edit them later, but in the gif you showed; it logs 4 objects when the bot only sent one message? Am I missing something here? Or maybe the channel ID being pushed there was deleted? I'm as confused as you're
It's on a timer, so what it does is I'm able to create multiples of these if I wish hense the array but generally I only have one message running.
What the bot does is it opens the API stores the data after x time (I usually set it to a minute per check) it will compair old value to new and alert the users "Subscribed" to get a DM on the change. If I close the bot and wish to resume this later, it would since the messageID and channelID both would exsist since I wouldn't delete the message itself.
It logs the objects each rotation because I did that for debugging purposes really.
{"currentPrice":552000000,
"usersToNotify":[],
"messagesToEdit":[{"messageId":"843373934221066250","channelId":"720571224777949205"}],
"scrapeURL":[]}
This is what it's storing and it will only ever overwrite "current price" since it changes. usersToNotify is a push and same goes to messagesToEdit, URL is a overwrite but never really used
I literally have no clue at all, all of it seems fine to me as I don't see anything wrong except that you're not resolving the promise of doing a request with request() which I presume is not the one causing the issue, this is really strange
no worries. I'll post litterally what was changed so u can see old code aswell just incase that may help but if it doesn't I appreciate your assistance nontheless.
async function scrapeItemPage(url) {
try {
const browser = await puppeteer.launch();
console.log("\nStarting virtual browser...")
const page = await browser.newPage();
console.log("Opening a new page...")
await page.setDefaultNavigationTimeout(0);
await page.goto(url);
console.log("Going to GE-Tracker.com")
//get price
const [el] = await page.$x('/html/body/div[2]/div/div[3]/div[4]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[1]/td[1]/div/span')
inqPrice = await el.getProperty('textContent')
inqPrice2 = await inqPrice.jsonValue();
//get ID
const [el2] = await page.$x('/html/body/div[2]/div/div[3]/div[3]/div/div/div[2]/h1/small')
if (el2 == null ) {
return
} else {
itemID = await el2.getProperty('textContent')
itemID2 = await itemID.jsonValue();
console.log("ID of item is: " + itemID2.slice(4))
}
//get item Title
const [el3] = await page.$x('/html/body/div[2]/div/div[3]/div[3]/div/div/div[2]/h1')
itemTitle = await el3.getProperty('textContent')
itemTitle2 = await itemTitle.jsonValue();
console.log("Name of item is: " + itemTitle2)
//finished
await browser.close();
console.log("Closed Virtual Browser...")
//save everything
currentPrice = inqPrice2.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, '').trim();
setImage = ('https://secure.runescape.com/m=itemdb_oldschool/1619001006055_obj_big.gif?id=' + itemID2.slice(4));
getTitle = itemTitle2;
console.log(setImage)
saveCurrentPrice();
console.log("Price of " + itemTitle2 + "is " + currentPrice);
return currentPrice;
} catch (error) {
console.log(error)
saveCurrentPrice()
}
}
old ^
async function scrapeItemPage(url) {
try {
let options = {
'method': 'GET',
'url': url
};
//get json data
request(options, function (error, response) {
if (error) throw new Error(error);
let pretty = JSON.parse(response.body);
//save everything
currentPrice = pretty.data[22486].high;
setImage = ('https://oldschool.runescape.wiki/images/e/ee/Scythe_of_vitur_detail.png?33aa5');
getTitle = "Scythe of Vitur";
saveCurrentPrice();
console.log("Price of " + getTitle + " is " + currentPrice);
return currentPrice;
})} catch (error) {
console.log(error)
saveCurrentPrice()
}
}
new ^
I was kinda hoping discord would just you know. make that code-block an expandable thing but nvm. Sorry for spam 
That was all that was changed
Yea I don't think that's the issue though, the only things I can suggest trying is to resolve the promise of request() AND try to return as soon as the channel is unavailable for testing to see if it helps at all yk?
I'll take the advice 
How much ram should be good for a bot in multiple servers??
Depends on what the bot does
its a basic fun bot with some moderation command
If the commands do some complex processing and shit, it would require quite a lot, but if it doesn't then at least 300MB just to be sure would be enough for now if the bot is currently small, if it gets bigger you would have to get some more or even at least 2GB or 3GB depending on how many guilds it operates on
reallllyyyy
for now the bot is under dev
and the free hosting i m using it provides 100 mb of ram
and 1.14 gb of ssd
so should i shift @earnest phoenix ??
The amount of ram you would could also depend on what lib you're using, for example if you're using discord.js; 100MB is a no no since it caches heavy objects which is costly for memory allocation
You should get a VPS instead of free hosting, but if you're only testing on the free hosting for now its fine
wtf 100MB ram, this requires some insane amount of optimisation to be able to run stable
yea
its possible with js, but requires stuff like using better memory allocators
not sure with py, but its not the most efficent language out there, even with py you probably have to do a lot of stuff like tuning your cache and using a better memory allocator
its less headache to just use a vps with more ram
fyi you can't catch request errors like that
I'm not sure if discord.py caches heavy objects but don't go on about using 100MB for a Discord bot
okie thanks
Very unstable
Ah good 2 know lol
You can tho
doesn't it use the error event was thinking of http(s) module
by the time the callback runs and you throw Error the try/catch block is no longer in the stack and can't catch the error you throw
Ah, that makes sense. This was me just copy pasting working code that I made in place of puppeteer code which used try/catch. Thanks for the heads up.

you might find axios easier to use since it's built on promises and isn't deprecated
funny enough I'm working with that now seeing how it works
const Discord = require("discord.js");
const axios = require('axios');
module.exports.run = async (bot, message, args) => {
axios.get('https://prices.runescape.wiki/api/v1/osrs/latest?id=22486/5m')
.then(response => {
console.log(response.data.url);
console.log(response.data.explanation);
})
.catch(error => {
console.log(error);
});
}
module.exports.help = {
name: "test2"
}
just testing it nothing being built really.

I heard some people talking about Axios so why not try it out ^_^
Fetch gang rise up
umm btw
.catch( error => {
console.log(error)
});
can be written as .catch(console.log)
I heard centra is good
axios is nice, but heavier than node-fetch
axios is like the cool kid in class
just copy pasta'd it from a site I'm modifying it dw
ty tho 
Reading docs b4 I really do anything.
Do it. Axios is great.
Likely will π
Ya I figured it out pretty quickly. It's pretty nice ngl
https://scs.twilightgamez.net/LPKho.png ty for the suggestions. I'm going to work with Axios over Request for this. Ty Volt, xet, tim and akio β€οΈ
isnt request deprecated
It is
Never knew tbh 
I made this stupid project quite a bit ago and recently decided to work with it again
yea its deprecated since 2020
Welp the more you know.
Welp kids, this is why you don't use deprecated packages 
it do be like that sometimes.
ye
Was gonna suggest using node-fetch but axios is also nice
welp time to test code out once more with axios but with actual project.
so removing await from channel.messages.fetch seemed to resolve the issue. 
idk tbh but I'll take it
does that mean that was an issue from the Node.js's interpreter
https://scs.twilightgamez.net/ov2gf.png all ofthe console.logs and no errors
What Node.js version are you currently using?
hm, you should try updating to v14 as it's the current LTS
I can ya.
and again funny enough I put await back in the code and it's still working. Fuck coding
I am updating tho regardless.
Lmfao wtf
Gotta love how a piece of code can fuck with you and you remove and place it back to where it exactly was, it works
wtf is coding anymore
Ah you know what, it wasn't the async or anything that caused the issue. The error returned. But I did figure it out. The reason why Puppeteer worked with the current code is because it took a decent chunk of time to open a virtual browser, save data, and do whatever. It did this while the bot booted up. So the bot would boot up fully before puppeteer completed. Since API is faster, the api stuff would try to resolve before the bot came fully online so "messages" would be indeed null since it isn't online to see them. Changed some index.js stuff and well, we're good.
Damn, its always the smallest issues that causes all of this
I noticed it when flip flopping between old and new code and console.logged extra shit. But it was the "I'm online!" message that cought my attention. With puppeteer it would always come before the prices. With API it will come up after the error.
Btw you can also assign the wait variable to Discord.Util.delayFor instead lol
https://scs.twilightgamez.net/CQM3f.png object was missing from the above console bec I overlooked the fact I never did ?price new which starts it originally.
I thought about doing that ngl. But tbh it was just moving code down a few lines and it's fixed. 
glad that you found out what was causing your issue and fixing it; I thought of telling you to check to see if the client is fully logged in but then I thought nah that wouldn't be the case
Seems like it was 
Ya major facepalm moment
why the bot dont send massge when someone join
hey
const points = database[name].points
const d = levels[message.author.id].completed
const c = levels[message.author.id].points
levels[message.author.id].points.fill(Number(points) + Number(c))
levels[message.author.id].completed.fill(Number(d) + 1);
why does this return me: 2020 and 11?
While it should be 40 and 2
module.exports = {
name: 'coinflip',
description: 'Flip a coin',
execute: async(client, message, args) => {
const heads = ("./Images/heads.png")
message.channel.send(`You got heads, ${heads}`)
}
}``` should work right?
you felt for Javascript handling of strings and numbers
try and see
wot
not working
does it send you an error?
no it does not
also you cant send images like this
you have to send them as a attachment
check with typeOf() what type your numbers are, if they are strings you have to make sure you pass in numbers.
sure
they are an object
all 3
so you try to use an object and use math on them?
yeah
Hi friend, today I am leaving this fucking game with a bunch of cheaters and an aggressive community. I want to cheer you up and give you some skins. Here is my trade: stermccommunitty.ru/tradeoffer=partner=?0753842
did you tried parseint?
hi
help me
client.on('message', (message) => {
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')
const adapter = new FileSync('./db.json')
const d = low(adapter)
const gguild = message.guild
if (d.get("antispam").find({ guild_id: gguild.id }).value()) {
antiSpam.message(message)
}
}); ```
Error:
```\Bot discord (js)\booot perso\antispam.js:67
if (d.get("antispam").find({ guild_id: gguild.id }).value()) {
^
TypeError: Cannot read property 'id' of null
at Client.<anonymous> (c:\Users\Vitcor\OneDrive\Bureau\Bot discord (js)\booot perso\antispam.js:67:55)
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (c:\Users\Vitcor\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (c:\Users\Vitcor\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (c:\Users\Vitcor\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (c:\Users\Vitcor\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (c:\Users\Vitcor\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (c:\Users\Vitcor\node_modules\discord.js\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (c:\Users\Vitcor\node_modules\discord.js\node_modules\ws\lib\websocket.js:835:20)```
At the start only
it doent work
How you gave?
###Cap Has 1 of the best AntiNuke system on Discord. It has better antinuke system than Security and Wick.It also comes with Moderation, Music, Economy, Utlity and Fun commands etc.
Space after #
oh
alruight ty
Like this ### Hi
Thank You
it works
Yep
Does anyone know how to use discord.py with pyrebase to make a leaderboard command? This is my try:
@client.command(aliases=['lb'])
async def leaderboard(ctx):
for x in db.get().val():
y = db.child(x).child('Wallet').get().val()
f = int(y)
everyonesWallet.append(y)
everyonesWallet.sort(reverse=True)
top1user = everyonesWallet[0].parent()
top2user = everyonesWallet[1].parent()
top3user = everyonesWallet[2].parent()
top4user = everyonesWallet[3].parent()
top5user = everyonesWallet[4].parent()
But it has this error:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, 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: TypeError: '<' not supported between instances of 'str' and 'int'
Can you help me?
Please?
i have a totally different lb from u
Are you using pyrebase with discord.py?
no-
sad
welp imma show u my lb
irrespective that i left that bot
@client.command(aliases = ["lb"])
async def leaderboard(ctx,x = 1):
users = await get_bank_data()
leader_board = {}
total = []
for user in users:
name = int(user)
total_amount = users[user]["wallet"] + users[user]["bank"]
leader_board[total_amount] = name
total.append(total_amount)
total = sorted(total,reverse=True)
em = discord.Embed(title = f"Top {x} Richest People π΅" , description = "This is decided on the basis of raw money in the bank and wallet",color = discord.Color(0xfa43ee))
index = 1
for amt in total:
id_ = leader_board[amt]
member = client.get_user(id_)
name = member.name
em.add_field(name = f"{index}. {name}" , value = f"{amt}", inline = False)
if index == x:
break
else:
index += 1
await ctx.send(embed = em)
async def open_account(user):
users = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
with open("mainbank.json", "w") as f:
json.dump(users,f)
return True
async def get_bank_data():
with open("mainbank.json", "r") as f:
users = json.load(f)
return users
async def update_bank(user,change = 0,mode = "wallet"):
users = await get_bank_data()
users[str(user.id)][mode] += change
with open("mainbank.json", "w") as f:
json.dump(users,f)
bal = [users[str(user.id)]["wallet"],users[str(user.id)]["bank"]]
return bal```
will be different for u as i am storing my bank info in mainbank.json file
Excuse me, what?
Intents are like a way to tell the discord api what events you want to recieve
No
those intents will soon be required to be set in discord.js v13
that's not my point
when the new discord.js update comes out intents will be required lol
They said a video is outdated because intents
yes
that video doesn't have intents in the code
thats the thing
that i just said
bruh
I don't get what you don't get
replying to a 2 month old message. bold move
What does IBM even do today
Help?
May I ask what version of discord.py you're using
uhh
How do I find that
requirements.txt?
the latest
yes
a little bit or experienced
a little bit
ic
The error you're getting means you're trying to compare a str with an int (not allowed in Python; must be the same type). It's ambiguous since I don't see you doing comparison in your source code and the traceback only points towards files in the internal library.
I never compared them
lmao
I'm not saying you did. I'm saying the error did:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: '<' not supported between instances of 'str' and 'int'
is it because of the list.sort() ?
Maybe. The error still says otherwise.
hmm
I have an idea
i will try it
it didn't work ._.
I am trying to get 5 values from Firebase then sort them from the bigger to the lower and then i am trying to get their parent to say that he has the more money..
I fail to see what you didn't understand in that message
It's outdated because intents are not mentioned. If I recall correctly, Discord enforces intents since API v8/v9, so even if it works now doesn't mean it should be recommended as a guide
Feel free to share your POV if you think it's worth being discussed, I don't mind
hi there shiv!
people are going to WANT to update to API v9 soon
which means code lacking intents simply will. not. work.
because v9 got threads
and if discord.js don't pull their finger out and release a stable version with slash commands and threads they're gonna get left behind
all their good stuff seems to be on their beta
./..
Help?
My code
You shall suffer. 
I wont use beta in my bot yet
obviously
but I will try it out ig using a new bot account
just to play around with it
slash commands support looked really nice to me
easy to use
When you ban a user from a guild/server, it's by IP.
every bot does. It is the same as using the ban buttons on discord
how could I stop nodemon from restarting on new file creation
Is this useful? https://github.com/remy/nodemon#packagejson
naah, I think its not possible, what i want
https://github.com/remy/nodemon/blob/master/lib/config/defaults.js#L18
https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md
Perhaps change runOnChangeOnly to true?
runOnChangeOnly didnt work, but what it actually do
@rocky hearththats almost the whole purpose of nodemon, why not use forever, pm2 or bash to startup/maintain scripts?
thanks for mentioning, I'll look up them
hey can u mention what is ur development environment in ts to make bots?
I do yarn watch:dev, to start testing the bot locally
idk, if it is proper dev env. I've heard of using ts-node, but the package require-all doesn't seem to work with it (as it requires js files)
@rocky hearth gimme 5,in the bathroom rn
π , no worries
Have a good shitting session Erwin
Ty, it was quite enjoyable
Shitty situation
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Bot Directly",
"program": "${workspaceFolder}/out/index.js",
"skipFiles": ["<node_internals>/**"]
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/out/index.js",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/out/**/*.js"]
},
{
"type": "pwa-node",
"request": "launch",
"name": "Explorer Enabled",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/src/index.ts",
"outFiles": ["${workspaceFolder}/out/**/*.ts"],
"runtimeArgs": ["-r", "ts-node/register", "--inspect=4765"]
},
{
"type": "node",
"request": "attach",
"name": "Attach Program",
"port": 5880,
"restart": false,
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"showAsyncStacks": true,
"smartStep": true,
"sourceMaps": true
}
]
}
{
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"declaration": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true,
"inlineSources": true,
"lib": ["ES2019", "DOM"],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
"outDir": "out",
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"target": "ESNext",
"watch": true,
"paths": {
"@/*": ["src/types/*"],
"~/*": ["src/*"]
}
},
"files": ["src/types/genshin.d.ts"],
"include": ["src/**/*.ts", "src/commandssrc/globalsbals"],
"exclude": ["node_modules", ".vscode", "emotes"]
}
those are my settings
dist gang
cuz i have a local http server built in with it
ooh ok
my local website/admin panel runs off inside the bot cuz i was too lazy to create a decent token gen for a public api
in paths does ~/* have special semantic meaning?
it does
allows me to dynamically import everything in there, regardless of pathing
cuz it makes it available everywhere
is that intentionally spelt wrong
shush
i just typed it to show it off
as hinted by the shadowed font

@rocky hearth
this is a good example
both of them work exactly the same
what about ~/*
oh, so we can use any symbol?
doesnt need to be a symbol
ok so they dont have any special meaning




