#development

1 messages · Page 165 of 1

real rose
earnest phoenix
#

boss, how, i am really very new to sever'

real rose
#

i just told you above

#

go to the discord developer dashboard

#

go to your custom bot

#

generate a link for BOT

#

with the permissions you want to give it

#

This video shows you how specifically

earnest phoenix
#

i will try

#

i am bot

real rose
#

hello bot

earnest phoenix
#

hy raymon, how are u

real rose
#

am good

tulip ledge
#
Error: CONSTRAINT `logs.log` failed for `s1_DEVELOPMENT`.`logs`
    at PromisePool.execute (C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\mysql2\promise.js:373:22)
    at KeyvMysql.<anonymous> (C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\@keyv\mysql\src\index.ts:61:29)
    at Generator.next (<anonymous>)
    at C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\@keyv\mysql\dist\index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\@keyv\mysql\dist\index.js:4:12)
    at C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\@keyv\mysql\src\index.ts:60:33
    at KeyvMysql.<anonymous> (C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\@keyv\mysql\src\index.ts:79:11)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\yarne\OneDrive\Bureaublad\Current Projects\Topaz\node_modules\@keyv\mysql\dist\index.js:5:58) {
  code: 'ER_INNODB_AUTOEXTEND_SIZE_OUT_OF_RANGE',
  errno: 4025,
  sql: `INSERT INTO logs (userid, log) VALUES ('259776081316282368', 'really long json object'`,
  sqlState: '23000',
  sqlMessage: 'CONSTRAINT `logs.log` failed for `s1_DEVELOPMENT`.`logs`'
}
#

anyone knows how to solve this?

tulip ledge
#

how

lyric mountain
#

actually, good question, it wasn't supposed to error

tulip ledge
#

yeah

#

I've tried everything already

#

I don't know why it's erroring

lyric mountain
#

did u search that error?

#

ER_INNODB_AUTOEXTEND_SIZE_OUT_OF_RANGE

tulip ledge
#

it's 1749 characters long

#

yeah

#

but I don't understand any of the links I click haha

#

but isn't JSON just a fancy version of longtext?

#

and isn't longtext able to hold 65000 characters?

#

Also the constraint is just the json_valid function

#

but when I use SELECT json_valid(the object) it returns 1

#

which means it's valid right?

#

so why does it still not meet the constraint?

#

pffff, I wouldn't have a clue how to solve this

eternal osprey
#

heyyy guys

#

currently getting fucked in haskell.

#

I think that i need some extra info about a certain assignment i have to do

#

I need to create a shifter

#

that shifts a char x amount of times to the right

#

but honestly, i am a bit stuck. How do i wrap the elements around if they exceed 'Z', being 90? I used modulo... but sometimes it still leaves me with too low ascii chars

earnest phoenix
#

music bot for Discord. Supports Spotify, Deezer, Anghami, Soundcloud, Bandcamp, mp3, mp4, Vimeo etc.!
is this okay with discord bot

craggy pine
#

You wont be supporting Spotify I'll tell you that. But the rest in discords eyes is fine.

earnest phoenix
#

i want to white list bot

marsh lark
#

What Miyuka is trying to say is that you likely won't get verified if you support Spotify as a streaming provider because it violates Spotify's Terms of Service

craggy pine
#

Not correct.

#

Spotify is literally not a possible streaming service since it doesn't have a public API. Any library that claims to do so is using the meta data from spotify and looking it up on YouTube basically making the bot a YouTube bot.

earnest phoenix
craggy pine
earnest phoenix
#

please

craggy pine
#

Nope.

earnest phoenix
#

can you help me

marsh lark
#

Without using their public api

craggy pine
#

The only public data is what? 5 seconds? Something really tiny.

#

And Spotify wont give someone access to the pivate api for discord purposes.

marsh lark
#

That's not what I'm trying to say

earnest phoenix
#

how i can verfay music bot ??

marsh lark
#

Which is undocumented and unsupported, but it's still possible

earnest phoenix
#

there’s no secret formula

slim void
#

Technically there is

#

Needs to be in a minimum of 75 servers

earnest phoenix
slim void
#

Yeah true

pale vessel
craggy pine
earnest phoenix
#

flaze can you help me

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

idle kernel
#

السلام عليكم .. احتاج مساعدة بخصوص توثيق البوت في حال احد يعرف يتكلم عربي ويعرف كيف يفعل ميزة Presence Intent ووش الإجرائات المطلوبه يتواصل معاي

cinder birch
#

Everything in my bot works , but it doesnt have a role of it's own by default but why?

quartz kindle
lament rock
#

If their invite has any permission overrides that get allowed, then it gets a role

neon leaf
#

can I make these </command:123456789> links and have them prefilled with some arguments?

pale vessel
#

discord ditched that part of the feature

neon leaf
#

e

thorn spruce
#

Hi guys anyone has already use TRPC?

marsh lark
#

what about it

trim bear
#

for people trying to get their bots verified in #mod-logs , please make sure your bot is only and active, you can do this through the use of a paid VPS or Hosting it on your local device.

deft wolf
#

No way

#

They don't read this channel anyway or they don't know it exists

trim bear
slim void
#

Weird bc my brother had his bot verified before he got banned and it was local hosted 😂

marsh lark
#

As long as it's online at all it can be verified

slim void
#

Exactly

neon leaf
#

oh man I love bun

#

I just need to rewrite some of my libs

deft wolf
marsh lark
#

hosting locally doesnt imply hosting on a pc

deft wolf
#

In 99% of cases it just means that someone runs the bot on their computer and prays that it is checked by top.gg reviewers

marsh lark
#

a lot of people host their bots on an old android phone using termux

#

if you're not getting in sharding territory i'd say it works well, but never tried it myself

deft wolf
#

These must be very small or very simple bots

marsh lark
#

Running a discord bot isnt that cpu/ram intensive

deft wolf
#

It depends on what kind of bot you want to run, you probably won't run a music bot on your phone this way

#

Although maybe by some miracle

flat copper
#

is it possible to have vs code always open my sh file (custom shell commands) whenever i open new shell

tulip ledge
quartz kindle
#

@earnest phoenix does node use skip-lists for strings?

#

its an interesting data structure

flat copper
earnest phoenix
tulip ledge
#

How do people invent data structures like that

#

I’m too dumb to even understand them 💀

rustic nova
#

because of people wanting to optimize the fuck out of everything

tulip ledge
#

Yeah but still how do you come up with ideas like ropes

rustic nova
#

hows that ropes

#

isnt that a binary tree

#

oh string based

#

nvm

quartz kindle
#

and a skip list is apparently really good at it

rustic nova
#

tim

#

do you like, know network shit or nah

quartz kindle
rustic nova
#

huge brain me is trying to connect 2 subnets within a docker container together

#

pain

quartz kindle
#

idk docker lel

