#development

1 messages · Page 779 of 1

earnest phoenix
#

and electron can get compiled down to natives

quartz kindle
#

Its still a js engine

earnest phoenix
#

🤔

quartz kindle
#

Thats what im saying lol

earnest phoenix
#

id rather have a more performant app with 2 processes than one single js app with poor ass performance and gc

#

I can just try to make a little js engine

quartz kindle
#

Thats what i said, you need a js engine to execute js code, in your example electron is your js engine

earnest phoenix
#

Yeah

#

Why not

quartz kindle
#

Or rather, electron's node.js core

earnest phoenix
#

But i can try to make a little js engine electron is big

quartz kindle
#

There are several alternative js engines out there you can try

#

Like duktape

earnest phoenix
#

I see this tomorrow with my new computer

prime cliff
#

electron with c# oh god get out of here lmao

earnest phoenix
#

@prime cliffyou have an advice ?

quartz kindle
#

Why not stick with C#? Why do you need js in the first place?

earnest phoenix
#

For ask botname and put it in not éditable textbox

topaz fjord
#

or you can use c++ and qt mmLol

earnest phoenix
#

Transfer the botname to textbox

quartz kindle
#

And why do you need js for that?

#

Cant C# do that?

earnest phoenix
#

For style, with rainbow cmd this is more beautifull

#

👀

#

personally for me c# is not really good with working with UIs

#

C# can do that

#

so i rather choose electron where i can be completely free with the design

#

to have a more stylish interface

#

@earnest phoenix c# have thèmes...

#

you're thinking of UWP

quartz kindle
#

Technicaly, C# should be able to do everything js does, and more. Whatever you want to do with js, c# cn do too, you just need to find how

earnest phoenix
#

but UWP is ugly and the performance is poor

#

and it's windows only as the name implies

quartz kindle
#

Well so far all he said was cmd, nothing about UI lol

earnest phoenix
#

oh

#

But i dont know how to make a mini cmd for ask the botname in c#

quartz kindle
#

Google it?

earnest phoenix
#

No the cmd is only for the botname

#

Yeah Why not

#

that is the basicest of basics, taking input from the console

#

I already have only make ui apps

#

Else with js

#

Thanks for all

#

Good night

prime cliff
#

personally for me c# is not really good with working with UIs
You do realize that some popular apps like ShareX and Insomnia rest client are made in C#

earnest phoenix
#

im aware

prime cliff
earnest phoenix
#

that looks

#

not pretty

prime cliff
#

It's very clean and not out place and has all the stuff you need

earnest phoenix
#

my goal is to have a performant app with still really good UI and UX experience

quartz kindle
#

Yeah thats where web technology has the edge, with literally 20+ years of UI experience

earnest phoenix
#

which... i did accomplish with the method i stated above

prime cliff
#

Yea but running an extra bowser toolset just for client side apps to look good vs performance is just HyperSweat

earnest phoenix
#

wat

prime cliff
#

It works well for Discord because they actually have a use for it and have optimized the shit out of it but standalone electron apps will just use up a lot of ram/cpu

quartz kindle
#

The league of legends client lul

earnest phoenix
#

you keep forgetting that im using c# which on its own without any optimization still has a really good GC

prime cliff
#

The lol client is electron? wew

earnest phoenix
#

so it's rather not really an issue with resources

quartz kindle
#

Yeah the lol client is a joke lmao

earnest phoenix
#

it would've been really ugly using uwp/wpf

quartz kindle
#

Not to mention its 200+ bugs

earnest phoenix
#

and wpf is ooga booga with almost to no async support

#

Not to mention its 200+ bugs
seen mobile apps yet?

quartz kindle
#

Which one?

earnest phoenix
#

android specifically

quartz kindle
#

League's?

earnest phoenix
#

they break it every other update

#

oh no, discord

quartz kindle
#

Oh lol, im talking about the league client

earnest phoenix
#

oh

prime cliff
#

Like the HUGE server boost messages that never got fixed for a month lmao

earnest phoenix
#

yeah

#

that sucks too

#

heya guys remember when teams were released

#

and discord was like

#

"fuck you guys" and didn't fix anything for 4 months

quartz kindle
#

Mobile dev is such a pain, i hate that i have to make websites mobile-compilant

earnest phoenix
#

sameee

quartz kindle
#

Im much more desktop oriented

prime cliff
#

Yea especially with tweaking every little bit of css just to actually make it look good on both pc and mobile 😩

quartz kindle
#

Or worse

earnest phoenix
#

breakpoints are a pain in the ass

quartz kindle
#

I often need entire sets of divs that only display on mobile

#

For example, navigation bars with hovers and dropdowns

#

I just make a separate mobile nav bar with display none lmao

earnest phoenix
#

pretty much what i do too

#

though i've recently started using css frameworks that have the basic elements down for me and i can build my own on top of those

quartz kindle
#

The only thing i use is normalizr

#

And i still get problems with firefox

atomic quarry
#

Hello DBL I have a problem and I can't seem to figure it out.

#

So the log is saying this

