#development
1 messages · Page 1815 of 1
combinations grow too fast
Real question is, what exactly are they doing that requires that many calls
most of the combinations will just return null. just need to check though
when you index is bigger than your data
Yeah unfortunately
here's an example. there is a pool of 50 players playing a 25v25 game. i want to check every combination of teams possible
Those are hashes and 2 columns need to be indexed
That’s the issue with the table
including player position in the team?
nodemon bot.ts -e ts --dev
[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts
[nodemon] starting `ts-node bot.ts --dev`
'ts-node' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...
@quartz kindle no combinations, not permutations
Anyone knows how to solve?
is ts-node installed globally?
if youre on windows, restart your cmd
that solved it
👍
tim is god in development channel
Also,
package.json:
"dev": "cd src; nodemon bot.ts -e ts --dev",
ERROR:
> topazrpg@1.0.0 dev C:\Users\Yarne\Desktop\TopazRewrite
> cd src; nodemon index.ts -e ts --dev
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! topazrpg@1.0.0 dev: `cd src; nodemon index.ts -e ts --dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the topazrpg@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Yarne\AppData\Roaming\npm-cache\_logs\2021-07-18T21_39_46_512Z-debug.log
This does not seem to work when I do npm run dev but when I cd to src and run the nodemon index.ts -e ts --dev it does work
ok
lol you are extremely misguided about the state of quantum computing atm
lol
The only thing quantum computers are better at doing than regular computers rn is pretending to be a quantum computer
2069: Potato Quantum Computer
they are used in production but not in the way you'd expect
there's only so much you can do with a few bits that can have 3 states
they can only do certain calculations much faster than normal computers but they aren't that useful for most
Hello everyone, I have a query is there any way to translate the arkbuddy bot from ARK is for a server that I am creating in Spanish, and I would like to modify the bot so that it works in my community, I have no problem doing it on my own and assigning it to the creator of the bot! Thank you. PS I don't know if here is the right place in this discord
PD: sorry for my English
@cedar badge
whats the best db for like temporary data..
like i want to make a reminder for ex. then itll delete the reminder a couple of mins or something whats the db for that 
RAM
@errant flax it's temporary data so you can store in a djs collection in ram and it'll get deleted when you want and when the bot restarts
what if i dont want to be deleted when the bot restarts 
thats why im talking about db 
try memcached
If you already have mongo just use that 🤷♂️
can mongodb even store like temporary data
pls bal
You can store any data in a db
Just have it check periodically for expired reminders and ping the user when they're expired then delete from the table
Why not check every 60s?
my friend told me that having a bot game in dms may violate ToS, is this true
Depends what game you mean.
Basically something that is purely carried out through exchanges in dms with bot that may involve a dm every few seconds - one minute?
I believe he said you can't spam someone with dms or smth, but i'm not sure.
It's fine to send DMs to a user if the user has initiated the command.
Spamming the api isn't allowed.
Every minute isn't API abuse
But dming a user is not if they did what mac said
I know this.
They probably misunderstood what their friend said by spamming.
hm ok.
As long as it doesn't get rate limited it's ok
yeah also about rate limited, is it increased rate for bots? and can a bot only get ratelimited in one channel? in other words, how does bot ratelimiting work :D
I think discord ratelimits you on the api itself, so ti doesn't matter what channel its in.
hm.
Here's everything you need to know about rate limits https://discord.com/developers/docs/topics/rate-limits
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
ok thanks :D
There is also that
hm. so just to make sure, ratelimit covers all sorts of requests from discord? basically anything that the bot does in discord.
Ratelimits cover the api, if you spam it you get ratelimited and have to wait.
Spam it too much they reset your token iirc on the first offense.
so what exactly does the "api' mean here, im not really clear
You don't know what an api is?
nono as in what are some examples of what is going to be counted into the ratelimit count
btw what notif will you get when bot is accepted :D
You'll get pinged in #logs
I got my first bot approved. I'm happy
nice
hello hello :3
so i have this part on my bot that asks for a user's reply within a few seconds and if it's not replied, it will end. the problem that i'm having now is that: how do i put in delays between messages inside that await messages portion because using settimeout did not seem to work as it clashes with my await messages' timer D:
this is what i have and the "delay here" is where i want to put a slight delay between each message.
msg.channel.awaitMessages(m => m.author.id == taggedUser.id, {max: 1, time: 30000}).then(collected => {
msg.channel.send(`One message`)
//delay here
msg.channel.send(`One message`)
//delay here
msg.channel.send(`One message`)
//delay here
msg.channel.send(`One message`)
}).catch(collected => {
msg.channel.send('No reply after 30 seconds, duel is cancelled!');
});
is it ok if i checked every 30 secs 
i have this function use for cases like this...
i put await before your msg.channel. etc because they return promises (if i am not mistaken) so it's a good idea to await them, so if they throw an error try/catch will catch it (instead of missing it). I think you can skip the await before msg.channel.send() safely if you are using .catch() .. if that is your preferred style
function sleep(sec) {
return new Promise(resolve => setTimeout(resolve, sec*1000));
}
// your code...
try {
await msg.channel.send(`One message`)
//delay here
await sleep(5);
await msg.channel.send(`One message`)
//delay here
await sleep(5);
await msg.channel.send(`One message`)
//delay here
await sleep(5);
} catch (error) {
console.error(error)
}
OOOOO:
THANK YOU SO MUCH i will give this a shot >:3
hope it works out
any example for a express app post request which needs a token
fun fact, node now has native support for promise-based timers
cool, would ve nice when it comes to the LTS version
tbf, you could even check every second and the database wouldn't even notice it
also, if what you want is precision (and not having to setInterval everywhere), you could use some cron library
if you want to remove stress from your database
pull all reminders at once into memory once your application boots up
and either setTimeout for every single one
or have an interval checking your memory every few seconds for the due ones
this is what i practically do when i need to handle warns expiring etc.
yeah imo that'd be the easiest way
A single interval also works but it's gonna be slower
you save memory at the cost of using more cpu power
Hello. 👋
Do you guys have a function whereas I can pass out an argument that specifies the amount of seconds to wait before each function/method I do?
functiona()
// wait for about 20 seconds
functionb()
Oh.. I didn't realise this was discussed before.. thanks.
Just a doubt i have
can message id be same for message id in other channels?
I'm thinking of using a message id as Primary Key for DB
ah a 18 digit number unique for each and every msg on discord
yeah.
and i see this thing here
* Message id isn't unique to the system, that is why the only way is to loop through all available channels, since message id is only unique to the channel. It is possible (quite unlikely though) to match two distinct messages with the same id from two different channels.
They don't know what they're talking about then
yeah that's wrong
All ids are unique
Oke alr then i guess it's safe to use msg ids as Primary Key
Ooof Thanks now that's reassuring
whats the best non-caching http library in python?
http request or webservice?
one is for getting data, other is for serving
Hey, I am trying to create something like even if my bot restarts it will join the voice channel and start playing from where it left. I am just confused like how to implement this any suggestion or any basic idea will be of great help.
@cinder stratus store the voice channels and the queue in a database then when the bot restarts join all of them and start playing the music
Okay, but the main issue is rate limits it will be around 600-700 connections so any timeout suggestions?
@cinder stratus literally the rate limit for the timeout?
Yeah so I don't get rate limited if it becomes like spam or something to the gateway
Because I have got my bot hit with 429 many times
and I don't want those anymore
so it will be something like this?```js
{
guildID: "",
voiceID: "",
playerSettings: {}
queue: []
}
i dunno
use a separate process for voice
like lavaplayer/lavalink does
that way even if the bot process disconnects, the voice process is still connected
I use lavalink
then your bot should not be disconnecting from voice
Like if it restarts it disconnects
what are the sizes of an embed image to not getting cropped on mobile?
They get cropped since there's a thumbnail set
Not sure if you can fix that without removing thumbnail
Only on mobile though
Stupid discord
Unless I'm completely wrong and it's on desktop too lul
Never had issues with that on desktop NGL
no youre right
on desktop fine with
and its getting cropped with thumbnails on mobile wow
thanks :)
on Hover, how do I get it shown over the black field?
Here are the css
.shard-button.ressource{
/*Margin & padding*/
overflow: hidden;
float: right;
color: white;
}
.shard-button.ressource span{
max-width: 0;
-webkit-transition: max-width 1s;
transition: max-width 1s;
display: inline-block;
vertical-align: top;
white-space: nowrap;
overflow: hidden;
opacity: 0.5;
}
.shard-button.ressource:hover span{
max-width: 25rem;
opacity: 1;
}
use absolute position and opacity: 0 the button div
then add onMouseEnter to the black field to set said div to opacity: 1
When I set it to absolute, the button goes on the left side
well yeah, you need to adjust the positioning
right: 0 should do
or whatever pos you want
why are embeds on mobile so dumb? 
and to remove the black field, I just have to use a margin-right, right?
margin-right will add margin to the right
what do you mean "remove the black field"?
not remove it, remove the "overlay", so it looks like this:
btw margin-right works
thats wasnt clear in your question to be fair 
true
put that button outside of the button div
you cant have absolute pos if you want it to share space with the black box
can I make something like a splash/opacity on the black element just with css when the Settings button is on hover?
or do I have to listen on html events?
what
yes you can do it with css only
When I hover on the settings button, it extends and gets to a button tray.
Currently it looks ugly, bc it is over a text. So my Idea would be to decrease the opacity of the black element, when the button tray is extended.
I know that this is possible with html Event listeners, but I dont know if you can change the props of two css element on one action.
also, add some padding for the black box
buttons are too aligned with the margins
https://www.w3schools.com/cssref/sel_hover.asp here's what you want
you can change multiple elements with a single action but only children elements
for parents and siblings you need js
"how to remove child from parent with fork"
I am stuck 🤣
I cant change the properties of .shard-button.log on the hover event of .shard-button.ressource just with css, I need an example lol
you have to put the hover on .shard-button
you cant change siblings, only children
actually
try this
.shard-button:hover.log {
}
but this changes the prop , when I hover on this button, but I want to change the prop of this button, when hovering on the resource button
you cant
if hover is on .ressource then if can only affect things that either have the same class, or are children of this element
How you write your HTML depends on what you want to do with CSS. They're pretty dependent on each other. Figure out how to achieve what you want to do in CSS and that will tell you how to write your HTML.
Argument of type '[MessageMenu]' is not assignable to parameter of type 'MessageActionRowComponentResolvable[] | MessageActionRowComponentResolvable[][]'.
Type '[MessageMenu]' is not assignable to type 'MessageActionRowComponentResolvable[][]'.
Type 'MessageMenu' is missing the following properties from type 'MessageActionRowComponentResolvable[]': length, pop, push, concat, and 26 more.ts(2345)
I'm trying to use discord-buttons to create a selection menu but typescript won't allow me lol
let guides = "";
let SelectMenu = new MessageMenu()
.setID("GuideSelection")
.setMaxValues(1)
.setMinValues(1)
.setPlaceholder("Select which guide you'd like to view.")
for (let i = 0; i < list.length; i++) {
// Code
let selection = new MessageMenuOption()
.setLabel(creator.userName)
.setValue(i.toString())
.setDescription(guide.name)
if (i === 0) selection.setDefault();
SelectMenu.addOption(selection)
}
cmd.reply({
embeds: [embed],
components: [
new MessageActionRow()
.addComponents(SelectMenu)
]
})
Here's the code
addComponents([SelectMenu])
Is it possible to add like it replys with the thinking message?
only for interactions i believe
ye
instead of being locked behind interactions
This is Discord
a simple sendMessage(<User>, <Text>) would suffice
Argument of type '[MessageMenu[]]' is not assignable to parameter of type 'MessageActionRowComponentResolvable[] | MessageActionRowComponentResolvable[][]'.
Type '[MessageMenu[]]' is not assignable to type 'MessageActionRowComponentResolvable[][]'.
Type 'MessageMenu[]' is not assignable to type 'MessageActionRowComponentResolvable[]'.
Type 'MessageMenu' is not assignable to type 'MessageActionRowComponentResolvable'.
Type 'MessageMenu' is missing the following properties from type 'MessageSelectMenu': customId, disabled, maxValues, minValues, and 3 more.ts(2345)
lol
?
hey, how can i get discord ids from an array in a if statement so they can run a command?
.includes()
and i put the array name there?
you will have to check how SelectMenu is structured and convert it to something discord.js accepts
<array>.includes(id)
so nothing in the includes()?
oh my
ids.includes(YOUR ID HERE)
can't be more clear
...just use that
what we told you does exactly that lol
So i have to put mine in the include()?
bruh moment
every id
no
when the user runs a command
which id are you gonna check?
in that specific moment
Like the id of the user
yes
im dumb
thats the id you're checking
what then?
array.includes() already returns true or false
so, then nothing inside includes?
to check if its in there?
<array>.includes(something) = if <array> contains value <something>
tbf that's the most self-explaining function in js
But will it let the others than the id in the include run the command?
you are not thinking are you?
No,bc im tired
then go sleep and come back tomorrow
no.
lol