#

docker weird

rustic nova
#

good

earnest phoenix
# quartz kindle and a skip list is apparently really good at it

Well yes but there are major downsides to using a skip list

  1. It requires more memory than a balanced tree, this is due to the additional memory required to store additional nodes in all layers
  2. Reverse searching is disallowed, this is because skip lists are fully undirectional
  3. The skip list searches the nodes much slower than a linked list, this is because they can't leverage the locality of reference
quartz kindle
#

yeah i guess nothing beats the flexibility of b-trees

#

things are rarely purpose-specific these days, everything is multipurpose in high-level langs

earnest phoenix
#

Just like 98% of all Discord bots mmLol

maiden gazelle
#

Does somebody know why this isnt working, I'm trying to make an invite tracker but it gives an error which says: member.guild.fetchInvites isn't a function

maiden gazelle
#

v14

#

oh wait the tutorial says v12

#

and im using v14

quartz kindle
#

yep

maiden gazelle
#

but i dont know how i can make it the v14 way

quartz kindle
#

on v14 its guild.invites.fetch()

maiden gazelle
#

okay

quartz kindle
earnest phoenix
maiden gazelle
quartz kindle
#

tbh

#

youtube tutorials should use raw api

#

it would be more guaranteed to work in the future

#

but then again

earnest phoenix
#

I'd highly recommend that you not follow YouTube tutorials like that, 99% of the time they're outdated

quartz kindle
#

using djs will give the youtuber an excuse to keep releasing new videos

#

lmao

maiden gazelle
#

console says it cannot read properties of undefined reading 'guild'
so i tried changing this to bot.on("guildMemberAdd", async (guild, member) => {

#

but that didnt work either

quartz kindle
#

the second one is correct

#

the first one is wrong

maiden gazelle
#

you mean the pic is correct

quartz kindle
#

from the pics you sent, the second one is correct

maiden gazelle
#

i only sent one pic

quartz kindle
#

ah yes, the first one is text

maiden gazelle
#

one is a codeblock the other one with the colours is a pic

earnest phoenix
#

The tutorial you're following is very outdated, you'll run into many issues like that

quartz kindle
#

so the pic is correct

maiden gazelle
quartz kindle
#

show the error

earnest phoenix
#

Either find a more up-to-date tutorial, or write the thing yourself by following the implementation details of the tutorial

maiden gazelle
quartz kindle
#

whats on line 1159?

#

show the surrounding lines too

maiden gazelle
earnest phoenix
#

Change async member => to async (...args) => and run console.log(...args); in the event listener callback

#

See what gets logged

quartz kindle
#

are you using some kind of framework or modified client?

maiden gazelle
earnest phoenix
maiden gazelle
#

GuildMember {
guild: <ref *1> Guild {
id: '1016802330814988328',
name: 'Mic',
icon: null,
features: [ 'AUTO_MODERATION' ],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
bans: GuildBanManager { guild: [Circular *1] },
roles: RoleManager { guild: [Circular *1] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *1] },
stageInstances: StageInstanceManager { guild: [Circular *1] },
invites: GuildInviteManager { guild: [Circular *1] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *1] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *1] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 0,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 0,
discoverySplash: null,
memberCount: 11,
large: false,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: null,
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 0,
mfaLevel: 0,
joinedTimestamp: 1680900006376,
defaultMessageNotifications: 0,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 500000,
maximumPresences: null,
maxVideoChannelUsers: 25,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: null,
publicUpdatesChannelId: null,

#

preferredLocale: 'en-US',
ownerId: '817282394763558943',
emojis: GuildEmojiManager { guild: [Circular *1] },
stickers: GuildStickerManager { guild: [Circular *1] }
},
joinedTimestamp: 1694953779112,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
_roles: [ '1152944456228687904' ],
user: User {
id: '557628352828014614',
bot: true,
system: false,
flags: UserFlagsBitField { bitfield: 65536 },
username: 'Ticket Tool',
discriminator: '4843',
avatar: 'ba5ef012585bb2f9c72a655b28d7aa5f',
banner: undefined,
accentColor: undefined
},
avatar: null,
flags: GuildMemberFlagsBitField { bitfield: 1 }
}

#

@earnest phoenix

earnest phoenix
#

Can you show an screenshot of the console?

maiden gazelle
#

thats way to big

#

and its also showing the error it gave earlier

earnest phoenix
#

I'm trying to see what arguments are being passed to the event listener callback in your code, because clearly the member argument is undefined according to the error for you

#

So it would be better for you to take screenshots of the first part of where those things got logged to the console

maiden gazelle
small meteor
#

Hello,

I currently am in a team of discord bot developers and I'm trying to make some tests with the top-gg API and webhook features. The problem is that the bot we are building is online and already uses top-gg webhooks. So I'm searching how I could register a development bot application quickly and easily on top-gg that would not be visible by regular, or at least not searchable on the website. Is it possible to do that ?

earnest phoenix
# maiden gazelle

That is weird, what gets logged when you change it back to async member => and run console.log(member);?

small meteor
earnest phoenix
compact pier
#
  albumLengths: AlbumnLength[] = {
    "a1": 12
  }

What is the typescript type for this?

wheat mesa
#

You’ve annotated it as AlbumnLength[] but it is not an array and I have a feeling that type doesn’t exist given that it’s misspelled

quartz kindle
compact pier
#

Im stupid

#

sorry guys

#
interface Record {
  [key: string]: number;
}
pale vessel
neon leaf
#

bun is nice but for some reason hallucinating

rustic nova
#

question regarding DNS (and possibly wireguard)

Is there a way for me to prioritize a certain DNS Server? Let's say I run a wireguard VPN on my computer, and on the vpn network, a DNS server for intranet-like domains. Though that dns on that VPN server seems so slow ngl

next storm
#

I want to access the localStorage in my layout.tsx, how can I do that? I'm using nextjs 13 and reactjs..

marsh lark
#

You'd have to use it in a useEffect

eternal osprey
#

tf happened with nodejs

#

why can't install it anymore

pale vessel
#

there's supposed to be a version number after that _

eternal osprey
#

even when selecting a number it gives me the same error

#

THIS IS THE ISSUE

#

oops srry for caps

pale vessel
#

something messed up your source list

#

check /etc/apt/sources.list.d/nodesource.list

eternal osprey
#

i am following their official thingy

pale vessel
eternal osprey
#

permissions denied

pale vessel
#

sudo

eternal osprey
#

sudo isn't found either?

#

command not found

#

when i use sudo /etc/apt/sources.list.d/nodesource.list

pale vessel
#

you wanna see the contents/use an editor

#

use nano for instance sudo nano /etc/apt/sources.list.d/nodesource.list

#

make sure it says node_18.x or your version and save

eternal osprey
#

ahhh

#

that worked, tyyy!

spark pebble
#