/home/runner/SupSup123s-Moderation-Bot/index.js:112
return message.channel.send({
^^^^^^

SyntaxError: Illegal return statement

snow urchin
#

Aight, I am using this to fetch users in a guild with a certain username, but when there is multiple users with the same username, it only returns one user, so how can I search a server for users with a certain username and discrim?

client.guilds.get("551070196958363648").members.find(user => user.user.username === "Callum")
smoky spire
#

Add it to your find function

vital lark
#

@atomic quarry you have an return statement that isn't allowed, can I see the full code?

atomic quarry
#

Ok

vital lark
#

@snow urchin I would recommend using filter and see if length is under 0

atomic quarry
#

@vital lark ^^^^

vital lark
#

ur missing a }

atomic quarry
#

Ok.

#

Where at?

vital lark
#

ok I know why

#

you put your help command not in the message event

atomic quarry
#

Oh.

#

That's so stupid of me.

earnest phoenix
#

Oh

#

Lol

#

It's a good error

topaz fjord
#

imagine using electron

vital lark
#

what

topaz fjord
#

oh

#

old message

manic terrace
#

I Kickstarter an app that uses electron and it pays my mortgage still, like 4 years later

#

I didn’t engineer it though, I had no idea what electron was until i hired programmer

#

but I designed the application and do all the art for it

earnest phoenix
#

Is there a way to fetch the id of the person logged into the discord windows app using a c# windows forms application without needing oauth2 or a token?

outer niche
#
    tracks = await self.bot.wavelink.get_tracks(f'ytsearch:{query}')
  File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\client.py", line 100, in get_tracks
    return await node.get_tracks(query)
AttributeError: 'NoneType' object has no attribute 'get_tracks'```
sudden geyser
#

why do you just paste your error with no context

outer niche
#
    async def play(self, ctx, *, query: str):
        tracks = await self.bot.wavelink.get_tracks(f'ytsearch:{query}')

        if not tracks:
            return await ctx.send('Could not find any songs with that query.')

        player = self.bot.wavelink.get_player(ctx.guild.id)
        if not player.is_connected:
            await ctx.invoke(self.connect_)

        await ctx.send(f'Added {str(tracks[0])} to the queue.')
        await player.play(tracks[0])

        


blissful scaffold
#
    return await node.get_tracks(query)
AttributeError: 'NoneType' object has no attribute 'get_tracks'

node is None/null

#

You have had NoneType errors a lot before, you should know this by now

proper coral
#

I don't know if this is the right place, but when will the invite manager bot be back online?

quartz kindle
#

Not the right place, ask in their support server

vital lark
#

@blissful scaffold some people never learn; this community has been fucked by people who wanna "program" but don't learn the resources like we did and copied code from GitHub and coming here for help because they don't understand an error that is very self explaintory.

ivory pebble
#

yikes

blissful scaffold
#

At least now I can look smart sometimes

vital lark
#

still, we have to still help people

#

when it's really just self explaintory

blissful scaffold
#

I don't mind helping people, as long as I feel like I'm actually teaching them something

vital lark
#

eh, I do the same but people just come back with the same error and saying how to fix when we helped them millions of times already

earnest phoenix
#

Oh yeah

#

Then how bout this

#

What would be the least intrusive way to tell a user that the bot does not have channel write perms

vital lark
#

most people would ignore that or send them a DM that they don't have perms

manic terrace
#

hand written letter mailed to their physical address; sealed with a kiss. (or DM, probably)

earnest phoenix
#

i dont want to do dms

#

fok

#

Oh well

#

there is a support server for a reason

blissful scaffold
#

When my bot receives a command in a channel where it has no write permissions it just ignores the command. Screw them

earnest phoenix
#

I just log the err right now

#

ill just keep it that way

vital lark
#

that would be the logical way of doing it

earnest phoenix
#

Screw em

manic terrace
#

same except i don't catch the stack i just dump it

blissful scaffold
#

I log it in my debug log, it's not a real error so it wont end up in the error log

earnest phoenix
#

Thats similar to what i have

#

I also setup a channel that it logs too

#

but thats going to be going away very soon...

#

Cba error messages at 3am from someone trying to use a bot without perms 105 times

blissful scaffold
#

my bot has a debug, info and error log
The debug and info logs get archived and reset every day at midnight

earnest phoenix
#

Luckly my bot is not near enough users to warrent that

#

yet

blissful scaffold
#

At the moment I log every db write in the debug log, but I guess there is no need to do that

earnest phoenix
#

Maybe ill just make a channel in my support server where ppl can see specific logs

#

theres no need, but it looks cool

#

Nothing like going through your own logs

blissful scaffold
#

true xD

earnest phoenix
#

I hope

#

One day, we will be graced with one more thing for messages

#

Buttons

#

Could you imagine

#

Not emojis tho

#

Like legit buttons in-embed

#

Or a input feild

sudden geyser
#

At least now I can look smart sometimes
@blissful scaffold true lol

manic terrace
#

do i need a name and an ID to mess with channel stuff?

blissful scaffold
#

no, if you want to get a channel object you dont need both

#

there should be something like getChannelByID or whatever it is in your library ^^

earnest phoenix
#

ligma

lean palm
#

anyone here use nodemon?

rugged hatch
#

Anyone have problem with their api ping

stable horizon
#

You need to provide a redirect uri

earnest phoenix
#

@stable horizon done

stable horizon
earnest phoenix
#

Now also

stable horizon
#

Is it a valid one? Like, one registered in the dev panel?

earnest phoenix
#

Yes

stable horizon
#

Glitch

earnest phoenix
#

Ya

#

Can you help me

stable horizon
#

Well discord says the redirect is invalid

#

So check the discord dev panel again

earnest phoenix
#

Hey there. How do I go about sending messages through my discord bot using web sockets? I'm using node js

lofty vine
#

wdym?

earnest phoenix
#

Oh wait, I realized that in able for my bot to send messages, I have to do it through a HTTP request

#

Correct?

scenic kelp
#

Wha

#

Do you mean a webhook?

earnest phoenix
#

Yeah .-?

#

Sorry, I'm a moron lol

#

So, do I send an request to a webhook?

#

And which one?

scenic kelp
#

You don't need a bot for webhooks yeah

earnest phoenix
#

Wait no

#

I'm making a bot without a library

stable horizon
#

why?

scenic kelp
#

wait why

earnest phoenix
#

Because I'm very curious

scenic kelp
#

uber

earnest phoenix
#

I've used discord js in the past

scenic kelp
#

this is development

stable horizon
#

He's not asking about webhooks

earnest phoenix
#

And want to understand how it works

scenic kelp
earnest phoenix
#

oop

#

So I'm writing my own lib to learn

scenic kelp
#

read the discord docs

earnest phoenix
#

I was, but couldn't find anything. I think I might've scrolled past it

#

Ah nvm, I found it :)

manic terrace
#

alright so this code works as intended; the entrance channel is set by the command and when a new person joins the welcome message goes off fine. however, if two servers both have the bot running it gets silly: if i set the entrance channel to booty in server A and channel B also has a channel called booty then the welcome message fires off in both servers, even if the user only joins channel A

#

how do i avoid that?

blissful scaffold
#

Always try to use a channel id if it is possible

manic terrace
#

i can't figure out how to get an id instead of a name

blissful scaffold
#

if the user gives the channel name then request the channel by its name the first time and store the id of the received channel object

manic terrace
#

i cant find any documentation on getting a channel id from a name

lofty vine
#

lib?

manic terrace
#

js

lofty vine
#

discord.js

#

let ch = message.guild.channels.find(channel => channel.name == "nia-logs")
let chid = ch.id

#

🙂

zealous veldt
#

Can I instantiate a new instance a class from within the class? eg

class Yeet {
  myMethod() {
    return new Yeet()
  }
}```
Please ping me with responses, ty
lofty vine
#

nope maybe 😐

manic terrace
#

still can't really figure out what i am doing and google has failed me

#

oh spoke too soon. got it

manic terrace
#

that didn't work

lofty vine
#

?

#

any errors?

manic terrace
#

kept giving me guff about using let

lofty vine
#

😐 lol why?

manic terrace
#

because they weren't redefined

lofty vine
#

oo

#

lol

quartz kindle
#

Did you try to declare two variables with the same name?

lofty vine
#

no he did'nt use them

manic terrace
#

no i was actually trying to get away with just working with the command argument, and ended up using to const instead

lofty vine
#

lol

quartz kindle
#

That makes no sense, the error you described

lofty vine
#

ye

manic terrace
#

looks like i was looking at the wrong log; and let works but the linter hates it

lofty vine
#

oo nvm

manic terrace
#

works real good now though thank you

brittle mirage
#

Whats in development?

quartz kindle
#

Programming

zealous veldt
#

Is there any way to hide a property of an object or class from console.log?
I have some stuff that I have to attach to this in a class, but it's big and really makes it ugly when logged to the console

#

nvm

vital lark
#

no

valid frigate
#

well yes but actually no

#

it would require some long ass shit to do

#

wait moose are you making an eval command lol

vital lark
#

no

#

he want class parameters to be private

manic terrace
#

is it shit form for a bot to send messages to each server it’s on?

vital lark
#

what

manic terrace
#

like if a bot gets an update or new shit, is it bad form for the bot to send a message to each server its on to say something like "I Updated! Here's how:"

quartz kindle
#

Yes

manic terrace
#

that's what i figured

quartz kindle
#

Generally a bot should never do anything without being asked to

#

But what you can do, is send a dm with the update the next time a person uses the command

zealous veldt
#

@valid frigate no, it's for my entities for an API lmao

valid frigate
#

oh

quartz kindle
#

You can make it a private property in node 12+

zealous veldt
#

Don't they require v8 v7.3

#

Which node isn't on yet

quartz kindle
#

They were implemented in node 12.0.0

#

Private class properties/methods

delicate zephyr
#

They made it really ugly tho mmulu

vital lark
#

^ I agree

#

#var = 'x' is kinda ugly

valid frigate
#

every language has its caveats

delicate zephyr
#

They could have just giving it a keyword

vital lark
#

@delicate zephyr I would like to do this._{name} = {value}

#

_{name} would be the private property

delicate zephyr
#

Or you know

#

private var = 0

vital lark
#

ur crossing TypeScript

#

which I like

delicate zephyr
#

I don't even know TS

vital lark
#

I can tell

delicate zephyr
#

Merge the two, take the things that are good from each side and merge them

#

¯\_(ツ)_/¯

#

Like not compiling to js

vital lark
#

yea let's just make typescript a different language

manic terrace
vital lark
#

so you wanna learn regex

manic terrace
#

not so much learn it, but at least understand what it is

#

like maybe if there is time when i am dead to learn it? i understand that in the thing i am learning to do that this gibberish tells my command what is or is not acceptable in the arguments for an equation. i just can't parse those hieroglyphics

fossil hazel
#

Ok, I am trying to fix a bug for my upgrade command, but math isn't really my strong point. I want each work upgrade to be 5k, but when they say they want to buy 3 upgrades from level 2-5, it should be 40k, but I just don't get that lol. Anyone good at math that can help me solve this most likely simple equation lol

vital lark
#
> const level = 2;
undefined
> const upgrade = 5000;
undefined
> level * upgrade;
10000
``` I'm thinking this but ![Shrug](https://cdn.discordapp.com/emojis/388950974817107968.webp?size=128 "Shrug")
fossil hazel
#

OOpS, I meant I want each work upgrade to be 5k more than the last. So level one is 5k, level 2 is 10k, etc. It works fine when they buy them one at a time, but when they buy them in pairs the prices are lower than what they should pay if I make any sense lol

fluid basin
#

huh

#

isnt that simple afaik

#

just take current level * 5000

#

and do summation

#

n * (n + 1) / 2

#

wait

#

yeah

vital lark
#

that's what I did...

fluid basin
#

tbh just use the more general method

#

nono thats what not he meant

#

when math fails you, you add them up manually

#
money = 0
for (startlvl, endlvl, startlvl++):
  increase money by startlvl * price of each lvl
  // then just keep adding until you reach the final level
vital lark
#

uh

#

don't think you should do that

fossil hazel
#

Which is it LOL

earnest phoenix
#

I need an idea for economy shit while on PY

#

lmfao

#

I was wondering if I could get some help

#

I am new to this stuff

fluid basin
#

@vital lark why not, its the easiest way and doesnt need math

vital lark
#

sure, what do you need help with

earnest phoenix
#

Level System

vital lark
#

@fluid basin why use a for loop in any math equations WhyThis

earnest phoenix
#

not economy lmfao

fluid basin
#

@vital lark then what, a while loop??

vital lark
#

what do you need help with...

earnest phoenix
#

Level System

fluid basin
#

owo

earnest phoenix
#

Python

vital lark
#

I'm not spoonfeeding you

earnest phoenix
#

alright

fluid basin
#

does augu know python

vital lark
#

nobody will

#

I do

grizzled raven
#

make variable

#

ur welcom

vital lark
#

bruh

modest maple
#

why not just make the prefix and command lower case always

fleet mason
#

const prefix = `o!` || `O!` wont really work

#

since the first will always be true

#

if you want more prefixes you can make a array and check it

#

do you want different things to happen? depending on the prefix?

#
const prefix = ["prefix1", "prefix2"] 
if(!prefix.includes(userPrefix)) return;
#

How do you find the prefix currently?

#

from the message

#

like userPrefix or?

#

yea you have to get that from the message

#

its like when i type !help , you want to get ! from the message and check after it

#

I use this let prefixes = []; let prefix = false; for (const thisPrefix of prefixes) { if (message.content.toLowerCase().startsWith(thisPrefix)) prefix = thisPrefix; }

#

prefixes

#

inside the prefixes array

#

You can use the code i sent

#

works with unlimited prefixes

#

I have toLowerCase() in my code

#

huh

#

np

warm marsh
#

Theres an easier way.

#

That doesn't require a for loop.

#
const prefix = /^o\!/i;

if (!prefix.test(message.content)) return;
late hill
#

The example you gave leads me to believe you don't actually know what your code does

#

Putting both O! and o! while your code lowercases the content before checking

#

O! will never match

#

If you used O! it'll match the o!

#

makes sense

#

yes

#

ok

#

bye

earnest phoenix
#

A!help

#

!help

#

yo

#

does anyone know how to make an autorole?

summer torrent
#

which library

earnest phoenix
#

js

mossy vine
#

d.js or eris

earnest phoenix
#

d.js

mossy vine
#

or something else

#

on the guildMemberAdd event add a role to the member

summer torrent
#

^

earnest phoenix
#

alr ty

summer torrent
earnest phoenix
#

ty

#

so like

#
Client.on('guildMemberAdd', member => {
   console.log(`[${b}:${c}` + member.user.tag + 'test'

   var role = member.guild.roles.find((role) => role.name === "user");
   member.addRole(role);
   member.send('', Embeds.autorole)
)};
#

idk

mossy vine
#

you can also provide an id for addRole

earnest phoenix
#

ye

mossy vine
#

other than not closing your console.log and assuming Embeds.autorole is a proper embed object that should work yeah

toxic jolt
#
const Discord = require('discord.js');
const db = require('quick.db');

exports.run = (client, message, params, args) => {
client.on("message",message => {
     if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send(':no_entry: Davet takip Kanalı ayarlamak için `Yönetici` yetkisine sahip olman gerek.')
     let davettakip_ = message.mentions.channels.first().id
     if (!davettakip_) return message.channel.send(':no_entry: Davet takip Kanalı Ayarlamak İçin Bir Kanal Etiketlemelisin. `!!davet-takip #kanal`')
    let gkanal =  db.set(`pikachucodedavettakip_${message.guild.id}`, davettakip_)
        message.channel.send(`<#${gkanal}> Kanal ayarlandı.`)      
  })
};```
lilac wharf
#
    if (!message.mentions.channels.first()) return message.channel.send(`channel not mentioned.`);
    let davettakip_ = message.mentions.channels.first().id;
earnest phoenix
#

@toxic jolt use
let davettakip_ = message.mentions.channels.first();

And after
davettakip_.id

lilac wharf
#

Try that

toxic jolt
#

ok thanks

#

guys

lofty vine
#

hie

#

how do ye make a snipe command? using discord.js

summer torrent
#

use messageDelete event

lilac wharf
lofty vine
#

ye I am using that event but snipes are not being written to my file

lilac wharf
#

Oh a snipe command... I thought you said simple

#

My bad...

late hill
#

Why are you writing it to a file anyway

lofty vine
#

lol nvm

#

um to store it for every guild

#

any alternatives?

late hill
#

cache it

#

use a database if it's a lot of data/important to be kept through reboots

lilac wharf
#

store it in a database and also output it to a channel logs channel...

lofty vine
#

um how do ye do that? any guides?

toxic jolt
#

and @lilac wharf

lilac wharf
#

If you don't know how to do that I'd suggest looking into something like Mongodb (mongoose), MySQL or postgresql.

lofty vine
#

oo thanks

lilac wharf
#

They are all types of databases @lofty vine

toxic jolt
#
const Discord = require('discord.js');
const db = require('quick.db');

exports.run = (client, message, params, args) => {
     if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send(':no_entry: Davet takip Kanalı ayarlamak için `Yönetici` yetkisine sahip olman gerek.')
     let davettakip2_ = message.mentions.channels.first();
     if (!davettakip2_) return message.channel.send(':no_entry: Davet takip Kanalı Ayarlamak İçin Bir Kanal Etiketlemelisin. `!!davet-takip #kanal`')
    let cortex =  db.set(`cortexdavettakip_${message.guild.id}`, davettakip2_.id)
        message.channel.send(`<#${cortex}> Kanal ayarlandı.`)      
};```
#

i changed davettakip2_.id

late hill
#

Your database stuff isn't instant

#

await it

lilac wharf
#

^

#
let cortex = await db.set(`cortexdavettakip_${message.guild.id}`, davettakip2_.id)
toxic jolt
#

thanks man

#

❤️

summer torrent
#

read the error

lofty vine
#

use async function

lilac wharf
#
exports.run = async (client, message, params, args) => {
summer torrent
#

don't sponfeed pls

toxic jolt
#

thanks

lofty vine
#

oo

toxic jolt
#

fixed

late hill
#

You don't even need what it returns as you already have the id

lofty vine
#

lol

late hill
#

so you could just ignore the promise entirely

toxic jolt
lilac wharf
late hill
west raptor
#

@late hill they're using the return value it looks like

late hill
#

Pretty sure it returns the value they set it as

#

Which they already have

#

Because they've set it

west raptor
#

¯\_(ツ)_/¯

#

JavaScript 👏 developers 👏

frank wyvern
#

Anyone know who to get a DM channel Id?

summer torrent
#

which library

uneven wyvern
#

@frank wyvern discord.js master: user.dmChannel.id

amber fractal
#

Be careful with that tho, if no dm channel exists it will error

#

Check beforehand

uneven wyvern
#

yeah

frank wyvern
#

thanks

manic terrace
#

like the readme gives an import instruction for node, but node tells me i can't use import

amber fractal
#

Theres a section on nodejs

#

@manic terrace

#

You may be on an older version of node that doesnt have import which is on v12+ (according to that I actually dont know)

manic terrace
#

i'm on node 13.7

amber fractal
#

Oh what error does node give you

manic terrace
#

throw err, Error: Cannot find module 'rpg-dice-roller/lib/esm/bundle.min.js'

amber fractal
#

Ah that's just a path error

#

You need to make sure you have the correct path

#

Idk if import is from current file or working directory of the app

west raptor
#

@manic terrace you trying to import from where the file is in

#

So it thinks it's looking for $DIRECTORY_WITH_FILE/rpg-dicer-roler/...

modest maple
#

easy way is making your own roll system skyShrug

manic terrace
#

feels like that's the opposite of the easy way

modest maple
#

i mean you have greater control over everything and can easily add more

#

i say that with our roll system being like 2000 lines long

#

xD

manic terrace
#

haha

#

i work in RPGs full time and have 0 interest in designing a new roll system in my "for fun time" which is trying to make a discord bot for an RPG i wrote

#

especially one that's 2000 lines 😩 haha

modest maple
#

i mean the Roll system we built does do the following:

  • Basics rolls e.g 1d20
  • Roll addition and subtraction e.g 1d20 + 4d6 + 4
  • Dice multiplication e.g 1d20 x 1d4
  • Random Stats for PF, DnD 5e, other table tops
  • Keep highest, keep lowest
  • exploding dice
  • rerolling x times or randomness or any other pre assigned methods
  • custom presets
  • KH/KL dice average system aswell
  • ive forgotten the rest
#

cuz we're sad like that

#

xD

manic terrace
#

haha

#

rpg-dice-roller does all that except the stats. but you can use it with tracery to roll up an entirely random PC. i used cheapbotsdonequick to make a twitterbot that will make a full level 0 PC for one of my games

#

it'll also give you random sights in the woods, names, seasons/weather

modest maple
#

being someone who has used prg-dice-roller before it doesnt xD

#

it can do alot

#

but not everything

#

xD

manic terrace
#

i want to be someone who has used rpg-dice-roller but i still can't get it to work

modest maple
#

ngl

#

you could program rpg-dice-roller in an hour and do the same thing

#

saying that probably less

manic terrace
#

maybe you could lol, but I tried last night and failed

modest maple
#

👏 Regex is your best and worst friend 👏

manic terrace
#

I gathered haha

#

got a goin toss workin no problem though, I feel pretty good about that

uneven wyvern
modest maple
#

probably better off asking glitch

uneven wyvern
#

I don't wanna wait lol

modest maple
dull terrace
#

Un français de dispo ?

modest maple
#

english only

dull terrace
#

dommage, mais me faut vraiment un français, un peu la flem de parler anglais la

modest maple
dull terrace
#

x)

#

tu parle français ou tu utilise un traducteur ?

summer torrent
#

english only

dull terrace
#

oui je sais

earnest phoenix
#

(node:17300) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined```js
module.exports = async (bot, message) => {

var con = bot.con

con.query(`SELECT * FROM prefix WHERE id = ('${message.guild.id}')`, (err, rows) => {
    if(err) throw err;
  
    let prefix = rows[0].prefix
});

console.log(`${bot.user.username} is online on ${bot.guilds.size} servers! `)
var list = bot.guilds.array().sort();
console.log("Szerverek: " + list );


  bot.user.setStatus('idle')


  let statuses = [
    "www.otachan.nhely.hu",
    ">.<",
    "help"
  ]

  setInterval(function() {
    let status = statuses[Math.floor(Math.random() * statuses.length)];
    bot.user.setActivity(status, {type: "WATCHING"});
  }, 4000)

};```

mossy vine
#

what line are you getting that on

earnest phoenix
mossy vine
#

line

earnest phoenix
mossy vine
#

message is undefined

#

how are you calling the function

earnest phoenix
#

which function?

mossy vine
#

the function you are exporting

earnest phoenix
mossy vine
#

wait what event is this supposed to be

earnest phoenix
#

bot.on(ready

mossy vine
#

you dont get a message in a ready event

manic terrace
#

i got rpg dice roller working, sucks to that assmar

topaz fjord
#

Cool

outer niche
#
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'disconnect'``` i do not get why bc it is in vc
shut cipher
#