you said this if(message.author.id === ids.includes(message.author.id)){
do you understand what this line is doing?
if message author id equals the result of ids.includes message author id
the message.author.id in the includes?
const arr = ['duck', 'goose', 'fox', 'dog']
arr.includes('duck'); // TRUE - the array contains 'duck'
arr.includes('horse'); // FALSE - the array doesn't contain 'horse'
cmon, can't get more simple
You aren’t trying hard enough yet 
ids.includes(message.author.id) returns either true, or false
therefore
message.author.id === ids.includes(message.author.id)
becomes
message.author.id === true or false
message.author.id is an ID, it is never true nor false
so that if will always fail
jesus christ
aaaaaaaaaaaaaaaaa
do you know how you use parenthesis in math? the things inside parenthesis are done first?
Ik
so imagine this
if(ids.includes(message.author.id))
{
Yes
}
if(message.author.id === (ids.includes(message.author.id)))
Sorry can’t watch this
the result of ids.includes is done first
we need this as a sticker here
array.includes(find)
will check IF find is an item of array and if yes, then return true, if not then false
The answer has been posted already.
^
and only that person will be able to run the command yea, that dosent help
I need everyone in the array to be able
tbf, if you can't figure this out you need to learn more about coding in general
4 examples
a single boolean-returning function
single param
Yeah everyone in the array can run the command, because EVERYBODY = message.author.id at the moment he’s calling the command
look, when the code runs, its executed in steps, one step at a time. here are the steps that your code will go through: ```js
const array = ["745639745938754938"];
- if(message.author.id === array.includes(message.author.id))
- if(message.author.id === array.includes("745639745938754938"))
- if(message.author.id === true)
- if("745639745938754938" === true)
- if(false)
you're thinking as if (id is in array) //do this
think the opposite
why check if the id is in the array
if you can check if the array contains the id
message.author.id is the id of the author of the message
if(ids.includes(message.author.id)){
message.channel.send(embed)
timeout.timeout('sendmessage', 3000, function() {
message.channel.send(embed2)
message.channel.send(gifs[random])
})
} else {
const embed3 = new MessageEmbed()
.setTitle(':warning: ERROR :warning:')
.setDescription(':warning: You dont have permission to do that command :warning:')
this dosent work
it'll change depending on who used the command
so, ids.includes(message.author.id) will check if whoever used the command is in the array
that is correct, finally. if it doesnt work, you have a problem elsewhere
it just sends the else function
const ids = ["691468323874930779", "808039521328693268"]
this is the ids
can you show the full code for that command?
And you’re sure the message author id = one of the IDs in your array?
the second id is his own, I checked
const { MessageEmbed } = require('discord.js')
const timeout = require('timeout')
module.exports = {
name: "tacobell",
description: "Tacobells",
execute(message, args) {
const gifs = ["https://tenor.com/view/diarrhea-yikes-poop-gif-16674264", "https://tenor.com/view/taco-bell-morning-shit-poop-big-pile-of-shit-gif-18021700", "https://tenor.com/view/poop-shit-diarrhea-ice-cream-soft-serve-gif-4971272", "https://tenor.com/view/lego-diarrhea-shitposting-gif-8359424"]
let random = Math.floor(Math.random () * gifs.length);
const embed = new MessageEmbed()
.setColor('RANDOM')
.setTitle('Tacobell :yum:')
const embed2 = new MessageEmbed()
.setColor('RANDOM')
.setTitle('NOOOOO, WHY DOES THIS HAVE TO HAPPEN TO MEEE :sob:')
const ids = ["691468323874930779", "808039521328693268"]
if(ids.includes(message.author.id)){
message.channel.send(embed)
timeout.timeout('sendmessage', 3000, function() {
message.channel.send(embed2)
message.channel.send(gifs[random])
})
} else {
const embed3 = new MessageEmbed()
.setTitle(':warning: ERROR :warning:')
.setDescription(':warning: You dont have permission to do that command :warning:')
.setFooter('© Fortenox 2021 (All Rights Reserved)')
message.reply(embed3);
}
}
}
do not mind the gifs
did you save the file?
and restart the bot?
👍
How do you get someones roles from a server?
.addField(`Roles`, `${author.roles.cache.map(r => `${r}`).join(' , '), true}`)
Like this?
Since i have been getting this error
why ".map(r => `${r}`)"?
also, author is an user, users cant have roles
you need to get the member instance
also why the true? that basically erases the entire result, so your map join is useless
im tryna get a vote users id
but i get this error
0|index | TypeError: Cannot read property 'cache' of undefined
I have this code
const newuser = Client.users.cache.get(usersend)
where is Client defined?
here
const Client = require('discord.js')
cuz this is in my sharding file
where i start the bot
@lyric mountain
emoji: {
name: ["A", "B", "C", "D", "E"][i],
id: ["866763331075178526", "866763331129311303", "866763330860875817", "866763331225255946", "866763331326836756"][i]
},
Type 'string' is not assignable to type '${bigint}'.ts(2322)
if I just put a number there it sais number cannot be assigned
and if I put BigInt(number) it sais bigint cannot be assigned
show the rest of the code
ok
thats vey wrong lol
put number where?
const bob = require('./mainstart')
const express = require('express')
const Topgg = require('@top-gg/sdk')
const Discord = require('discord.js')
const manager = new ShardingManager('./mainstart.js', {
token: "dfsfds",
})
const Client = require('discord.js')
const { message } = require('discord.js')
const app = express()
const port = 1858
const webhook = new Topgg.Webhook("thinghere")
app.post("/dblwebhook", webhook.listener(async vote => {
console.log(`${vote.user} has voted me`)
const webhook2 = new Discord.WebhookClient('1234', '12345')
webhook2.send(`<@${vote.user}> has voted me`)
const usersend = vote.user
const newuser = Client.users.cache.get(usersend)
newuser.send('Thanks for voting! You recieved 75k bobux')
return this.economy.addBal(usersend, 75000)
}))
app.listen(port, () => {
console.log(`Webhook Port On`)
})
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
manager.spawn();
@lyric mountain
...
thats very very wrong on many levels
Tim, do you know how to solve my issue?
This seems cursed
k fixed @lyric mountain
const {Discord, Client, message} = require('discord.js')
where is the 4th
message doesnt exist in the Discord object
oh
neither does Discord itself
its Message
so how do i get that
you dont
that exists in discordjs
help pls ^^
is it complaining about the id field?
try without an array
i'm going to solve my balance teams problem today
good luck
i have a plan
you probably need to define the types for the array
const array: string[] = ["89479282352", ...]
oh ok
if you uninstall typescript you dont need to do that
Type 'string' is not assignable to type '${bigint}'.ts(2322)
let array: string[] = ["866763331075178526", "866763331129311303", "866763330860875817", "866763331225255946", "866763331326836756"]
this.selectionMenus[j].options.push({
label: creator.userName,
value: i.toString(),
default: false,
emoji: {
name: ["A", "B", "C", "D", "E"][i],
id: array[i]
},
description: guide.name
});
or maybe this ```ts
const array: ${bigint}[] = ["89479282352", ...]
what the
solved it!
👍
templates are amazing
so how do i fix?
the typing part
I mean, int number = 12 or bigint[] arr = [...] would do
like wtf they did with that syntax
you mean the ${bigint} part?
...I'm talking about ts not djs
well you cant remove the let const
: type
i mean they could, but then it would be weird for js users
I keep my groovy
Why no work ```
const usersend = vote.user
usersend.send('Thanks for voting! You recieved 75k bobux')
0|index | TypeError: usersend.send is not a function
usersend is an ID not a user objecr
ye im tryna send to id
optionally typed, can be mixed with java and has a shitton of QoL stuff
you need to fetch the user object
how
like ```groovy
5.times { i -> print(i) }
i wish js had this
tf
how do u fetch user object
or ```groovy
var dog
dog.with {
name = "rex"
age = 10
race = "shiba"
}
client.users.fetch(...)
dont create models
your code is running in the sharding manager, there is no client there. you have to either run it in a shard, or transfer the user id to a shard and send it from there
or this ^ yes
You only need a user ID
you can also create a non-logged in client and give it a token
I wont write a full model declaration there
raw objects are fine for example
and best thing is that it can work seamlessly with java
so you can basically switch from java to groovy and keep all your code intact
const client = new Discord.Client();
client.token = "your token here";
something.on("somethingElse", async data => {
const user = await client.users.fetch(data.id);
await user.send("bla");
})
java is typed oop
smort
java goes in the garbage can
SUPERIOR typed oop
they are trying to be a better functional programming language, but it has too much baggage
Imagine hating on a programming language
streams
what's the issue with it?
it's good, but their versions of those methods are the worst i've seen in any language
like?
reduce
give an example
reducing something from one type to another
var arr = List.of(1, 2, 3, 4);
arr.stream().map(n -> "value is " + n).forEach(System.out::println);
number became a string
because you can use the Stream<> instance elsewhere
also that's not really an issue
also, can you javascript people do arr.parallelStream()?
this syntax is silly too System.out::println
that's a method reference
curry
I could do .forEach(s -> System.out.println(s))
In rust you have to call .iter() in order to be using those so there's that
currying in js is so much better
you're comparing apples to oranges
bruh, like, give me an example of why java is garbage?
public static void main(String[] args) { }
that's fucking ingenious https://github.com/firebase/php-jwt/blob/master/src/JWT.php#L295
...you're really lost ain't u?
that's like, just an entry point
it's a constructor
no it's not
yes it is?
that's just instantiating the class
it forces you to use a class
no, that's a constructor
the method itself is a constructor
public static void main(String args[]) { }
}```
bruh
main is specifically a method meant for constructing the class
class just instantiates it
no, it isn't
yes it is??
then it just runs that stuff
and it injects beans that do hidden stuff
makes it all hidden an tricky
class Whatever {
public static void main(String args[]) { }
}
will also work
why? because it ain't a constructor
c style
yes
constructors by definition cant be named differently from the class and cant have a return value
and if the class also works with main(), it passes the class parameters, correct?
also cant be static
no
i just want to make a function pls java
it doesn't
yes it does
this is as counterintuitive as saying this
class Test
{
public function Test Test() { }
}
err...no
main is just an entry point, it can literally be anywhere
all it'll do is tell your program to start from there
no it doesn't
oh my yes it does lol
it builds literally nothing
constructing and building are distinctively two different things
building means that something at runtime would be assembled
that's not happening here
for this context, consider both to be the same
but that's not what their meanings are
bruh
that's exactly the opposite
will you really play "mr. politically correct" role?
class Main {
public static void main(String[] args) {
//do stuff
}
public Main(String a, int b) {
//run during object creation
}
}
if I do Main m = new Main(new String[]{"a", "b", "c"}) it won't work
I need to do Main m = new Main("a", 12)
because the latter is a constructor, the former has literally nothing to do with Main aside from being able to be called with Main.main
why even attach static functions to instance level functions in the first place java?
it doesn't
in the same scope
now if you have instance variables the static functions dont have access
I feel like you're arguing for the sake of arguing
no one calls static functions from an instance
but it looks like it should since it's in the scope
what is your goal here
yes they do, not the other way though
no?
Class.methodName
static access
not ```java
Class c = new Class();
c.methodName;
public static String transform(String input)
that function could be used in an instance function
couldn't
because static functions can't modify instances directly
unless you also pass the instance as an argument
the instance would be accessing the static function
the instance function could use the static function
hmmm
static functions cant access non-static variables
true
but when the instance function uses the static function it can pass in parameters to the function
Main.someMethod(blabla) is the same as m.someMethod(blabla)
considering someMethod is static
neither will be able to access non-static variables
it's just that all IDEs will tell you to switch to class access instead of instance access
you cant reference this inside a static function
because this doesn't exist at that scope
so you definitely cant invoke a instance function from a static function
statics are just a prop/method on the class itself, like if the class was an object
class SomeClass {
String name;
public SomeClass(String name) {
this.name = name;
}
public static String getName(SomeClass some) {
return some.getName();
}
}
...
SomeClass sc = new SomeClass("dog");
SomeClass.getName(sc);
something like this ig?
although it doesn't really make any sense to use static functions to retrieve attributes from an object
help with?
it would be impossible
wdym a discord thing
my example works
if you run it'll return u the value
it's just that...unnecessary verbosity
you are passing a reference in to the parameter. not access the variables/functions on the same scope
yes
but you can declare variables to be static too
in that case you can access from the same scope without any reference
yes, not really an issue considering static stuff are global
yeah, the classes are the problem
it forces you to use them
well, the program does need to start somewhere
like?
every other language
js, scala kotlin
kotlin is java
go
and good luck going parallel in js
...I can in a few minutes with springboot
dont get me started on spring
i wasn't going to bring up spring because i didn't think that was fair
Hey! I’m still kinda new to per server commands. I’m trying to set it up does anyone know Any YouTube vids or GitHub repos that show them.
I feel you're just ranting about not being as lenient as js
What’s the issue with forcing classes? If you don’t like classes don’t use Java
yeah, not as good as js for sure
bruh, you're comparing potatos to strawberries
dont use java. i agree
both js and java have different targets
I guess this is something like a hobby for this person
probably
don’t use a language if you don’t like it
You don’t need to talk shit about it tho

Languages are just tools and I'm tired of hearing people constantly hate on every language.
billions of devices run Java and it “doesn’t make the cut”
If you don't like it just use one you like god damn it
oh, sure
So that's why you hate it?
pretty much
In my experience anyone who calls themselves a pro at something is pretty bad
not the case here
I’m not a Java dev so I can’t judge your code ¯_(ツ)_/¯
not sure what you are asking
I'm asking you to write how a record is declared
class Record(){}
haha no, you see, that's a thing introduced in newer java versions
upgrading to java 11 and breaking everything these people wrote
if you consider yourself a pro with it you know like 6% of how java works
Isn’t Java 16 released?
I too like using legacy software
it's when records were introduced
at least it has streams
you should really try newer versions, I'm sure your rant will be calmed
java 8 is the worst possible way to introduce someone to java
it's like going to a date without pants and screaming at everyone that looks at you
java 10+ is the chad that buys flowers and chocolate for dates
tbf, there's little to no breaking changes introduced from jdk 8 to jdk 10
I mean, surely many methods will be flagged as deprecate
I know because I try to keep my bot updated with the latest java
went from 8 to 10, then to 11, then to 15 until I finally settled (for now) at 16
I must say I can't really go back to 8
jdk 11 introduced var
are odd number versions not lts?
since I update frequently that's not an issue for me
but yeah, companies should target for even versions
lol
they are going to 11
and they are a big company
they changed their license didn't they
oh, nvm, java doesn't follow a rule
for sure, get the hell away from oracle
good old java
and never versions have the newer license?
yeah, they are going to openjdk 11
no problem then
there are 3 major JDKs: oracle, hotspot and openj9
oracle is the paid shit
hotspot is openjdk's
and openj9 is eclipse's (ibm)
imo openj9 is the most optimized for long running tasks, it does seem to use a lot less memory
never heard of someone using it
Amazon uses it

oh, it's just a distro of OpenJDK
man you'd be so amazed with the new versions
couple that with groovy and you have all the stuff you could ask for in a lang
but that jump your company will do from jdk 8 to 11 will already lighten a lot java programming
first one that comes to mind is varargs
public void someFunction(String... arguments)
that will be nice
if you ever get to jdk 15, you'll get multiline strings
String str = """
this is
a string
""";
and var, obviously
pls give var now
nice
jdk 15 has enhanced switches ```java
int n = 1;
String str;
switch (n) {
case 0:
str = "A";
break;
case 1:
str = "B";
break;
} // NO, fuck that
str = switch (n) {
case 0 -> "A";
case 1 -> "B";
} // sweet
the new one kinda groovy 🥴
do you need help in that language?
ok
i was just making a joke
i thought you needed help
well, i probably need the mental kind
xD
It’s a raff day in development 
hey
how do i export a variable that was used in a command in py to eventually use in another command
just curious to heroku users in chat (that use topgg api meaning you are confined to using web module) do you use kaffiene?
Would a moderation bot need this?
Yes
depends what kind of moderation
It would need it for like
ctx.guild.owner
Very true
you dont need it for that
oh i thought you did becuz before i was stuck on finding server owner and member statuses
owner doesn't need member intents but ill enable it in case i need it sometime later
okie
@frozen mesa are you doing slash commands ?
making an api c:
making bots isnt fun for me anymore
but an api for what ?
endpoints, fun, other bot could use
Yeah i ran out of ideas for my bot
that sounds cool
me too
Bot dev isnt that fun i started web dev for my bot
actually i might add dropdowns because that apparently exists
also does a bot need to be verified
Yeah i have that
to have slash comms
nope
aight
just on your outh2 do commands.applications check mark
only over 100 servers
its just bs that you need to be actually verified
i meant for slash commands
oh no u dont need to
Applications.commands for it
i see
ye
but how would i do it in discordjs
Just the slash api is currently very slow
hmmmm idk cuz my bot is in py
ok
some packages have slash commands
Wait i was thinking of rewriting my bot in js is it easy to do?
depends on your knowledge of js
but to me it's kinda easy
just some more sophisticated things are harder
I know js a little
Then I'd say try to rewrite, but do a LOT of beta testing to make sure that your bot cant crash if someone uses a command incorrectly
Because crashes are annoying
Then put it on your main bot
No one will ever bother DMing you; just ask your question here
whats the issue tho lol
i have a question
what database do you use for your bots ?
i'm currently trying in json but it's a little unstable
you shouldn't really use json as a database
its fine for constant stuffs but anything that changes
I personally use mongodb but lots of people here like postgres
i know but i wanted to try and everyone was right about it
i'm going to see it thanks
your database is corrupted
delete it and start over
fork what?
wut
lol
im not telling you to start over your entire code
im telling you to delete the database file
and start over in the sense that all your database memory will be lost
which database are you using?
quick.db?
thats the database file
delete it
a new empty file will be created
oh wait u can 
also wdym by "the database wouldn't even notice it"
performance-wise
A library that allows you to execute something on a certain schedule.
For example, doing something every 30 seconds
A setInterval is suitable for most users
wdym by this
(sorry im dumb
)
He’s saying that the db is very fast, so an operation every second or so won’t be a problem for it at all
oh but ill prolly cache the data just in case 
also whats the best way to like generate a unique id in mongodb/js
Doesn't Mongo automatically generate one for you
You can
how
I use guild IDs instead
Just add _id
It'll overwrite it
As long as it's unique it won't complain
i mean discord provides the id 
async def taskGenerator(task):
autoActions = AUTOACTIONS()
print("Waiting till ready....")
await client.wait_until_ready()
print("Finished!")```
`Finished` is never printed so i really don't know what to do
waiting part is printed right
yeah
how do i check which one?
discord.py right
yeah
hey what's that api thing that facebook uses called, looks like this i think
name {
requestA
somethingElse
}
pretty sure it's an alternative to json
async def taskGenerator(task):
autoActions = AUTOACTIONS()
print("Waiting till ready....")
await client.wait_until_ready()
print("Finished!")``` `Finsihed` is never printed
any help?
ok i have this command where ppl can buy pokemon items and when they dont have enough money it sends thats they dont have enough money to buy it, but after that, when i check how much money i have it converts to negative, anyone know why?
https://paste.pythondiscord.com/aquxoxoxol.php
bots cannot use other bots slash commands right
No, haha
Most bots ignore other bots exist anyway
ik ik; but this is not just for my bot; its an open source command handler and I dont want someones bot to kill itself
just thinking ahead
hello, i am making a discord bot in visual studio code. i am learning how to make one, using tutorials online
Good for you, not the channel to be talking about thst
technically it is
why do you have a message event inside a message event 
I mean this is for help I’d say, and on line ten they put the wrong string
idek
if
im using a guide
you need to remove the inner message event
do you want me to remove the "else if" basically?
you have a client.on inside of a client.on, you only need one
client.on('message', message => {
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send('Pong.');
} else if (message.content.startsWith(`${prefix}beep`)) {
message.channel.send('Boop.');
}
});```
ok there
im pretty sure thats clearly what you said right

im gonna show you one more time
the correct way to have it
client.on('message', message => {
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send('Pong.');
} else if (message.content.startsWith(`${prefix}beep`)) {
message.channel.send('Boop.');
}
});```
ok there. i copy and pasted your code, because im pretty stupid to find and fix the problems
yeah, i definitely got one or more of it, wrong
mogu
?
basically dont do nested events 
what i mean is dont listen and event inside of another event
by referencing the data you input to it and if required, assign it to the old state 
npm i
can not find disocord.js
did you spell it correctly when you installed it?
what sir
just send the log
error can not find disocrd.js
You fucking spelled it wrong
Do npm remove disocrd.js && npm i discord.js
How blind u gotta be
Your money isn’t wasted, you just aren’t putting in the minimal effort required to debug simple issues.
+++
and 90% of people who start coding with discord bots, they don't know anything from nodejs or even python
even they don't google it for solution and crash courses
I think one of the MOST important skills is knowing how to read error messages properly
Knowing what the error is and where it’s coming from is the fundamental basis of solving that error
debugging is 50% of coding...
And it seems like a lot of people lack in such a skill
And they want us to debug it...
Exactly
I can understand if you have tried to solve an error and/or you’re confused because the error is vague/uncommon, but not even trying to solve it and asking someone else for help isn’t going to get you very far.
I’m guilty of doing that before, but I’ve learned from those experiences and now apply those skills whenever I get an error in my code.
they must do exercises for achieving debugging skill
like
*
**
***
****```
these exercises are very helpful
this website can help u
Guess im one of the few that actually knew how to troubleshoot 🤨
probably you did some exercises.... am i right?
i literally just watched 1 basic video on how to get your bot online n do a basic command
then after when i started this bot that im actively working on (s-nexbot) i started to learn more things
u watched a crash course some how
o
that's good