Hey guys - applying for for verification, our admin commands are prefix commands, but we're not being accepted for message intents, so we need to convert our admin commands to app commands.

Can you hide app commands from everybody but (staff or whatever)?

#

obviously we don't want people even seeing admin commands when they do /

pale vessel
#

yes, you can restrict commands by user permission

craggy pine
#

I don't think there's a really good way of hiding the commands itself from the public eye but they wont run.

earnest phoenix
pale vessel
#

if you set dm_permission to false (to prevent the command from being run in DMs) and default_member_permissions to any valid permission for your mods, normal members wouldn't be able to see them

craggy pine
spark pebble
#

Yeah, we want to hide the command entirely.

#

Nothing worse then a user doing / and being face punched with 15 admin commands

craggy pine
#

I technically do have that setup on my bot, but since its a single server bot, I dont really need to hide it, but what Flaze is saying is change this depending on how you have your command structure setup.

#
    name: "giveaway",
    category: "Admin",
    description: "Start a new giveaway",
    usage: [`/giveaway`],
    example: [`/giveaway`],
    type: 1,
    options: [
        {
            name: 'channel',
            description: 'The channel you want the giveaway posted in.',
            type: 7,
            required: true
        },
    ],
    permissions: {
        DEFAULT_MEMBER_PERMISSIONS: "SendMessages" //here
    },
deft wolf
#

You can also deploy them only on one server

spark pebble
#

Well you can just hide application commands on the intergrations panel if it'a single server bot

deft wolf
#

To be 100% sure that they will only be on one server

spark pebble
#

Any chance u can send some docs?

deft wolf
#

I can send you discordjs.guide about this

spark pebble
#

not so helpful as we use .py 😄

pale vessel
#

you can find appropriate methods in your lib

deft wolf
#

Oh, so it's gonna be harder i think

craggy pine
#

Ah then my code above is not what u needed anyways since its also js 🤣

deft wolf
#

So you are using discord.py or some other framework

spark pebble
#

yeah discord.py, but dw we'll sort it. for the time being we will just turn off the intents, and manage without admin commands.

#

It's mainly stuff like mass editing database etc

deft wolf
#

I don't know how up to date this is

spark pebble
#

we've been sat @ 100 servers for 4 weeks because discord are morons, so we'll turn off intents for now and worry about admin commands later

earnest phoenix
maiden gazelle
#

@earnest phoenix

earnest phoenix
#

It's member.guild.invites.fetch()

maiden gazelle
#

okay ill try

#

@earnest phoenix

earnest phoenix
#

The error is quite clear about what's wrong

#

You should learn that and also check the discord.js documentation about what properties there are, how to use certain methods and whatnot

#
eternal osprey
#

apparently their normal setup packages are deprecated and they moved all their installers to the nodesource for ubuntu and linux based distri's

earnest phoenix
#

nvm is standalone, it uses Node.js' own download registry

#

Uninstall your current Node.js installations, follow nvm's installation guide, and run nvm install --lts to install the latest LTS release (or nvm install to install the latest non-LTS release, you can also install a specific version with nvm install <version>)

maiden gazelle
earnest phoenix
#

Either check if your conditions are correct, and fix them if they're not, or handle the case if only undefined is returned

tulip ledge
#

In code how do I get out of this >>> cuz if I use \n it just keeps the indentation

civic scroll
#

node?

#

either Ctrl + C, Ctrl + D, exit, exit(), quit, q will work (idk what REPL you are using)

tulip ledge
#

no

#

I meant discord

#

haha

#

if you do

it creates this block
and for every new line it makes the block longer

#

but I wanna escape it

#

in my embed

radiant kraken
#

\>

tulip ledge
#

\n\>\n\n*Press the button below to reroll the reforge.*

marsh lark
#

Once you do >>> you can't escape it. You should use > on each line you want the quote to be on

tulip ledge
#

mmmh, unlucky

radiant kraken
#

write it as \\> in code

marsh lark
#

I think they're trying to end the blockquote, but that's not possible. I assume they dont want the "Press the button..." message to be in the quote

radiant kraken
#

ahhh ic

#

never knew blockquotes worked that way

surreal sage
#

I love making my own dependencies to prevent hard coding

craggy pine
#

@clear plinth the hidden message thats likely a spammer ^

cyan gate
#

sup, I'm having an issue where one of my new applications(bot) isn't getting slash support

#

I have invited it with both of the scopes, bot, application.commands

#

and have a slash command in the project

#

I also made a global slash command

#

but still didnt get it.

#

enabled in-app authorization too, to see if that makes any changes

#

but nope

#

tried djsv13 and 14 both

proven solar
#

Hello, I am looking to make a library of clips and text explanations for a game, any suggestions on how to structure it? I am thinking of having a "backend" discord server that i can pull info out of to main server and people can react to an embed which contains menu of things they can look up. thoughts?

#

also are any of you using gpt4? i made a bunch of stuff with it

clear plinth
deft wolf
#

He probably already got banned by someone else

wheat saddle
#

@rustic nova I need help

earnest phoenix
#

Plus show code

earnest phoenix
#

Better to rephrase your question

rustic nova
wheat saddle
#

By vote?

cyan gate
cyan gate
earnest phoenix
# cyan gate

You're not registering the slash-commands in any way

#

In the Events.Ready event, call <Client>.application.commands.set() by passing your slash-commands' data from your custom <Client>.commands collection

#

(This can also be done outside the ready event)

cyan gate
#

still no slash support

#

reinvited the bot too

earnest phoenix
#

That's not how it works

#

Reread what I said

cyan gate
earnest phoenix
#

You're supposed to register the commands once when your bot starts up, but in that screenshot (the one before the latest) it would register them every time an interaction is received

Plus you have to pass your slash-commands' data to the <Client>.application.commands.set() method

cyan gate
#

hm

cyan gate
earnest phoenix
#

That's also a correct way of doing it, though unnecessarily more complicated and abstracted than just using <Client>.application.commands.set()

deft wolf
#

Also keep in mind that it's only for one guild

cyan gate
#

^

#

I have the guild Id defined in a json file

earnest phoenix
#

<Client>.guilds.cache.get(<ID>).commands.set(<commands>)

cyan gate
#

now?

earnest phoenix
#

If you only want the slash command(s) to be registered in one specific guild then use #development message

earnest phoenix
#

Yes

cyan gate
earnest phoenix
#

Correct

cyan gate
#

I see

cyan gate
earnest phoenix
#

55

earnest phoenix
cyan gate
#

data = []

earnest phoenix
#

Then you're passing an empty array

cyan gate
#

it shows that its loaded too

earnest phoenix
#

It's "loading" to a collection, not registering them

cyan gate
earnest phoenix
#

Show the whole code, not small parts of it

cyan gate
#

too big for 1 pic tho

deft wolf
#

You can send it as plain text or file on discord