anyone know how i can make a .gif file size smaller

blissful scaffold
#

'NoneType' object has no attribute 'disconnect'
You are calling disconnect on a non existing object

outer niche
#

what

slender thistle
#

something before disconnect is of type None

#

How many hours have we been at this

outer niche
#

30 min

#
async def leave(ctx):
    server = ctx.message.guild
    voice_client = server.voice_client
    await voice_client.disconnect()``` i do not get what is
slender thistle
#

await voice_client.disconnect()
If you are calling .disconnect on a None, what do you think the value that is stored in voice_client is?

outer niche
#

idk

modest maple
#

jesus dude you r still dealing with learning d.py voice

outer niche
#

shud it be voice_bot

blissful scaffold
#

voice_client = server.voice_client
server.voice_client returns nothing/none/null

outer niche
#

so it needs to be await server.voice_client.disconnect()

slender thistle
#

How

#

How did you come to that conclusion

#

Did you actually learn Python before getting to discord.py

outer niche
#

yes

slender thistle
#

Why are people so entitled nowadays

topaz fjord
slender thistle
#

server.voice_client returned None aka nothing

#

There's no voice client active in the server

outer niche
#

yeee but the bot is in vc

slender thistle
#

Are you sure you are not running some other bot by any random chance

outer niche
#

it is in with me

slender thistle
#

How exactly are you connecting the bot

outer niche
#

!play

topaz fjord
#

you can try voice_client_in(server) instead of voice_client

#

but voice_client is a shortcut for voice_client_in anyways

#

idk if it'll make much of a difference

outer niche
#
    async def play(self, ctx, *, query: str):
        tracks = await self.bot.wavelink.get_tracks(f'ytsearch:{query}')

        if not tracks:
            return await ctx.send('Could not find any songs with that query.')

        player = self.bot.wavelink.get_player(ctx.guild.id)
        if not player.is_connected:
            await ctx.invoke(self.connect_)

        await ctx.send(f'Added {str(tracks[0])} to the queue.')
        await player.play(tracks[0])
``` this is the play command
topaz fjord
#

what is connect_

#

@outer niche

outer niche
#

so it connects

west raptor
#

yeah but

#

what is it

topaz fjord
#

what's the code

west raptor
#

where is it defined

topaz fjord
#

lmao

#

@outer niche

modest maple
#

👏 This 👏 Is 👏 Why 👏 We 👏 dont 👏 copy 👏 paste 👏 code 👏

outer niche
#

ummmmm no ware

topaz fjord
#

bruh what

west raptor
#

ctrl+f self.connect_

outer niche
#

that is the only place

modest maple
#

dude, i gotta ask, how much python do you actually know and why did you copy paste code

topaz fjord
#

@outer niche what piece of code is giving the error

outer niche
#

it is saying the bot is not in a vc but it is

modest maple
#

👏 dont 👏 copy 👏 paste 👏 code 👏

#

👏 learn 👏 basics 👏

grizzled raven
#

why are you clapping hes doing the wrong thing smh

modest maple
#

to try snap him out of it

#

sarcastic clapping

grizzled raven
#

/s

topaz fjord
#

what d.py version @outer niche

outer niche
#

the newist

modest maple
#

which is

earnest phoenix
#

The newist

abstract crow
blissful scaffold
#

Copying code is only good when you actually KNOW how every line in the copied code works

#

copying code is often more work than writing it yourself