cyan gate
earnest phoenix
cyan gate
earnest phoenix
#

You're supposed to pass the slash command data to the method from your <Client>.commands collection

cyan gate
earnest phoenix
#

You can simply map your slash command collection to an array of slash command data using the <Collection>.map() method

#

After loading all your slash commands to the collection

cyan gate
#

eeh?

earnest phoenix
#

Sigh, <Client>.commands is a collection that you assigned, you're loading your slash commands to it, after that map the slash commands to their data using <Collection>.map() and pass it to the <Client>.application.commamds.set() method

#

<Client>.commands.map((command) => command.data)

#

Pass that to the <Client>.application.commands.set() method

cyan gate
#

onionpray for me 💀

#

lemme check if it worked

#

@earnest phoenix

#

man it wasnt such an issue in djsv13

earnest phoenix
#

It was the exact same thing in v13

cyan gate
proven solar
# earnest phoenix I'm not sure if I understand your question, what do you mean by a library of cli...

One message will be considered a book - as it will contain text explaining clip and clip will be a link as it will be hosted on youtube. Many of these messages will be within a channel within a category.

Yes for second part I'm thinking of using another discord server as a database - because why not, that's why i'm asking if there would be something more appropriate with free hosting and ease of access. I will be indexing messages with a number so I can easily rewrite or swap things around if I need to(obviously a bot will handle larger cases).

UI would be an embed + reaction and maybe even command I'll see how big things get.

deft wolf
#

This is probably even worse than using json files as a database

proven solar
#

well yes i'm kinda new out of necessity so help a bruda out :D hence why i'm asking kinda difficult to find these answers

#

and also why would it be bad

earnest phoenix
#

Managing a Discord server that acts as a database for your stuff is 10x harder and very inefficient because of the Discord API limitations, rate limits, downtimes, and whatnot

#

Use a real database like PostgreSQL, MariaDB, MongoDB, etc etc

proven solar
#

ah ok ty

maiden gazelle
#

anybody knows how i can calculate how many users are in the server thats interacted and add 1000ms to every member, its for a massrole command

deft wolf
#

Generally, this can be done in two ways, one is to use the cache but then not everyone will probably get this role or to use .fetch() which takes information about members straight from the API

#

The second method may cause a rate limit

#

So it depends on how many servers this bot should work on

#

If on one server, the second method is more reliable, but in the case of a public bot, it is better to use the cache

surreal sage
#

i hate react

wheat mesa
#

Use flutter c:

lyric mountain
#

first because the user that's trying to use the command will hardly wait for it to finish

#

we're talking about 1min per 60 users, in a server with measly 6000 users that's 1 hour and 40 minutes

#

second because unless you lock the command while it's still running, that user is very likely to use it multiple times, thus compounding the issue

#

a good alternative is giving the role(s) the moment a user writes something, this way you ignore inactive ghosts and prevents spamming the api

surreal sage
#

I am clueless

#

I'm using import { useTranslation } from "next-i18next";

earnest phoenix
#

@rustic nova

spark flint
#

wdym ipa

sage bobcat
#

One message removed from a suspended account.

spark flint
#

im guessing you mean API

sage bobcat
#

One message removed from a suspended account.

spark flint
#

which the answer to is yes, top.gg API is free to use

sage bobcat
spark flint
#

my fav

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

yes

spark flint
#

get drunk on capybeer

earnest phoenix
#

is for free or not

spark flint
#

yes

#

i already said

earnest phoenix
summer torrent
#

why would it be paid

deft wolf
#

This look so cursed, i don't know why

earnest phoenix
# spark flint yes

i want if some one vote for bot the bot send to hem msg in dm and gev hem i use 2000-2500 coins mongo database ??

sage bobcat
#

One message removed from a suspended account.

sage bobcat
earnest phoenix
#

please

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

discord.js v13

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
const User = require('../../models/user');

module.exports = {
    name: 'vote',
    description: '',
    category: 'utilities',
    async execute(message, args, settings, client, Discord) {
        const row = new MessageActionRow()
        .addComponents(
          new MessageButton()
            .setLabel('Vote Now!')
            .setStyle('LINK')
            .setURL('https://top.gg/bot/1131780123956363375/vote')
        );
  
      const embed = new MessageEmbed()
        .setColor('RANDOM')
        .setTitle('Vote for Dynasty')
        .setURL('https://discord.gg/gXbPRYzbaf')
        .setThumbnail(message.author.displayAvatarURL())
        .setDescription(
            `Dear <@${message.author.id}> \n\n`+
            '*__By voting for my bot, you will receive the following benefits:__*\n\n' +
            '> - Earn 2000-2500 coins \n' +
            '> - Unlock a special role \n' +
            '> - Some Premium Commands \n\n' +
            '*__Click the button below to vote for my bot on top.gg!__*'
          )
        .setFooter('Thank you for your support!');
  
      message.channel.send({ embeds: [embed], components: [row] });
    }

    
}

this is comand if he vote in top.gg send to hes dm thanks msg

earnest phoenix
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

ok ty

#

bro

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

it's pretty easy tbh

#

the docs has an example that u pretty much copy n paste

earnest phoenix
sage bobcat
earnest phoenix
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

rustic nova
spark flint
#

🤓

sage bobcat
#

One message removed from a suspended account.

crude orchid
sage bobcat
earnest phoenix
#

TOPGG_API_KEY ??

crude orchid
#

As developer

sage bobcat
crude orchid
#

Haha

#

Okay

#

123

sage bobcat
#

One message removed from a suspended account.

crude orchid
#

Hmm.

#

Is there anything I can do for you?

slim void
#

🤔

spark flint
#

Christ

crude orchid
#

Would you like to see some of my past projects?

spark flint
#

No

slim void
#

Nah

rustic nova
#

@crude orchid once again

#

this server is not a recruiting server

#

offer your service on platforms such as freelancer or fiverr

earnest phoenix
#

can you help me

surreal sage
#

Being plagued by

Error: Text content does not match server-rendered HTML.

Warning: Text content did not match. Server: "socket.connecting..." Client: "Connecting..."

react/next, i18n

socket.connecting = key
Connecting... = value

rustic nova
#

#topgg-api is your place to ask, providing:

  • what have you done already
  • whats your approach
  • do you have any ideas you could implement

and wait for someone who can help

surreal sage
#

Adding the language strings server side, accessing them client side all through a module

lyric mountain
#

But well, implementing i18n is fundamentally simple, but becomes much more difficult the older a project is

#

All you need is a file containing only the strings, in whatever format you like (I prefer properties format)

maiden gazelle
#

i keep getting this error

lyric mountain
#

Then name it in a standardized way (for example locale_en, where en is the locale code)

#