earnest phoenix
#

Yup

topaz fjord
#

@outer niche does ctx.author even work

#

does it log something to the console

abstract crow
#

the name sounds familiar

#

we've had problems with him before iirc

modest maple
#

he doesnt listen

#

we have told him

#

to learn basics

#

and stop copying code

abstract crow
#

yep

outer niche
#

yes it duz worck

topaz fjord
#

did you ever check the docs

#

to see

#

that

#

it's not channel

#

but

modest maple
#

no he doesnt

topaz fjord
#

voice_channel

earnest phoenix
#

Ok I think he is under 13

outer niche
#

i am not under 13

earnest phoenix
#

Hm

abstract crow
#

A. Act like it
B. iirc you sound like it too

earnest phoenix
#

Thank you @abstract crow

modest maple
#

C. read the fucking docs

earnest phoenix
#

LMAO

modest maple
#

and learn the basics

#

and dont copy code

#

if you dont know

abstract crow
#

we want to help but like

modest maple
#

what connect_ is

abstract crow
#

you gotta put effort in

modest maple
#

when you should of programmed it

earnest phoenix
#

Also we don’t spoon feed it to you

modest maple
#

if you actually programmed it instead of C+P you would understand what your code is actually doing

topaz fjord
#

it's not that hard

modest maple
#

turtle

topaz fjord
#

@modest maple wut is that emote

modest maple
#

i would say remove that link

#

that version is like a year or more out of date

topaz fjord
#

what's the newsest

modest maple
#

and a completly different lib

#

rewrite

#

1.3.1

outer niche
#

connect_ is to connect the bot to a voice channel You do !connect (whatever VC you want) If you're not in it

topaz fjord
#

?

#

why the fuck does it look like it's written in the 90s

modest maple
#

cuz its the standard readthedocs site

#

and @outer niche you have legit just said what the command does

#

not what the code does

#

or how it works

earnest phoenix
#

this is help vampirism at it's finest

#

this already happened three times with the same person

modest maple
#

you dont even know where self.connect_ even is referenced

#

@earnest phoenix 4 or 5 atleast

abstract crow
#

yep @earnest phoenix had issues with him too

earnest phoenix
topaz fjord
#

ok im high

abstract crow
#

yep @earnest phoenix had issues with him too

topaz fjord
#

@outer niche log ctx.author.voice

#

and tell me what it says

earnest phoenix
abstract crow
#

I bet you 10 bucks I, a Javascript user, can figure that out by reading the docs

#

Found connect

west raptor
#

i mean

#

you can read any docs really

#

despite the language

abstract crow
#

obviously he can't

modest maple
#

he doesnt

earnest phoenix
#

he got told to read the docs multiple times before

topaz fjord
#

i had some double message issues

#

discord did a fuck up

earnest phoenix
#

yup

west raptor
#

was talking to vinnie

abstract crow
#

True

#

But just proving the point

#

that it doesn't take much to read the docs

earnest phoenix
abstract crow
#

although I personally hate the discord.py docs, its still useable

topaz fjord
#

why am i helping with python

#

idk it

abstract crow
#

^

topaz fjord
#

I should create my image server

#

using go™️

#

also intellij did an update

abstract crow
#

Would anyone happen to know about my question above?

modest maple
#

have they made it not eat ram

quartz kindle
#

Is there an api for mangaupdates?

#

Its better than any other manga list out there imo

modest maple
#

which

#

i dont think there is

#

but we can make one

quartz kindle
#

I thought about making one for a long time

#

In fact i have a manga project thats been shelved for years

#

Idk when if ever ill get back to it

modest maple
#

ive still gotta build the majority of the API back end for the crunchyroll stuff again

#

so much is broke -_-

quartz kindle
#

Are you parsing a bunch of stuff?

modest maple
#

depends on what the query is

#

overall its pretty simple

#

basically just a single search term or key word query, get given a uniqueId response

#

wait for request to come back from an event

#

for fuzzy searches etc...

#

but not rlly decided other than send query with key terms

quartz kindle
#

I tried making a search/query thing for mangaupdates, but the problem is that google provides much better results than mangaupdates' own search functions lol

earnest phoenix
#

make them have a ddg bang

#

.>

#

but this is difficult DISCORD LOGIN OAuth2

#

what

#

I'm trying to use a Discord Login to use my bot's dashboard interface just got stuck

#

login works just can't get data from discord eg EMAIL USERNAME GUILD ETC.

#

thanks i'll see what i can do

#

i have a lot of this PHP programming

#

I managed to write a login system, but I have no idea to retrieve anything

sudden geyser
#

@quartz kindle you can search for entires on MangaUpdates, but you cannot get information about a specific manga without scraping the page.

quartz kindle
#

You can

#

You can make the page output json

sudden geyser
#

can you show an example (it didn't work for me like 1/2 a year ago)?

#

actually I was going to post the link but it has nsfw results

quartz kindle
#

Yeah i guess json output only works for searches

#

I was pretty sure i did it for pages tho, but that was like 4 years ago

earnest phoenix
#

i started making a web page for my discord bot where i could set things up on a webdashboard just so this is discord AOuth2 i would have started to write it and so as you can see in the video i have no idea how to get things on discord dev api page but I don't understand anything and thank you very much if you could get a little / bigger help
https://youtu.be/y13BKHEMOmg

outer niche
#
Traceback (most recent call last):
  File "C:\Users\culan\Desktop\echo\echo.py", line 25, in <module>
    bot.load_extension("wavelinkcog")
  File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\bot.py", line 623, in load_extension
    raise errors.ExtensionNotFound(name, e) from e
discord.ext.commands.errors.ExtensionNotFound: Extension 'wavelinkcog' could not be loaded.```
earnest phoenix
outer niche
#

idk why bc to mee it looks richt

slender thistle
#

discord.ext.commands.errors.ExtensionNotFound

outer niche
#

what about it

slender thistle
#

ExtensionNotFound

outer niche
#

but how it worcked a min ago

slender thistle
#

Probably because you're giving it the wrong path or renamed the extension file itself

outer niche
#

worng path i have not messed with the code

#

idk what the fuck i did but i fised it

blissful scaffold
#

Extension 'wavelinkcog' could not be loaded.

stable horizon
#

You have already been told stuff

#

Oh notfound. Nope that's a different one

west raptor
#
struct Package {
    name: String,
    author: String,
    version: String,
    maintainers: Vec<String>, // TODO: Maintainer Struct
    dependencies: Option<Vec<Package>>,
    build_dependencies: Option<Vec<Package>> // TODO: BuildDep Struct
}```

should build deps be it's own thing
#

im not sure if it's worth it here

#

im thinking of having them optionally removed after the install is finished

lofty vine
#

Hie

#

Which way is better to code:
Including all events and commands to index.js
Including events to index.js and using command handler for commands
Using events and command handlers

west raptor
#

Event and command handlers is the way to go

lofty vine
#

oo

#

thanks

west raptor
#

In nodejs it's relatively easy to do btw

lofty vine
#

yep

west raptor
#

You have the option of classes as well

lofty vine
#

I am not that good coder xD

west raptor
#

If you're going for an OOP style

#

You should learn how to use classes

lofty vine
#

ye soon I guess

#

thanks

blissful scaffold
storm wagon
#

ty

#

I cant seem to find the classname for the far background w/ the shapes and such

blissful scaffold
#

you put the background-size css in the same block as where you have your background image stuff

manic terrace
#

is there a relatively simple way to remove the first character from an argument?

#

i tried a few things but turns out you can't just do args[2] - '+'

prime cliff
#

@storm wagon

.shapes-background {
    background: none !important;
}```
storm wagon
#

thank you

#

@prime cliff wait

#

i tried that

#

nothing changed

prime cliff
#

?

storm wagon
#

OH

#

wait

#

the image went black and white and the only some of the bg filled

prime cliff
storm wagon
#
<style>
.shapes-background {
  background-image: url('https://steamuserimages-a.akamaihd.net/ugc/959724452090823050/C82C997CC035235F8F0889A6AA595C44FF7B57EE/?imw=637&imh=358&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=true') !important;
}
</style>```
#

did i do something wrong?

prime cliff
#

That was to remove the shapes background

#

Not the entire page background

storm wagon
#

oh

#

then how do I change the page background

prime cliff
#

For the background use

body {
  background-repeat: no-repeat;   
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("https://linkhere.png") !important;
}```

You can also add a dark overlay with this
```css
body {
  background-repeat: no-repeat;   
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("https://linkhere.png"),linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0.5)) !important;
 background-blend-mode: overlay !important;
}```
storm wagon
#

oh

#

thank you

#

IT LOOKS GREAT! TYSM!!

#

what's the reccomended size for a background?

prime cliff
#

There isn't really a recommended size since it can be streched to most screen sizes but just make sure it isn't something too small so the quality is bad

storm wagon
#

ah

#

im using 1000x1000

#

One last thing (sorry to bother you)

#

How do I add a custom font?

#

I saw this online for an undertale font: <link rel="stylesheet" type="text/css" href="//undertalefonts.duodecima.technology/webfonts/stylesheet.css">

#

how would I implement that

tacit stag
#

try this maybe

storm wagon
#

....try...?

tacit stag
#

sorry it took me a sec, got distracted

storm wagon
#

hm

#

its using fontfaces

#

i think i need a stylesheet reference

#

but im not sure

tacit stag
#

im gonna try and do it, and if it works, ill let you know how

storm wagon
#

tysm

#

:)))

tacit stag
#

looks like you do font-family: "(font name)"

#

but for some reason its not popping up

storm wagon
#

ill try again

tacit stag
#

what im trying now is:

@font-face {
    font-family: 'Undertale Papyrus';
    src: url('https://cartr.gitlab.io/undertale-fonts/webfonts/papyrus-webfont.eot');
    src: url('https://cartr.gitlab.io/undertale-fonts/webfonts/papyrus-webfont.eot?#iefix') format('embedded-opentype'),
         url('https://cartr.gitlab.io/undertale-fonts/webfonts/papyrus-webfont.woff2') format('woff2'),
         url('https://cartr.gitlab.io/undertale-fonts/webfonts/papyrus-webfont.woff') format('woff'),
         url('https://cartr.gitlab.io/undertale-fonts/webfonts/papyrus-webfont.ttf') format('truetype'),
         url('https://cartr.gitlab.io/undertale-fonts/webfonts/papyrus-webfont.svg#undertale_papyrusregular') format('svg');
    font-weight: normal;
    font-style: normal;

}

#

but with all of them

#

yes that works

#

@storm wagon

#

go here

#
  1. Select the font you want
storm wagon
#

Oh wow

#

thats a lot

#

tysm

tacit stag
#
  1. make sure you add the full source to them
storm wagon
#

I also went around experimenting

#

TYSM!

tacit stag
#

and thats it

#

no problem!

#

let me know if you experience any issues

storm wagon
#

wait @tacit stag do i put that in <style>?

#

i think so yea?

#

im still trinna get it to work

tacit stag
#

yes, at the top of the html piece, put ```html
<style>
/* here */
</style>