Inside that file, and all other locale files, have the exact same keys (value doesn't matter) so you can seamlessly retrieve from the files by simply changing the filename

#

The rest would be replacing all hardcoded strings with the i18n acessor (eg. let str = "here is a string" to let str = locale.get("some_str")

bitter root
lyric mountain
#

Where did u define it?

maiden gazelle
lyric mountain
#

Channels aren't guaranteed to be cached at any moment

#

You need to fetch it

#

Also you don't need to await a cache operation

maiden gazelle
lyric mountain
#

See the docs, I don't remember it from the top of the head

wheat mesa
#

Also there’s no need to do a find from cache when you have the key of the channel

#

People gotta stop using this shit 😭

sharp geyser
#

You can do <Guild>.channels.fetch or <Client>.channels.fetch (I think this is still a thing)

marsh lark
#

Or if you're sharding and trying to get a channel from another shard

sharp geyser
#

That’s dumb for any channel to be guaranteed to cache

#

That’d take a bit of time to do if your bots in numerous guilds

#

In my opinion caching should only be done if you fetch the channel/member/guild

#

All you realistically need is an id

radiant burrow
#

is there like a not crappy way to get a list of mutual servers between the bot and user? Considering discord has a built in mutual servers thing for users I'm a little surprised there's not an option for bots

#

i could keep track of it via database and add/leave guildMember events but that seems like a hassle

sharp geyser
#

you'd need to use oauth2 first of all

radiant burrow
#

right but I didn't want a popup ;-;

sharp geyser
#

second of all, you would then need to access the guilds through oauth2 and you can map out guilds that have the bot's id in them

#

Its impossible to do this without oauth2

#

Well I guess not impossible

#

You could try doing the opposite and using the user's id to map all users in the guilds the bot is in

radiant burrow
#

except going through all the servers and checking for the user

#

hmm? I don't understand

#

you mean take all the servers the bot is in and filter for ones that have the user's id?

sharp geyser
#

Yea

#

wait are you using js?

radiant burrow
#

yeah that's what I meant from my message previously but it seems not good to be doing especially with lots of servers/ users

#

yea

sharp geyser
#

I mean

#

It would realistically be the same thing if you were using oauth2

radiant burrow
#

that's true, I think that's what I did for my dashboard

sharp geyser
#

Its just with oauth2 you already get all the guilds the bot and user share iirc

radiant burrow
#

but doesn't oauth2 require the popup?

sharp geyser
#

tho I might be wrong on that so :p

radiant burrow
#

like every time it happens

#

no that sounds about right

sharp geyser
#

So yea a pop up would be required

radiant burrow
#

right so this will happen when the user levels up, I just want to send a rank up message to the servers the user is in (with a notification channel enabled)

#

right now it just happens in the server they did the thing to level up in but it's a global xp system so I wanted it to display in every server they're in

sharp geyser
#
<Client>.guilds.map(guild => guild.members.filter(m => m.id === user.id))

or smth

#

been a while since I used js

marsh lark
#

guilds.cache.map

sharp geyser
#

right

radiant burrow
#

yeah that looks about right

sharp geyser
#

forgot about the whole caching thing

radiant burrow
#

but you don't have to fetch users?

marsh lark
radiant burrow
#

mutual servers

marsh lark
#

how many guilds will your bot be in if you estimate

sharp geyser
radiant burrow
#

its in 600 rn but my goal is lots

marsh lark
#

ok so it definitely wont be suitable

#

just use oauth

#

and check for servers the user is in

radiant burrow
#

well I can't do the popup every time. So I may resort to using a database after all

marsh lark
#

refresh tokens exist

sharp geyser
#

With the oauth2 approach I would check the servers the bot is in, as oauth2 gives you all servers the user is in, so you really only need the bot id to get mutal servers.

sharp geyser
radiant burrow
#

oh?

sharp geyser
#

The way oauth2 works is it gives you an access_token and a refresh_token, an access_token allows you to fetch stuff on behalf of the user (so long as they don't deny your application), a refresh token essentially allows you to infinitely get a new access_toekn (again so long as they don't deny your application later)

#

So really it will only ask them to re-confirm if they A deny your application or B you fuck up and the access token was never refreshed/revoked

radiant burrow
#

I see I see alanaNote

#

I'll go find a tutorial on that, thanks!

sharp geyser
#

Now note you'd wanna go for authorization code flow over the other 2 for this to work the best

#

no better tutorial than the discord docs ngl

#

its a bit of a reader but all the tutorials out there typically have you use passport (ew)

radiant burrow
#

i gotcha

sharp geyser
#

These 2 are what you'll likely need

#

but do take a look at the other 2 methods of oauth2 and see if its better for ya

sharp geyser
slim void
#

I have zero motivation to fix my bot lol

earnest phoenix
#

what do i do with this information

sharp geyser
#

not be a dick :p

wheat mesa
earnest phoenix
#

i’m just wondering

wheat mesa
#

Just check if the result of guild.members.get is null or not

#

You have the key

sharp geyser
#

fair enough

wheat mesa
#

It’s wasteful to use a filter

#

Very wasteful, you’ll loop through all members

#

Of every server

sharp geyser
#

Right cause maping the guilds is already 1 loop, filtering would be 2 loops

wheat mesa
#

This way it’s a little faster at scale. Still not ideal but eh

sharp geyser
#

😔

slim void
sharp geyser
#

Honestlly forgor .get was a thing

#

yea don't expect battleless to give you anything but a headache

wheat mesa
#

There’s also .has which is the same idea, just does the check for you

sharp geyser
#

Yo waffle

#

Question

wheat mesa
#

My favorite data structure is a hashmap 😎

wheat mesa
sharp geyser
#

Do you think its possible to make a central panel to manage all bots in a guild? (It would require somehow allowing bot devs to integrate into it, but then again why would they do that when their own would bring more traffic which is money in their pocket)

wheat mesa
#

Uhhh

#

That would be very difficult

sharp geyser
#

Indeed

wheat mesa
#

What do you mean by manage though?

sharp geyser
#

And likely not useful at all

wheat mesa
#

Like specific features and such of each bot?

sharp geyser
#

Being able to do what each indivual bot's panel would od but in one place

#

so they dont gotta visit multiple bot's websites

wheat mesa
#

I don’t mean to put down your idea but… That sounds like a pain in the ass for bot devs to implement, and also I don’t see the incentive for them to do that

#

It would be great for users but I just don’t see devs hopping on that idea

sharp geyser
#

Exactly, what I was thinking, but it would be something that bot devs would likely never agree with

#

As it takes traffic away from their site

wheat mesa
#

Centralized dashboard might give more discoverability to some bots, but that means less traffic to their site and therefore less ad revenue

sharp geyser
#

Yea

earnest phoenix
sharp geyser
#

Guess I will scrap that idea

#

Its not very plausible

wheat mesa
#

Build an API for something

#

And use go + gin

#

It’s awesome

sharp geyser
#

Hm?

wheat mesa
#

If you’re looking for a good project

#

Or something new to learn

sharp geyser
#

I haven't used go in ages

wheat mesa
#

Actually, better yet

sharp geyser
#

Last time i used go I made a discord bot that translates different languages and other things like morse code

wheat mesa
#

Do this

#

But use Go

#

Honestly the perfect starter project if you’re trying to learn

sharp geyser
#

Hm

#

That would require messing with a png file without corrupting it

wheat mesa
#

It’s super fun

#

I learned so much about Go in a matter of a couple days with this

#

Just in spare time in between classes

sharp geyser
#

Are they teaching you go at uni EYES

wheat mesa
#

Nope

sharp geyser
#

Ic

wheat mesa
#

C++ is the only language I’m being taught

sharp geyser
#

I was going to be shocked if they were

#

Learn anything new in those classes?

wheat mesa
#

I’m learning Go because I joined a student organization that maintains a ton of open source software for data and such about the university in Go

wheat mesa
#

We just learned about pointers today

sharp geyser
#

So basically all stuff you already know about C++

#

:p

wheat mesa
#

Though to be fair it feels like I’m filling in the holes in knowledge I have from being self taught for the majority of my programming career

sharp geyser
#

That's good

wheat mesa
#

Like how program memory looks in windows and linux, the stack grows down and heap grows up in one of them (can’t remember which)

#

It’s nice to solidify

#

I imagine I won’t be learning a TON until 2nd semester when I get my intro classes out of the way

sharp geyser
#

Fair enough, but at least you are learning some :p

#

I would be in college rn but money me no have

wheat mesa
#

Is there no colleges near u that would offer significant financial aid?

sharp geyser
#

Its Washington

#

those kinds of schools don't really exist

wheat mesa
#

My uni promises full tuition to anyone making 65k or under

#

(Hence why I don’t have to pay)

sharp geyser
#

I haven't done too much research to be fair

wheat mesa
#

Still had to buy books and such tho

#

That sucked

#

Few hundred bucks down the hole

sharp geyser
#

but the ones i've been offered tutelage at have enormous tuition prices

#

Im not smart enough to get scholarships so a lot if will be dependent on how much financial aid i'm given

wheat mesa
#

Even public ones?

sharp geyser
#

Yea, washington has some pretty high prices unis

#

All the ones that have sent me offers are like 65k a year

wheat mesa
#

Jesus

#

And I thought 15k a year was steep

quartz kindle
#

you guys pay for uni? :^)

sharp geyser
#

Yes its america

#

capitalism at its finest

wheat mesa
#

WSU has 12k a year in state tuition according to google

#

That’s not bad

quartz kindle
#

being a dropout works everywhere :^)