#

whichever one you chose + the full src

#

which font are you using?

storm wagon
#

AYY i got it

tacit stag
#

cool 🙂

storm wagon
#

i needed to put it into .longdescription .content

tacit stag
#

yes

#

looks awesome!

storm wagon
#

one last thing -- sorry to bug you lol -- what's the name of the element "description"? I tried .description but it didnt work @tacit stag

tacit stag
#

lemme see if i can find it

#

.bot-description maybe?

storm wagon
#

ill try

#

OOH

#

im blind

#

.botinfo

#

lkemme try that

tacit stag
#

thats the whole box yes

#

i thought u meant the small desc box.

storm wagon
#

wait

tacit stag
#

and its .bot-info

storm wagon
#

.bot-info

#

didnt work

#

;-;

tacit stag
#

you trying to change all of the text there, right?

storm wagon
#

yes

#
.bot-info{
  font-family: myFirstFont;
}```
#

horrible naming i know JoyRow

#
<style>
body {
  background-repeat: no-repeat;   
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("https://steamuserimages-a.akamaihd.net/ugc/788613673876117799/CC7E7FC0B6128A87F312520DA5A92381750F4D35/") !important;
}
.longdescription .content{
  background: #000000;
  color: #ffffff;
  font-family: myFirstFont;
}
@font-face {
  font-family: myFirstFont;
  src: url("https://cartr.gitlab.io/undertale-fonts/webfonts/sans-webfont.woff2");
}
div {
  font-family: myFirstFont;
}
.longdescription {
  font-family: myFirstFont;
}
.bot-info {
  font-family: myFirstFont;
}
</style>``` the whole thing
tacit stag
#

okay

#

its ```css
#details #bot-info {

}```

#

i realized this after i tried to change the color for the title, and saw you need the #details behind it

#

so fully:

#details #bot-info {
  font-family: myFirstFont;
}```
#

also @storm wagon is your bot named after LiterallyNoOne on youtube?

storm wagon
#

@tacit stag why yes it is! It was originally made for him

#

But the project evolved

#

We're good friends

tacit stag
#

thats really cool! I love his remixes and originals

storm wagon
#

Ik!

#

We're working on this fun undertale translated project

#

if u want in lmk

#

im suprised youre not part of the discord lol

tacit stag
#

ill definitely think about it! can you send a link to the discord?

storm wagon
#

go to his recent vids, its in the description 🙂

tacit stag
#

kk

storm wagon
#

@tacit stag or just click here

#

@tacit stag o i tried it and it didnt do the thing ;-;

#
<style>
body {
  background-repeat: no-repeat;   
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("https://steamuserimages-a.akamaihd.net/ugc/788613673876117799/CC7E7FC0B6128A87F312520DA5A92381750F4D35/") !important;
}
.longdescription .content{
  background: #000000;
  color: #ffffff;
  font-family: myFirstFont;
}
@font-face {
  font-family: myFirstFont;
  src: url("https://cartr.gitlab.io/undertale-fonts/webfonts/sans-webfont.woff2");
}
div {
  font-family: myFirstFont;
}
.longdescription {
  font-family: myFirstFont;
}
#details #bot-info {
  font-family: myFirstFont;
}
</style>```
tacit stag
#

hmmm

#

let me try

storm wagon
tacit stag
#

it worked for me a min ago

#

lemme try again

#

almost got it

storm wagon
#

oo

#

ty

dim flume
#

Can any one help me with the help command

#

I use node. Js

#

Pls pls pls pls pls pls pls pls pls pls pls pls pls pls pls

storm wagon
#

also "pls pls pls pls" is annoying

dim flume
#

What is the difference

storm wagon
dim flume
#

Between python and node

storm wagon
#

i think you need to take a deep breath

#

cuz theres a lot

dim flume
#

I managed the bot to kick ban

tacit stag
#

something like this ThatOneCalculator

storm wagon
#

Bro he finna kick ban me im scared worried_and_scared

dim flume
#

And also

storm wagon
#

@tacit stag what did you get lol

dim flume
#

To send donate link

tacit stag
#
#details #bot-info p,span {
    font-family: "MyFontFamily"
  }
  #details #bot-info .bot-name {
    font-family: "MyFontFamily"
  }
  #details #bot-info .lib {
    font-family: "MyFontFamily"
  }
storm wagon
#

@dim flume please take this somewhere else

stable horizon
dim flume
#

Wdym

storm wagon
#

@tacit stag how did you figure that out?

#

it looks amazing btw :))

tacit stag
#

a lot of trial and error

#

also, the status can be fixed with:

#
#details #bot-info .status {
   font-family: "MyFontFamily"
  }
storm wagon
#

ah

#

tysm

tacit stag
#

just add this to the bottom

#

no problem

#

i realized that it wouldnt change the overall font for some reason, so i changed individual ones instead

storm wagon
#

You're the best!

earnest phoenix
storm wagon
#

Looks snazzy af

#

@tacit stag only change is dont put the name in quotes

tacit stag
#

ah

#

looks awesome!

storm wagon
#

:)))

peak ivy
fiery stream
#

Heya

valid frigate
#

i beg to differ that it looks "awesome" because definitely the colors don't go well together

#

comic sans is an exception because of the theme of ur bot, but id suggest making the colors less intense

storm wagon
#

id argue its for the aesthetic, but what colors would you reccomend?

fiery stream
#

Can anyone get me a like

#

Life*

valid frigate
#

uhhh

#

i mean in terms of the background

#

maybe less opacity?

#

doesnt have too be too much but it makes your title & description kind of hard to see

storm wagon
#

ok

earnest phoenix
#

hello

lofty vine
#

hello

dense drift
#

@sinful lotus I have my bot require a whitelist. If you have a testing server I'll add it to the whitelist before you try to invite.

sinful lotus
#

this is a public bot list, if your bot is like only specific individuals can invite it, I don't think its tailored for public usage do it?

#

@coral trellis what is your thoughts

dense drift
#

The goal is to be more community based, like users asking for specific things, and I make it for them.

#

¯_(ツ)_/¯

#

That's why I have an approval system.

#

However, if that doesn't match what's required, I get it.

#

It's a tailored bot essentially.

sinful lotus
#

Wait for Xig's input on this matter for now, depending on what is his thoughts, we may not accept or accept it, since I personally think public bots should and can be invited by anyone.

dense drift
#

Okay, fair enough.

#

Thanks for hearing me out.

coral trellis
#

If bots are able to test it and you allow others to use it and not restrict it to only your servers then it's fine

#

If there's a process to get whitelisted it's okay

dense drift
sinful lotus
#

ok just resubmit your bot and we will review it again once we plow on our queue again

dense drift
#

It's hasn't been reviewed yet, I just saw that you were denying others for that reason.

#

I just wanted to get ahead of the game.

sinful lotus
#

sure

#

or its possible to include it on your description

dense drift
#

It is there. 🙂

sinful lotus
#

so at least we know that is needed and I won't be guessing why it leaves without any reason

#

thats why I declined a bot that auto leaves

dense drift
#

Before it leaves, it says you need to be whitelisted, then it leaves.

sinful lotus
#

then thats ok

dense drift
#

Awesome.

sinful lotus
#

since at least it says why it leaves

dense drift
#

Yep, that's the goal.

lofty vine
#

Hi I need help with making event handlers

#

I managed to make command handlers but I am not able to make event handlers

sinful lotus
#

pretty much the same

#

except you insert the exec function

#
// load your event
const event = require(eventPath)
client.on(event.name, event.run)

idk how you implemented yours tho so yeah not sure on how you would do it on your case

lofty vine
#

oo thanks

sinful lotus
#

probs yo ucan use that as your reference

lofty vine
#

yea thanks!

#

I created basic event handlers but how about the dbl events? shall I keep them in my index.js or is there any way of putting them in form of events?

green kestrel
#

i'll just leave this here. sometimes you just have to write code that makes you go 'wtf'

                /* Some moron thought it was a great idea for mysql_real_escape_string to return an unsigned but use -1 to indicate error.
                 * This stupid cast below is the actual recommended error check from the reference manual. Seriously stupid.
                 */
                if (mysql_real_escape_string(&connection, out, parameters[i].c_str(), parameters[i].length()) == (unsigned long)-1)
                {
                        /* At this point 'rv' always contains an empty set. Really, we should never see this error anyway but
                         * it's always better to error check everything.
                         */
                        return rv;
                }```
earnest phoenix
#

@green kestrel

#

what the fuck

green kestrel
#

yeah ikr

earnest phoenix
#

who thought t hat would be a good idea

green kestrel
#

some oracle or sun dev i guess?

#

they need some re-education by cluebat lol

earnest phoenix
#

whoever it was should be fired

#

next thing you know its an unsigned long cuz theres literally quadrillions of error co0des

green kestrel
#

i guess they thought "someone might try and escape a 1tb string... because its a 64 bit unsigned return value representing the length of the escaped string on success.... so its a loss of one value (the biggest unsigned value) at the expense of added complexity to use the whole range"

#

but really

#

who would escape a >4gb string?!

earnest phoenix
#

i wanna commit non exist now

lofty vine
#

client.on(eventName, event.bind(null, client));
^
TypeError: event.bind is not a function

warm marsh
#

No.

lofty vine
#

eventhandler throws this error

warm marsh
#

client.on(eventName, (...args) => event.bind(null, client))

lofty vine
#

(node:17283) UnhandledPromiseRejectionWarning: TypeError: event.bind is not a function
at Client.client.on.args (/app/bot.js:13:45)
at Client.emit (events.js:194:15)
at client.rest.methods.getGateway.then.res (/rbd/pnpm-volume/ce908d90-1591-4e68-8e70-6fd0493443ea/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/ClientManager.js:44:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:17283) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17283) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

warm marsh
#

You know what bind does?

lofty vine
#

xD

#

binds the callback function right? correct me if I am wrong

warm marsh
#

No.

#

It binds what's passed to the function so inside you can use this.client or whatever arg. You still have to call the function.

#

The event should be e.g. module.exports = function(){}

lofty vine
#

oo

#
fate.readdir("./events/", (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    const event = require(`./events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, event.bind(null, client));
  });
});
#

this isn't correct?

warm marsh
#

client.on(eventName, async(...args) => event.bind(null, client)(...args));

#

Is how you'd use that.

lofty vine
#

okay

warm marsh
#

If it throws bind isn't a function... make sure that it's a function that's getting imported.

lofty vine
#

yea works fine!

#

(node:17346) UnhandledPromiseRejectionWarning: TypeError: event.bind is not a function

#

ay this comes up again 😐

warm marsh
#

Yeah check all your files inside /events/