wheat mesa
#

I imagine that you’d get financial aid if you don’t have a lot of income as well

#

Pell grant and such

#

I got like 8k from the federal Pell grant because I’m broke

sharp geyser
#

I haven't even checked on my financial aid since I applied for it

wheat mesa
#

Bruh 😭

sharp geyser
#

I didn't think I would go to college shrugpepe

#

I know i got approved for smth but never checked how much

wheat mesa
#

Usually it’s not given directly to you

#

Usually the amount is determined by the school based on the recommendations of the FAFSA

sharp geyser
#

yea

wheat mesa
#

So it varies from school to school

sharp geyser
#

One school approved me for 6k

wheat mesa
#

Private or public

sharp geyser
#

Its in Arizona tho

#

whatever GCU is

#

Private

wheat mesa
#

Ouchies

#

I got roughly 16k in aid total from UTD

#

Got lucky that Texas has really good public universities

sharp geyser
#

Yea

#

Honestly I don't even think ima go to college

#

I don't have the motivation

craggy pine
#

I've been looking into good (affordable) online colleges for Computer Science, I have a few jotted down. I almost went with a private university until I got their pricing. It was pretty yikers.

Univerity of Arizona
Univerity of North Texas
Southern New Hampshire University
wheat mesa
#

UNT is dog booty for CS

#

I’m going to UT Dallas

craggy pine
#

Good to know.

#

Does UTD offer online?

wheat mesa
#

I’m not entirely sure

#

I would imagine so

craggy pine
#

Guess I'll consult good ol google.

wheat mesa
#

Going in person for UTD is the way to do it if you can afford it

#

I’m assuming you’re out of state though so that would be pricey which defeats the purpose

craggy pine
#

Yeah, where I am in Oklahoma the cloestest afforable school is like an hour away and I'm not bout to be driving that much.

#

The closest school is the private one, costing 15+ per semester.

wheat mesa
#

Texas has great public universities, out of state tuition for any college is gonna be rough though

craggy pine
#

I'd for sure rather do it in person. But with me living with the girly, I'd rather us not be moving around just for school. So I figured, fuck it, online can be just as well potenatially...

wheat mesa
#

Do you/your family make under 65k a year? If so, you might qualify for UTD to pay for your tuition

#

I’m not entirely sure how it works for out of state students though

craggy pine
#

Oklahoma has a thing with people who qualify as residents. It's like 1 year +, I bet that would be similar with Texas

wheat mesa
#

I will warn you though, UTD dorms are pricey. 4.5k per semester for the standard dorm (I don’t think there’s a different option)

craggy pine
#

Nah I'm not really considering in person as an option anyways.

#

If i were single, for sure.

#

How has their CS program been for you? Do you think its a good program they offer? I know the private school when I toured them was offering mainly Java w/ some game design.

wheat mesa
#

I’m not sure how good UNT is for CS in terms of their online program. My dad did (mostly) online for his entire masters degree, but that was for a way different major

wheat mesa
#

I’m doing an accelerated degree plan so I can graduate in 4 years with a masters

#

The campus is really nice, it’s clean, the community seems to actually care about one another

craggy pine
#

I couldn't imagine balancing a work life with something like that, even if a part time job.

wheat mesa
#

Only complaint is the parking since it’s a commuter school

#

Yeah I’m quite busy

#

Part time job, school, open source org, startup with my friends, personal life with gf, etc

#

But I can handle it for this semester because most of my classes are the mandatory intro classes

#

My assignment for this week for one of my classes was literally to attend a CS focused event

craggy pine
#

Simple enough.

#

Thing I'm dreading as a new comer to college life is the classes that mean nothing to the CS life.

wheat mesa
#

Yeah

craggy pine
#

Maths and stuff, sure i get it.

#

But fuck the rest.

wheat mesa
#

It sucks but it is what it is

#

If you need a decent bit of general credits, go to community college first

#

Super cheap, lots of them have online options, and you don’t end up wasting money on valuable tuition in a higher end university

craggy pine
#

I've heard that doing community first then transfer is recommended. But for simplistic sake I just thought about going balls deep into everything at one place.

#

But ya, I'll have to visit our local community college about that.

wheat mesa
#

If you can afford it then for sure it’s fine

#

But if money is a concern I’d definitely go with community college first

sharp geyser
#

Yea but not every college accepts transfer credits from just any college no?

craggy pine
#

That is also something I've heard.

wheat mesa
#

(Not gonna lie, my local community college has been doing more than UTD so far, my gf is going there rn)

#

Most of them accept it as long as it’s from an accredited community college

sharp geyser
#

what does your gf study?

#

Is she in the same field as you?

wheat mesa
#

I believe public schools in Texas are legally required to accept almost all transfer credits for the corresponding classes from Texas community colleges

wheat mesa
sharp geyser
#

Ah

#

Thats where the money is at

#

I don't really know what I want to do tbh so good on both of ya for pursuing a thing you want

wheat mesa
#

I think it’s wrong to feed the idea to people that you need to go to college to be successful

#

If it’s what helps you achieve your goals then you should do it

#

If it’s a waste of time to reaching your goals then don’t go to college just to please society

#

One of my goals in life is to get a graduate degree, so that’s what I’m doing

craggy pine
#

Yeah, I've always been interested in coding for quite some time and self taught myself things, I'm the typa person who struggles to grasp onto more difficault things alone. I do want to branch out and college atleast I think will help me get there. Plus the fancy peice of paper is handy.

sharp geyser
#

I mean I know I will need college eventually

#

I just don't know what I want to pursue since I have so many intrests thanks to my school's abundance of career oriented classes

wheat mesa
#

That’s the beauty of community college

#

It gives you time to figure out what you want to do

#

And it gives you relatively inexpensive classes to try out

craggy pine
#

Since most programs require the same general classes.

sharp geyser
#

Fair

#

I have an intrest in engineering, cs, photography and music

wheat mesa
#

Plus I find that a lot of community college professors are people that used to work in their industry field and have a passion for it

sharp geyser
#

I guess I will start with looking at community colleges

wheat mesa
#

My uncle is a community college professor for calc, he used to write code for Raytheon in the 90s-early 2000s

#

Big passion for it

sharp geyser
#

never heard of RTX

#

A lot of stuff about the stock market with them

#

lol

wheat mesa
#

Defense company

#

Kinda like Lockheed Martin

#

Sorta like boeing

sharp geyser
#

icic

#

Wew

#

There's actually quite a bit of cc's in washington

#

cheap to

#

6k for in state

#

Thats just one of them

#

Okay wow there are surprisngly a lot of community colleges where I live

wheat mesa
sharp geyser
#

I mean its washington

#

its expected

wheat mesa
#

Usually they just charge per credit hour, do they have tuition as well?

#

My local one charges like 60 or 70 bucks per credit hour

#

Which with 15 hours a semester + books comes out to roughly 2.3-2.7k per year

#

Which is easily affordable with a part time job (as long as you’re not paying your own living expenses and such)

outer obsidian
sharp geyser
radiant kraken
craggy pine
sharp geyser
radiant kraken
#

@dense flame can confirm

dense flame
#

nope

#

haven’t heard it

sharp geyser
#

Cause cosmic is hardly around sad

sharp geyser
radiant kraken
#

i feel bad for you

dense flame
#

jk

#

i have a recording

radiant kraken
sharp geyser
radiant kraken
#

why didn't you dm me your recording misty

sharp geyser
#

I never dm a recording tho!

radiant kraken
#

smh

#

i should've recorded your singing

sharp geyser
#

My voice in recording sounds horrid no thanks

radiant kraken
#

X DOUBT

sharp geyser
#

This is development btw

#

Not general

radiant kraken
#

then move to general

surreal sage
#

i can count

#

but can npm

neon leaf
#

yes

#

dependencies also have dependencies which also have dependencies, ...

lyric mountain
#

everything in njs is a dependency

#

one day they'll even make a dependency for booleans

#
neon leaf
#
craggy pine
#

2 other projects in the npm registry using true.

craggy pine
#

Insane coding skills.

#

I wish I were on that level.

neon leaf
#

ive been looking for a package that does this

lyric mountain
rustic nova
lyric mountain
rustic nova
#

But why does this exist

lyric mountain
#

because js™️

eternal osprey
#

Hey guys, I invited my bot over to my community server and it asked me for access to my account, is that normal?

slim void
#

Depends on the bot

eternal osprey
#

It has admin perms that’s it

#

Might that be it?

slim void
#

No

craggy pine
#

Actually yes. I think it has something to do with the acc having 2auth.

eternal osprey
#

Ahh

slim void
#

All of my bots have administrative and never had access to my account

#

If the bot has a dash or something then it would

earnest phoenix
#

lyric mountain
#

"Access to your account" or "Access to your account information"?

surreal sage
#

why is the chromium src ~40gb

#

can someone reduce unoptimized code rq (delete everything)

lyric mountain
lyric mountain
#

also sources are big, they are supposed to be

surreal sage
#

what i believe in, is that they removed one comment and called it optimized 🗣️ 💯

earnest phoenix
#

i don’t see the need for this npm module

quartz kindle
#

its literally a joke module

earnest phoenix
rustic nova
#

mfw I'm thinking about buying 5-10 rpis with LED hats and just doing dumb shit

surreal sage
neon leaf
#

I opened an issue

surreal sage
neon leaf
#

thanks

surreal sage
#

❤️

pale vessel
#

this is not good for the npm population

surreal sage
#

It's great.

surreal sage
neon leaf
#

no ty

surreal sage
#

can you check

neon leaf
#

its kinda empty

#

the whole declarations are yknow

#

missing

surreal sage
#

i dont do declarations

#

only the poorly educated need it

earnest phoenix
#

How to ping a slash command ?

rustic nova
#

The docs should mention it on the markdown section

earnest phoenix
#

Can tell me how ?

surreal sage
#

<> ☹️

neon leaf
#

What's the ratelimit on message edits?

lyric mountain
#

actually, no, that url is pretty useless

#

I mean, well, it does say ratelimit is variable and u should never hardcode it

#

I'd say it's probably close to message send ratelimits

quartz kindle
#

message edits share rate limits with sending messages

#

which is usualy about 5 per 5 seconds per channel

#

so 2 edits + 3 sends in under 5 seconds in the same channel = limit

earnest phoenix
#

Does the wool welcome bot encounter a problem if more than 100 servers join at the same time?

wheat mesa
#

is this the right way to structure a basic database for this? I'm not sure how to properly handle relating tables to one another

#

Basically each item has a modifier group, which then has individual modifiers for each item within the group

quartz kindle
wheat mesa
#

It can have multiple modifier groups yes

quartz kindle
#

then make item have an array of modifiers

#

and have each modifier have the group id

wheat mesa
#

Well

#

Why?

#

Each modifier rests within a modifier group, then an item can have a modifier from the groups it has

#

Like for example, a burger could have 2 modifier groups. Condiments, and bun type (for the sake of simplicity). You can choose any option(s) from the condiment group to put on the item. You can choose any option from the bun type group to put on the item (I'll handle which ones to make like "select one only" and such)

quartz kindle
#

so its more like an options thing

#

i was thinking more of like an rpg item with enhancements

#

where the item could have like a +10att modifier, from a stats modifier group, and a fire element modifier, from an effects modifier group

#

so it depends on what you wanna do

wheat mesa
#

yeah I'm just trying to model options for an item

#

the api I'm using just calls them "modifiers" for whatever reason, so I'm just trying to stay consistent to avoid confusion for anyone that eventually works on this in the future (if anyone)

quartz kindle
#

think about how you would do it in json

wheat mesa
#

I was just wondering if that's the correct way to model relations from one table to another

quartz kindle
#
item = {
  name: "abc",
  modifiers: [
    { type: "stats", effect: "str", value: 10 },
    { type: "magic", effect: "fire", value: 30 }
  ]
}

vs

item = {
  name: "abc",
  modifiers: {
    stats: [
      { type: "str", value: 10 }
    ],
    magic: [
      { type: "fire", value: 30 }
    ]
  }
}
wheat mesa
#
{
  "item": {
    "name": "something",
    "price": 150
    "category": "A"
    "modifiers": [
      {
        "group_name": "Toppings",
        "price": 50,
        "name": "Boba"
      },
      { "other items etc": "", },
    ]
}
#

Something like that

#

But I figured that modeling it directly within the item itself is a bad idea and I should have separate tables for the groups and the items they store

#

And then have the items point to the IDs

quartz kindle
#

yes, if the price and name of the modifiers are unique per item, they need their own table

wheat mesa
#

👍

quartz kindle
#

if all of your items in the table are unique per user, and all modifiers are unique per item, your tables would be:

items table
  owner id
  name string
  price number
  category string

modifiers
  item id
  group id
  price number
  name string

groups
  group id
  sharedgroupprops ??
#

tabular data usually prefers inverting the ownership of the tables, so instead of arrays of ids, you have a table with ids that point back to the item that owns it

wheat mesa
#

ah

quartz kindle
#

so you would query by SELECT modifiers WHERE item = itemid

#

and SELECT items WHERE owner = userid

wheat mesa
#

That adds a little complexity on my end but I see how it's useful

#

I'll do that

#

What should I do about the fact that items can have multiple modifier groups and modifier groups can apply to multiple items?

#

Wouldn’t I have to have an array of IDs on at least one of those?

quartz kindle
#

if modifier groups are sets of data that is always shared, and not something that is created and deleted at will, then yeah you would use an array there

#

or keep them in a json file

#

:^)

wheat mesa
#

I’m building an API backend for a mobile application, but I’m trying to sort of be the “middleman” between the Clover API (for ordering) and my application so it’s more secure and returned in a format that fits my needs better

#

But basically I’m just grabbing data from their API, doing some processing, and storing it for future use for my application to fetch from

#

Reduces the API calls to outside programs and allows me to handle ratelimits easier and such

quartz kindle
#

if modifier A and modifier B have the same groups but the group for modifier A has slightly different data than the group from modifier B, use a separate table the same way its done with items and modifiers
if modifier A and modifier B have the same groups but those same groups ALWAYS have identical data no matter how modifiers use them, then each modifier should have a list of groups they are associated with

wheat mesa
#

(Also if anyone knows how mobile apps securely store credit card information to use for future purchases, let me know. I don’t want to be storing anything super sensitive server side, but I’m sure there’s a way to do it without that)

quartz kindle
#

afaik whatever payment gateway you use (ie stripe) should have their own system for that

lyric mountain
#

^

quartz kindle
#

otherwise idk

lyric mountain
#

btw, regarding the mod thing, it's a wiser option to have a mod pool than 1-to-1 mod relationship to items, else that table will bloat quickly

#

just make some mods with a roll range, then grab a random value of that roll using the item seed

#

like Deals (1-10) extra damage, rolling between 1 and 10 for a given item

quartz kindle
#

but then the same seed would affect all mods

#

and if you want to reroll them by changing the seed, everything will be rerolled

#

its a good idea tho, if those limiations are fine for you

lyric mountain
#

tbh never saw a game where rerolling mod values affected only the rolled value

quartz kindle
#

i did

#

maplestory lel

lyric mountain
#

aw damn

#

well, a way to do it with separate rolls would be to have a long seed (perhaps a hash) and substring it for every mod

quartz kindle
#

items in maplestoy have 3 types of rollable enchancementes, each type is rerolled independently

lyric mountain
#

like, 1234-5678-9012-3456, then use each section for individual mods

#

and reroll only that specific section

quartz kindle
#

yeah thats where bitwise can also come in

#

a 64 bit int can have 2 32bit seeds or 4 16bit seeds

lyric mountain
#

or 8 8bit

quartz kindle
#

8 bit would risk running out of possibilities if you have too many mods

#

even 16bit might run out at some point

#

if putting all possible values of all possible mods together exceeds 64k possibilities

lyric mountain
#

mods would roll their specific section of the seed, so 8 mods would each have 255 possible rolls

#

not necessarily rolling the remaining mods

#

could even dynamically split the seed based on mod count

#

most games ive played never went above 6 mods

quartz kindle
#

joining all mods in the same seed is more space efficient

#

ie, instead of 0-255 for a mod 1 that can only get 0-10 values, and another 0-255 for mod 2 that can only get 0-20 values

#

you use one 0-255 that contains all possibilities for both mods together

#

which is 10*20 = 200 possibilities

lyric mountain
#

like 0xFF FF FF FF FF FF FF FF

#

where each FF would be a separate mod roll

quartz kindle
#

but you dont need to fragment if muitple mods fit inside a single fragment

#

its basically compressing them together instead of fragmenting

lyric mountain
#

ah yes, that's an option too

earnest phoenix
#

who can help me use spotifys secret api

lyric mountain
#

why are you so eager to break tos

earnest phoenix
earnest phoenix
lyric mountain
#

fairly sure using undocumented apis is against their tos

earnest phoenix
earnest phoenix
#

is it my fault spotify doesn't provide that information in their public api?

lyric mountain
#

not all apis are public

tulip ledge
#

Dont you need an auth key to access the spotify api?

lyric mountain
#

probably

#

btw battle

earnest phoenix
#

i'm not doing any of that

#

i want stream counts and monthly listeners of artist

#

spotify public api does not provide i don't think it's too unethical to use their secret api

lyric mountain
#

stop calling it secret api, it's not like some kind of easter egg

#

all in all, you still need a token to access the api, they'll know if you use unauthorized endpoints

earnest phoenix
#

flaze showed me how to use it earlier

#

but his provided example didn’t work for me

#

^