#development

1 messages · Page 1911 of 1

split hazel
#

this is like a classic gcse computer science exam question lmao

#

in my exam it was something like pritn("hello world")

spark flint
#

Lmao

#

Seems about right

earnest phoenix
#

is it a good idea to put an a.button inside an h1 inside an article inside a div.tile.is-ancestor inside a div.hero-body inside the main.hero
like does a screen reader think of the heading as also being a link or just an h1

split hazel
#

i cant wait for some actual "challenging?" computer science exam questions for a levels

#

i dont think we get to learn interrupts though

earnest phoenix
opaque acorn
#
  ¡ CONECTADO A MONGODB !
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
     ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
     ┃                                                                  ┃
     ┃   RAILBAN ESTA ONLINE | ?help                                    ┃
     ┃                                                                  ┃
     ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
#

What is this

lyric mountain
#

eh, circular dependency lul

earnest phoenix
#

fizz em nuts

crystal wigeon
#

helpp

#

helppp

#

my shards are not getting calls from certain servers

#

idk why

#

but it says all shards are up

#

im using auto sharding

#

i can see the shard clusters

earnest phoenix
#

umm bulma the text is supposed to look different?

crystal wigeon
#

but idk why tf they not getting calls from servers

#

help

#

i put the bot on 2 different servers tho, maybe that's a reason why?

#

man fk i cant even split my code to run on diff servers

#

help

lyric mountain
#

2?

crystal wigeon
#

yeah

#

it sends double response

lyric mountain
#

then ur bot isn't sharded, I guarantee

crystal wigeon
#

i tried splitting my commands

#

i sharded

#

promise

lyric mountain
#

you didn't

crystal wigeon
#

yes i did

lyric mountain
#

u said u put autoshard

crystal wigeon
#

yeah

#

auto shard

#

should spawn

#

shards

lyric mountain
#

autoshard only shards above 2000 servers

crystal wigeon
#

right?

#

my bot is on 6k servers

lyric mountain
#

...u said it was in 2

crystal wigeon
#

i meant, i deployed it on 2 VMs lol

wheat mesa
#

I think he meant he’s load balancing

#

Yeah

crystal wigeon
#

tried to code split between servers

#

to handle only certain commands

#

but the commands are not working from seom guilds

#

sdc servers

lyric mountain
#

u need to select which shards each server will get iirc

crystal wigeon
#

how

lyric mountain
#

else both will listen to all shards

crystal wigeon
#

?

#

how do i do that

lyric mountain
#

can u please stop speaking 1 sentence per line?

crystal wigeon
#

mhm, can you help me out here pls

lyric mountain
#

idk how to do it, but u can't just run the exact same code on two vms

#

it'd be the same as starting the code twice

crystal wigeon
#

yeah which is why i tried running different one's but in that only some dc servers were able to reach the shards on the second server working other were not

lyric mountain
#

what u could do is like, get shardid from client and if (<shardId> % 2 == 0) return;

wheat mesa
#

I think it’s more complicated than it’s worth imo

crystal wigeon
#

i have no other option tho

#

so im exploring everything i can

wheat mesa
#

Unless it’s a really big project that needs high performance

crystal wigeon
#

kinda is

lyric mountain
#

load balancing is only worth above a hundred thousand servers

crystal wigeon
#

hmm

lyric mountain
#

6k servers is nothing computer-wise

crystal wigeon
#

but i have a 4cpu 8gb VM which for was causing 160% cpu usage due to influx of players

lyric mountain
#

160% is only 1 cpu at 100% and 1 at 60%

crystal wigeon
#

but i was using sharding there

#

and things were also kinda laggy

lyric mountain
#

and depending on what you're doing, there's probably a way to optimize stuff

crystal wigeon
#

yeah i'm aiming for that in the long run but for a quick fix i tried moving some of the commands on anotehr vm

earnest phoenix
crystal wigeon
#

i have 2 vms currently

lyric mountain
#

you should always try to optimize first before moving to another vm

earnest phoenix
#

^^

lyric mountain
#

if u have a badly optimized code there'll be do budget that can support it

lyric mountain
wheat mesa
#

Things like caching members/presence intent will take a lot of ram/cpu, especially if you don’t need to use them

crystal wigeon
#

ik im not doing any of those

lyric mountain
#

presence is the least useful I'd say, unless u need to check whether a member is online or not

#

and it's a real performance hog

#

is your code open-source hoax?

#

@opaque acorn before u ask, circular dependency

opaque acorn
#

nono

crystal wigeon
#

nop but i just wanna say i'm always trying to optimize it with little time that i get, but at the same time im also trying to scale better,

opaque acorn
#

i dont going to ask

crystal wigeon
#

i dont wanan kill the bot until its fully optimized

#

i can work asynchronously, currently just wnat to make it stable

lyric mountain
#

well, buying a second vps is not the answer

crystal wigeon
#

i already have 2 vps is what im saying

#

i have a small machine for something else

lyric mountain
#

there're probably a couple or two open knots in ur code

crystal wigeon
#

i was ognna use that until i optimize stuff and stabilize it for some time

opaque acorn
#

if i want to check if the channel is nsfw i have to do if (message.channel.nsfw) { } else { } ?

lyric mountain
#

I guess so, check the docs

crystal wigeon
#

also one other thing, what if i split the code myself and start 1 app with few commands and other app with few commands in this case even if both vm spawn shard 0 it should work for all the guilds trying to access this command right?

quartz kindle
#

yes but then you will be putting twice the work on your network

#

since youll be receiving all events twice

#

unless you split it by intents as well, ie process 1 handles messages, process 2 handles memberUpdates

#

and youll have to deal with split caching too

spark flint
#

How do I do a post request in Express with Authentication?

#

I wanna make my signup for a fuck ton more secure

#

I’m gonna make it send requests to /new which will make the API requests instead of making the form submit direct to the API, which allows me to add authentication and makes it a bit more secure

crystal wigeon
willow mirage
#

there is a file in /commands/files

wheat mesa
#

You’re not using relative pathing

#

Use ../commands/whateverdirhere

#

Forgot the extra dot for whoever read that ^

cinder patio
#

readdir uses paths relative to the directory from where you started the process

#

you can also just use absolute paths

stray seal
#
 * Serving Flask app '' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://172.18.0.70:4365/ (Press CTRL+C to quit)
172.18.0.1 - - [29/Oct/2021 16:53:25] "GET / HTTP/1.1" 200 -
I'm in
CoolZone-Assistant#2747

PY for a Friend. Can someone help?

native walrus
#

with what

stray seal
coarse topaz
#

Hello, I'm getting this error, discord.js

#

I tried to attach a .mp3 file and this's what I got

#

The thing is that this worked just fine back in July, when I tried to do the same thing

#

The file is 74.73MB size

#

Is there a way I can bypass this?

quartz kindle
#

the attachment limit is 8mb lol

coarse topaz
#

Like they have Nitro don't they

earnest phoenix
quartz kindle
#

bots dont have nitro

#

they have some special permissions and rules

#

some parts of nitro are included, but not all

coarse topaz
solemn latch
#

I feel like bots did once have it, but not anymore.

coarse topaz
#

Idk if Discord set a limit recently or something

coarse topaz
#

The main file currently looks like this

earnest phoenix
coarse topaz
earnest phoenix
#

Okay,do you have a domain?

coarse topaz
#

I don't think so

solemn latch
#

The most reliable of hosts aPES_TripleEyes

earnest phoenix
#

You can get one at freenom or buy one .Since it would be bad,if you reveal your ip

quartz kindle
#

you dont need a domain to host a file

earnest phoenix
quartz kindle
#

what do you want to do with this file?

#

is it always the same file?

solemn latch
#

Just looking at the hosts bot services their highest end bot plans only include 256mb of ram. Hosting even a few 75mb files might turn into some issues.

coarse topaz
solemn latch
#

Op nvm their site just hides the better plans

#

Kek

coarse topaz
#

The main file is in other similar channel but we're planning to mix some of these amas channels into one single channel, so I'd just like to embed these mp3 files into the new channel

coarse topaz
solemn latch
#

Well, just a note hosting these files yourself very quickly increases the ram usage

#

If your storing these files in memory even temporarily a 75mb file takes up like a third of your memory if your on 256mb(if that's the plan)

coarse topaz
#

Yeah my server has 256mb, but what I question is the fact of why if I did the same thing some months ago it doesn't work now

quartz kindle
#

you dont need to store them in memory

coarse topaz
#

This is what the code looks like:

#
if (message.content.startsWith(`mm!embed`)) {
  let args = message.content.split(" ");
  if (message.member && message.member.roles.cache.has(roles[0]) || message.member.roles.cache.has(roles[1])) {
    message.channel.send({files:[{attachment: `file link here`, name: `QnA_with_Tokeeto_1.mp3`}]});
      message.delete();
          }
      }```
quartz kindle
#

if you dont need to programmatically generate the file

#

just upload it somewhere like google drive

#

and link it

coarse topaz
#

Isn't there a way to embed it directly on Discord? Just like the last time

quartz kindle
#

not without nitro afaik

coarse topaz
#

Don't bots have perms to upload up to 100mb size files? 😔

quartz kindle
#

not afaik

coarse topaz
#

just like Nitro users

coarse topaz
quartz kindle
#

idk

solemn latch
#

I still think it changed at some point.

coarse topaz
#

Well thanks for the help, I guess I'll ask a mod with Nitro to pls upload these files onto the other channel 👍🏻

earnest phoenix
#

compressing would be an alternative solution.

nova basin
#

can you help me please i tried oauth2 for my website but instead of showing the name of the person it shows the whole script of index.html

quartz kindle
#

lol

earnest phoenix
nova basin
earnest phoenix
#

Thats a hosting service 🤦‍♂️

nova basin
#

oh

#

@earnest phoenix but

#

what is it framework I had already heard about it but I never looked at what it was

#

hum oh it's .js and .html ?

earnest phoenix
#

Like express

earnest phoenix
nova basin
earnest phoenix
#

so you use express can you go to index.js and send me a ss

earnest phoenix
#

is it the auth code from discord.js guide?

nova basin
#

so..... ? @earnest phoenix

rustic nova
#

first of all, you didn't update the redirect uri, so this will redirect to something you dont have access to

#

essentially not being able to obtain the access code

#

second, you should probably update the urls as thats the older ones

#

might not have an impact on usage, but would be beter

#

better*

earnest phoenix
#

that is how your code should look like

rustic nova
#

And dont just copy-paste it, try to understand the code, how it functions

nova basin
#

Hummmmm okey thanks you very much

#

Agd

#

And

#

Second question

#

How I make for show the profile picture

rustic nova
#

important part for you is the avatar hash

nova basin
#

ooffffffff

rustic nova
#

Fully reading this should help

nova basin
#

thanks zoomeyes

rustic nova
#

You could also see a pattern when you for example get a users avatar from a avatar command on a bot

https://cdn.discordapp.com/avatars/669452973755072524/efdc7047b63c6e0198fee59a740c4489.webp?size=2048

669452973755072524 being my user id
efdc7047b63c6e0198fee59a740c4489 being my avatar hash

#

should be explained on the image-formatting though

proven lantern
#

another spam server invited my bot

#

anyone getting spammed from 895776092441436170?

earnest phoenix
#

I didn't get spam guilds yet weird.

proven lantern
#

they invite a bunch of bots and then send the !help command to them

#

one help command gets a response from every bot

feral aspen
proven lantern
#

guild

feral aspen
#

Guild??

#

Let me check..

proven lantern
#

the name is 2 Invites = Nitro

feral aspen
#

I suggest using the .leave() method and leave that particular server.

#

Otherwise, if you are for more servers, keep it.

proven lantern
#

there was a spam guild with ~23k bots and that prevented my bot from logging in. i had to use the api to remove them first

spark flint
#

i'm making a server blacklist db

proven lantern
#

898782595750428712 and 901538946222293002

spark flint
#

epic ty

feral aspen
#

What's wrong with bot farms with verified bots? Eyes

spark flint
#

ratelimiting

proven lantern
#

install 23k bots
call help command once
spam discord with 23k help responses

spark flint
#

and then spam the help command

feral aspen
#

Discord client will crash. lmao

spark flint
#

should i make the server blacklist api with express or quart/flask

rustic nova
#

main intent is probably to try to make discord die

proven lantern
#

i reported the first two a couple days ago.

feral aspen
#

Ah, but how does that affect my bot?

#

He adds 23k bots, and he wasted his time doing that for no reason.

spark flint
#

affects the discord api as well

feral aspen
#

Does the message intent fire 23k times?

spark flint
#

spam !help for 23k bots to ratelimit and attempt to attack the API

#

cloudflare will ratelimit all of the bots

feral aspen
spark flint
#

instead of sending the usual 5-6 messages at one time when you do !help, it will send 23k at one time and it could affect the api

spark flint
#

iirc cloudflare will start timing out connections when a massive spike in requests happens

feral aspen
#

Anyways..

spark flint
#

i mean not one bot ratelimit

#

cloudflare will start slowing down requests and timing them out if there is a massive spike

spark flint
#

for example, 23k more requests at one time

feral aspen
#

Where can I see that massive spike?

spark flint
#

you can't

feral aspen
#

Yikes...

spark flint
#

well you can technically

feral aspen
#

Unyikes...

spark flint
#

bots will slow down

feral aspen
#

Yikes..

spark flint
#

as its not publicly visible as only discord can view on their cloudflare panel

spark flint
#

lmao

earnest phoenix
#

just add cooldowns,then you are safe

sterile brook
#

Hm

#

Is that possible to get channel from guildCreate event, that bot actually can type in, not just random one

spark flint
#

alr so

#
val = [
  ('Peter', 'Lowstreet 4'),
  ('Amy', 'Apple st 652'),
  ('Hannah', 'Mountain 21'),
  ('Michael', 'Valley 345'),
  ('Sandy', 'Ocean blvd 2'),
  ('Betty', 'Green Grass 1'),
  ('Richard', 'Sky st 331'),
  ('Susan', 'One way 98'),
  ('Vicky', 'Yellow Garden 2'),
  ('Ben', 'Park Lane 38'),
  ('William', 'Central st 954'),
  ('Chuck', 'Main Road 989'),
  ('Viola', 'Sideway 1633')
]```
nimble kiln
#

Mysql s1_Poggers

spark flint
#

how do i get data from a json and put it in a list like the format above

#

basically for example

val = [
  ('userid', 'reason', 'moderator', 'date', 'evidence'),
  ('471409054594498561', 'idk i nuke servers or some some shit', 'big.bun#6969', '29/10/21', 'https://capybara.bar')
]```
nimble kiln
#

Are you using NodeJS and the sql package?

spark flint
#

nope

#

python

nimble kiln
#

well

spark flint
#

its either that or make a for loop and do 1.7k of those requests

nimble kiln
#

If you interact with MySQL you dont have to format it

#

I dont quite understand your question correctly tho

#

Do you want to put data into your SQL database, or get data from your database?

spark flint
#

i'm migrating from json to mysql

nimble kiln
#

Ok then you have two options:
Format your JSON data so you can insert multiple VALUES with one query
For-loop your JSON array and do one INSERT on each line

spark flint
#

the other option is doing py sql = "INSERT INTO blacklist (userid, reason, moderator, date, evidence) VALUES (%s, %s)" val = (user, bl["reason"], bl["mod"], bl["date"], bl["evidence"]) mycursor.execute(sql, val) for every json entry, where there 1.7k entries

nimble kiln
#

I'd do the 1.7k queries because it's easier 😄

spark flint
#

ah alr

#

then do mydb.commit() after

nimble kiln
#

I'm not using commit()

#

I simply .execute(SQL, Values) and done

spark flint
#

i'm using a tutorial lmao

nimble kiln
#

ok I'm sometimes using commit

#

idk python that well but I have something written that uses mysql like you do

#

I guess you can mycursor.execute() multiple things

#

and .commit() once at the end

spark flint
#

i'll try

#

it doesn't hurt to try KEKW

nimble kiln
#

It's a fresh database so it doesnt matter if you have to delete it 😄

spark flint
#

wtf

#
import mysql.connector

mydb = mysql.connector.connect(
  host="absinthe.hostns.io",
  user="username",
  password="passwod",
  database="db name"
)

mycursor = mydb.cursor()

sql = "INSERT INTO blacklist (userid, reason, moderator, date, evidence) VALUES (%s, %s)"
val = ("test", "test reason", "big.bun#6969", "29/10/21", "https://capybara.bar")_
mycursor.execute(sql, val)

mydb.commit()```
#

OH WAIT

nimble kiln
#

underscore

spark flint
#

sorry ignore my stupidness

nimble kiln
#

:DDD

#

@spark flint wait

spark flint
#

it worked

#

ss fail

nimble kiln
#

wait

#

how tf did it work

spark flint
#

i fixed the error

nimble kiln
#

you have 5 fields

spark flint
#
sql = "INSERT INTO blacklist (userid, reason, moderator, date, evidence) VALUES (%s, %s, %s, %s, %s)"
val = ("test", "test reason", "big.bun#6969", "29/10/21", "https://capybara.bar")
mycursor.execute(sql, val)```
nimble kiln
#

ah

#

Yes yes

#

Did you format your table correctly?

spark flint
#

wdym

nimble kiln
#

well you can give the date field a date option

spark flint
#

oh

#

nice

#

idk how

#

but atm it seems fine like this

#

idk

nimble kiln
#

I think it mainly saves on space

#

because you are inserting a string right now into everything

#

you can also limit the length of the userid field to discord-snowflake-ID-length

spark flint
#

the date is the same for all the json ones atm as i stupidly didn't start logging dates today

spark flint
nimble kiln
#

If you set userid as a unique field you can never insert two rows with the same userID

#

it'll error out

spark flint
#

ah alr

nimble kiln
#

but since you already have a system it's not worth it to rewrite

#

But in MySQL you preferrably work with "Never have two of the same records" by using primary keys (and maybe AUTO_INCREMENT)

spark flint
#

alr its doing it now @jolly notch

#

wish me luck lmao

nimble kiln
#

ayy

jolly notch
nimble kiln
#

just look at your table

#

and refresh it

spark flint
#

FUCKING POG

#

It worked

nimble kiln
#

very noice

#

maybe you also want to save time

#

¯_(ツ)_/¯

spark flint
#

proud of that pog_wheezer

#

gonna work on a site too

#

which you can lookup user ids with

jolly notch
spark flint
#

alr

nimble kiln
spark flint
#

no

jolly notch
spark flint
#

pog

nimble kiln
#

To check if an ID got banned?

jolly notch
nimble kiln
#

that's a stupid idea

#

I dont have to know why @jolly notch you for example got banned

#

Just show the reason when you login and log out the user

jolly notch
#

Well like

#

lets say bun didn't want to give me the data

#

but I still wanted to use his service

#

I am not allowed to use his stuff on my servers

#

so I would just call the api to check if you are banned

nimble kiln
#

ok for something like that it's not bad

#

But then it should just return banned: true/false

spark flint
#

it won't show ss evidence

#

it will just show a basic text output of their name and the reason for blacklist

#

alr so

#

how do i get a specific row

#

like how do i get the data from the 471409054594498561 row if it is blacklisted

nimble kiln
#

You have to refine your search

jolly notch
#

select * from users where id = 471409054594498561

nimble kiln
#

Or transactional:
SELECT * FROM users WHERE id = ?
And use the value field
val = (userid,)

#

you gotta give it the comma at the end, otherwise mysql wont accept it

#

(If a user can input that data it's always better to use transactional statements to prevent SQL injections)

spark flint
#

epic

nimble kiln
#

Here for example you dont have to commit

#

You can use

mycursor.execute(sql, val)
myresult = mycursor.fetchone()
print(myresult[1])```

To get the reason
spark flint
#

i'm gonna rewrite the API soon

#

to check the database instead of json

jolly notch
spark flint
#

all 1.7k rows

jolly notch
spark flint
#

ok

spark flint
#

alr so

#

new thing

#

as mentioned earlier, i wanna make a form which you can check a user id to see if they are blacklisted

#

how can i do this without redirecting anywhere?

#

for example, if the userid is blacklisted, popup with blacklisted with reason etc

proven lantern
spark flint
#

the flow:

user submits id on form --> checks using api --> if api returns true, popup with "User blacklisted" etc with reason, if it doesn't then popup saying "User not blacklisted"

nimble kiln
#

You define a <script type="text/javascript"> function that does an AJAX call to your API, and your submit button calls that function

spark flint
#

ah alr

nimble kiln
#

There are probably other ways too

pearl trail
#

preventDefault()¿

spark flint
#

gonna start making the template on my test domain so i can show it

#

using tailwind because i'm lazy KEKW

spark flint
#

its been nearly an hour and i still have 0 braincells

wooden kindle
#

hey baes

spark flint
nimble kiln
wooden kindle
errant flax
#

is there a way to listen to an event when an error occur?

#

i have this bug in my code that keeps crashing the program and idk what the bug is

#

nor dont know where it came from

spark flint
#

what language?

errant flax
#

nodejs

spark flint
#

ah

#

imma head out then lmao

grim aspen
#

There’s an error catch

#

I think

quartz kindle
#

it shows an error when it crashes

#

what is the error?

spark flint
#

im "weird" and use d.py so i'm useless

errant flax
#

idk when my program crashes it just restarts itself and clears out the error :/

spark flint
grim aspen
errant flax
#

idk tbh

quartz kindle
#

if it clears out the error, then you should fix that first

#

is useless to try to blindly fix something

#

you have to figure out how to get the error logs to stay first

#

if you're using one of those pterodactyl hosts, ask their support

errant flax
#

also how do i know if it errors or not?
i only suspect it crashed bc the uptime of the bot like reseted

errant flax
#

help

boreal iron
#

?

boreal iron
#

Yeah I can see that, too freerealestate

#

Still missing the context

errant flax
#

i want my program to listen when it crash yk what i mean?

boreal iron
#

Well you need to differentiate crashing and exiting.

#

An app will not notice an unexpected crash.

#

If you speak about a node app I highly doubt it crashes.
I guess it ends it process for a specific reason.

#

You can try to create an event listener for the node process.

#

And log the results in a text file if your console is empty after a restart.

#
for(const event of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"])
{
   process.on(event, () =>
   {
      …```
#

Aww… fuck that mobile Discord shit

lament rock
#

You shouldn't try to handle exit codes yourself unless you really know what you're doing, because you can fuck up when it comes to handling the process exit correctly and a mess would ensue.

wheat mesa
#

that's so fucking weird I was literally just thinking of that

lament rock
#

The proper response to crashing is to write code that doesn't cause the process to crash in the first place

nimble kiln
#

or run your script in a while true loop

lament rock
#

SIGINT and SIGTERM are also through the course of user intervention and you should not cover those unless your app tries to cancel whatever it is it's doing in risk of an error occurring

errant flax
errant flax
boreal iron
#

And log the results in a text file if your console is empty after a restart.

boreal iron
#

Or just exists because of an unhandled rejection… who knows

errant flax
boreal iron
#

These should be handled, too

errant flax
#

?

lament rock
#

write your logs somewhere then

boreal iron
#

Well now linking the already quoted text omg

lament rock
#

your can create a write stream to a file temporarily, doesn't have to exist in the code base forever (just make sure that you name the file something where the process won't overwrite existing crash logs)

#

You’d just have to proxy writes to process.stdout to your own handler

errant flax
#

im confused waitWhat

boreal iron
#

Like an unhandled rejection

#

In a newer node version

lament rock
#

process.stdout.write("hi"); // equivalent to console.log("hi");

const file = require("fs").createWriteStream("log.txt");
file.write("hi");

process.stdout = file; // replaces the write stream. Console output will no longer be possible unless written to stderr

errant flax
lament rock
#

Look to google for debugging help. Just don't listen for exit codes to try to handle them yourself.

#

personal experience; it wasn't fun

quartz kindle
#

again, ask your hosting service about the logs being cleared. there has to be a way to get them, otherwise logs are useless

late parrot
#

any good free hosting sites other than repl.it?

quartz kindle
#

google compute engine free tier (requires credit card)

late parrot
#

brhe

#

not allowed to use cc now

quartz kindle
#

then you only alternatives are glitch and heroku

#

and i believe replit is somewhat better than both of them

earnest phoenix
#

so if you ping your project constantly then your project can get deleted with your account

#

and yea replit is better for me

proven lantern
#

if you write your bot as an interaction url endpoint then you can use all those services as intended

royal pawn
#

How to make this buttons inline?? topggThink

#

My code:

async def test(ctx):
    msg = await ctx.send(content="Buttons! Buttons! Buttons! Buttons! Buttons! Buttons! Buttons! Buttons!", components=[Button(label="Button", custom_id="button1", style=ButtonStyle.blue),
    Button(label="Second Button", custom_id="button2")]
    )
    interaction = await bot.wait_for(
        "button_click", check=lambda inter: inter.custom_id == "button1"
    )
    await msg.edit(content="Edited")
    await interaction.send(content="Button Clicked")```
blissful coral
#

inline?

hexed bear
#

Idk in python, in js just add two rows

#

Oh u mean in a row

royal pawn
#

It should be Button Button

#

But now it's
Button
Button

hexed bear
royal pawn
royal pawn
small tangle
#

Does the free tier of mongodb atlas offer serverside logs? Im trying to find them to debug an error but i cant find them FeelsBadMan

royal pawn
hexed bear
#

components=[[Button(label="Button", custom_id="button1", style=ButtonStyle.blue), Button(label="Second Button", custom_id="button2")]]

small tangle
#

I guess he means components=[[Button(...), Button(...)]]

#

Oh oops

hexed bear
small tangle
novel jetty
#

Anyone know how to fix this? Everything is working fine but it throws this error

C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\rest\RequestHandler.js:298
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Unknown interaction
    at RequestHandler.execute (C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async ButtonInteraction.reply (C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:98:5)
    at async Client.<anonymous> (C:\Users\great\OneDrive\Desktop\Watcher\main.js:112:5) {
  method: 'post',
  path: '/interactions/903910639460814868/aW50ZXJhY3Rpb246OTAzOTEwNjM5NDYwODE0ODY4Okkyb3hXdUpyU3pTMXF1bTd5Y3ZKS2VWRlVLSzFXQUZ1Wm1qaTJVTDEyZHZHVWt5R2pDSGcwQWZ6VlRJNEtWb0w4OEUySXBhQXNhV3hrUTNCRXZQMzlNVXpINHBFdjhCa0JSZEFrQkJSMk0xWjNibWd5bFlNRjY2UTdCWjdvV3M2/callback',
  code: 10062,
  httpStatus: 404,
  requestData: {
    json: {
      type: 4,
      data: {
        content: 'The role <@&875064681117655101> was added to you',
        tts: false,
        nonce: undefined,
        embeds: undefined,
        components: undefined,
        username: undefined,
        avatar_url: undefined,
        allowed_mentions: undefined,
        flags: 64,
        message_reference: undefined,
        attachments: undefined,
        sticker_ids: undefined
      }
    },
    files: []
  }
}
earnest phoenix
novel jetty
#

Wdym?

earnest phoenix
#

if you dont respond to a interaction in 3 seconds, you cant respond to it anymore

novel jetty
earnest phoenix
#

🗿

radiant kraken
#

it's documented right there on discord api docs

novel jetty
earnest phoenix
#

Does anyone know how to get every url of a image on a website into an array

solemn latch
#

Like every image url on the page?

earnest phoenix
earnest phoenix
#

hello my vdsim is giving an error can you please help? @hexed bear

earnest phoenix
hexed bear
#

Do u want to get urls through bot?

earnest phoenix
earnest phoenix
hexed bear
hexed bear
earnest phoenix
earnest phoenix
hexed bear
earnest phoenix
#

It gave me 'cannot find module /usr/bin/chromium-broswer'

hexed bear
#

Wait I thought you were doing sth like
The user use command like
block and you show the image of the block

earnest phoenix
#

Yes

#

And like blocks randomly appear and you can claim tjem and like theres only a limited amount of them

#

Thats why i need urls

earnest phoenix
earnest phoenix
hexed bear
earnest phoenix
#

Wheres that

#

Also i tried using like a regex thing that tries to find sll the urls but it doesnt eork i dont think

#

Oh it worked

#

Too small tho when you click on the images on the website its big

hexed bear
sacred aurora
hexed bear
sacred aurora
#

like just to get the url once

#

not with command

earnest phoenix
#

I want to get the url of all the blocks

hexed bear
earnest phoenix
#

See how do i get that image

hexed bear
#

Use puppeteer

sacred aurora
#

just fetch the html data then parse it using cheerio then get the images

hexed bear
#

Uhh yes cheerio also works

sacred aurora
#

yes manually

earnest phoenix
#

Yes but i can just get the og:image property thing on all of them

#

I dont know how but

sacred aurora
#

u want to do it for all blocks?

earnest phoenix
#

Yes

sacred aurora
earnest phoenix
#

Could i use axios

#

axios.get('link block')

#

Does that give the html

sacred aurora
#

yup

#

then parse it with cheerio or other html parser

earnest phoenix
#

I can just find a piunt i can split it at i think

#

split('<meta property="og:image"').join('').split('">')

#

Eould that eork

sacred aurora
#

ugh

#

why are you join that after you just split it

earnest phoenix
#

split('<meta property="og:image"')[1].split('">')

#

Wait let me try

sacred aurora
#

thats gonna give content="https://.....

earnest phoenix
#

Yes rhats good

#

Where in response would it give the html

sacred aurora
earnest phoenix
#

Yes that works let me try

#

Okay it works

#
const axios = require('axios')
axios.get('https://minecraft.fandom.com/wiki/Stone').then(res => {
  let html = res.data
  let string = html.split('<meta property="og:image" content="')[1].split('"/>')[0]
  console.log(string)
})```
earnest phoenix
sacred aurora
#

np

earnest phoenix
sacred aurora
earnest phoenix
#

Yes but they are formatted with colums and stuff

sacred aurora
#

it got all the icon

#

kinda

earnest phoenix
#

Acacia Button JE3 BE2.png Acacia Button
Acacia Door JE4 BE2.png Acacia Door
Acacia Fence JE3 BE2.png Acacia Fence
Acacia Fence Gate JE3 BE2.png Acacia Fence Gate
Acacia Leaves JE2.png Acacia Leaves

#

Oh i could copy it and split after .png

sacred aurora
#

hmmm

earnest phoenix
earnest phoenix
sacred aurora
#

is that an image link?

earnest phoenix
#

No i need the names of sll the blocks

#

Like dirt, stone etc

earnest phoenix
#

I am sure there is a meta parser on npm

earnest phoenix
earnest phoenix
#

i don't need it mmLol

earnest phoenix
#

why is it not sending message on reaction

#

It detects it but doesnt seem to detect channel id

silent relic
#

You used 3 equal signs it should be 2 equal signs

pale vessel
#

No, channel IDs are always string

#

Or IDs in general in Discord.js

earnest phoenix
#

same thing

earnest phoenix
#

yeah its caching problem, weird it worked few minutes ago

#

but it doesnt listen for old messages ;d

silent relic
earnest phoenix
sacred aurora
earnest phoenix
#

yeah i followed it but it didnt work

#

works now tho, just had to add partials

#

I didnit

#

I finslly did it

#

No i havent

timber fractal
#

what do you mean, Size is not an Integer js return await progressBar.splitBar(100, percentage, {size: 10, line: `[▬](https://teddie.statuspage.io, Nice progress you've got!)`});

tulip marsh
spark flint
#

odd

#

try refreshing

#

that sometimes fixed for me

tulip marsh
#

k

tulip marsh
#

😦

#

when i remove whole mcd

#

it shows syntax error in some other cmd under i

spark flint
#

try retyping out the message

tulip marsh
#

😦

#

lemmi do again

spark flint
#
@bot.event
async def on_ready():
  #code here```
earnest phoenix
#
name:'say',
    description:"say what the user says",
    execute(message, args){
     
        if(message.member.permissions.has('MANAGE_MESSAGES')){
        const messageSent = message.content.slice(5).trim()
        if(message.author.bot) return;
       await message.channel.send(messageSent).catch(err => console.log("cant send message"));
          
        message.delete()
    }
} 
}```
my say command, there's no error but if I run the command in a channel where the bot doesnt have perms to text then I get this error:
```    throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Missing Permissions```
I dont mine giving my bot perms, just that its in like 200 servers and if it doesnt have perms in any server and they run the command it exits the node
so i tried to catch error so it doesnt exit node but didnt work
tulip marsh
spark flint
#

if i can't help i won't so repeatedly sending will just slow everything down

spark flint
earnest phoenix
royal pawn
#

How to make bot reply in embed on button click?
My code:

@buttons.click
async def pokemon(ctx):
     embed = discord.Embed(title="test", description="Test")
     await ctx.reply(embed=embed, flags = MessageFlags().EPHEMERAL)```
jolly notch
quartz kindle
#

depends on the library you use

#

most databases support 64bit ints, depends on the library to respect them

#

especially when using js

quartz kindle
royal pawn
lilac mist
#

It certainly does

royal pawn
quartz kindle
#

there is nothing related to "button" in their docs

lilac mist
#

lmfao

#

discordmodules

#

wait lemme get sum code

royal pawn
quartz kindle
#

so you have to use a separate library on top of discord.py

quartz kindle
#

which means i wasnt wrong lol

lilac mist
#
from discord_components import Button
from discord_components import ButtonStyle as s
from discord_components import DiscordComponents, InteractionType


    @commands.command()
    async def creators(self, ctx):
        await ctx.send(
            "Follow our fellow creators!",
            components=[
                Button(style=s.URL, label="Spooky_Ellis", url="https://www.twitch.tv/spooky_ellis"),
                Button(style=s.URL, label="Tijgersword", url="https://www.twitch.tv/fake_tijgerswordd"),
                Button(style=s.URL, label="AnoukO_O", url='https://www.twitch.tv/anouk0_0'),
                Button(style=s.URL, label="IcyyLIVE", url='https://www.twitch.tv/IcyyLIVE'),
                Button(style=s.URL, label="StrayTheFox", url="https://www.twitch.tv/straythefox1")
            ]
        )
#
from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType

   @commands.Cog.listener()
    async def on_ready(self):
        await self.bot.change_presence(activity=discord.Streaming(name='A_Hidden_One', url='https://www.twitch.tv/a_hidden_one'))
        DiscordComponents(self.bot)
royal pawn
quartz kindle
#

py?

royal pawn
lilac mist
#

bruv it works with py and python

#

it's not hard

tulip marsh
#
  if isinstance(error, [what to put here] ):
    await ctx.send("You are not connected to any voice channel")```
earnest phoenix
#

Assuming it's d.py, the voice attribute of Member objects is optional, just check whether or not it's None. If so, the member isn't connected to a voice channel / you don't cache voice states.

modest maple
worn sonnet
#

So it actually happened stackoverflow is now in readonly mode

jolly notch
spark flint
#

the lookup site

jolly notch
spark flint
#

i need to make the actual api use the mysql db instead now

jolly notch
#

good

spark flint
#

i'm still editing the code i stole from stackoverflow

jolly notch
spark flint
#

christ

#

wait

#

how do i make a get request in js

#

the code i stole didn't work

near pulsar
#

Nodejs?

spark flint
#

yep

near pulsar
#

Install axios

#

Then it's axios.get('url')

#

A bunch more options on the docs

wheat mesa
spark flint
tardy hornet
spark flint
#

That should work right?

earnest phoenix
#

Algolia

Your website must be a technical documentation of an open source project or a technical blog. We do not index commercial content.
So they won't index the docs of my discord bot. Since it isn't opensource.

lament rock
#

You can generate docs through code annotation

#

or make your own doc gen

earnest phoenix
#

I already have the doc generation. I currently use Vuepress,but i need the search bar,which is better than the default.

lament rock
#

good luck with that

#

I've got no advice for you there

tardy hornet
lament rock
#

your bot crashed before it became ready

tardy hornet
earnest phoenix
lament rock
#

That's for you to figure out

#

a tech blog is exactly as it sounds

#

a blog about tech

#

or the technicalities of a project

#

generating docs for something kind of destroys private source nature

earnest phoenix
#

okay thx then ,I will have to find an other way 👀

spark flint
#

i'm having some trouble with fetch()

#
fetch("https://blacklister.xyz/api?userid="+ x +"&apikey=APIKEY")
            .then(data => {
                console.log("2")
                return false;
                alert(data.text);
                
            })```
#

i did console.log("1") before this but only 1 is logged

jolly notch
jolly notch
#

there try now

spark flint
#

alr

#

nope

jolly notch
#

use the thunder client thing I shown you, what data is returned?

spark flint
#

return false; stops it from refreshing but it doesn't even reach that point

spark flint
#

(using original api, not migrated on there yet)

jolly notch
#

no wonder it doesn't work

spark flint
#

what about it

jolly notch
#

It works for me

#

fetch("https://blacklister.xyz/api/?userid=1232131&apikey=APIKEY").then(res => res.json()).then(data => console.log(data.response));

#

I get 403 Unauthorized!

spark flint
#

lemme dm you an api key

spark flint
jolly notch
spark flint
#

i'm trying to run locally

jolly notch
#

is this node js backend?

#

if so you will need to use node-fetch

spark flint
#

i installed node-fetch

jolly notch
spark flint
#

i'm running as a js file on my pc

lament rock
#

then you need to import it from "node-fetch"

spark flint
#

i have

jolly notch
spark flint
#

alr that worked

#

not sure why its not working on the site now

spark flint
#

so it doesn't refresh the page

jolly notch
spark flint
#

i tried

#

and failed

jolly notch
#

code better

spark flint
#

if only

spark flint
jolly notch
spark flint
#

ah wait

jolly notch
#

yeah a skill issue

spark flint
native walrus
# spark flint

you probably don't want to send this data to the browser

wheat mesa
#

make it an async function

spark flint
#

Ah ok

split hazel
#

lmfao

earnest phoenix
#

if i write JSON data as a whole, without appending, can it get corrupted?

quartz kindle
#

yes if:

  1. you try to write it again before the previous write finished
  2. if the process exits or crashes while it is writing
earnest phoenix
#

What if you make it atomic

jolly notch
jolly notch
#

Good ones are mongo or mysql

quartz kindle
#

there is only one way to write files atomically on most operating systems

#

write to temp file -> rename temp file

#

rename operations are atomic in most operating systems because its just a change in the file descriptor, it doesnt touch the file itself

jolly notch
quartz kindle
#

write to a temp file with a randomized name every time to avoid concurrency conflicts

#

then replace the old file by renaming it

earnest phoenix
#

That was what I was referring to, cuz I saw R. Danny does it

spark flint
#

did console.log for the output and got this

nimble kiln
#

first you have to do format c:

quartz kindle
#

show code lol

#

you need to return shit

spark flint
#
fetch = require("node-fetch")

async function returnData(x) {
    await fetch("https://blacklister.xyz/api/?userid=" + x + "&apikey=APIKEY").then(res => res.json()).then(data => {
            return data;
            });
}

async function submitForm() {
    var x = "471409054594498561"
    if (x == "") {
        alert("User ID must be filled out");
        return false;
    }
    else {
        data = await returnData(x)
        console.log(data)
    }

}

submitForm()```
quartz kindle
#

returnData doesnt return anything

spark flint
#

i don't usually use js so i'm absolute shit as it

spark flint
quartz kindle
#

remove the second .then

#

its not doing anything

#

and return the fetch

#

no need to await it

#

you are aalready waiting returnData

spark flint
#

ah yep that worked

#

ty

quartz kindle
#

👍

hallow shell
#

what do you guys think: should enums be plural? (Color.RED vs Colors.RED)

spark flint
#

its now not working on my form

earnest phoenix
fresh bluff
#

Ok is this even Possible if so how do i do it?

rustic nova
#

gateway client type changing

#

check docs

fresh bluff
#

Ok

waxen snow
#

Help Me

When I use the join command I get this:

Uncaught Promise Error: TypeError: Cannot read property 'connection' of undefined  

Full picture is on the bottom

& Here's The Code:

module.exports = {
    config: {
        name: 'join',
        aliases: ['joinvc'],
        category: 'music',
        description: 'Join The User\'s VC **NOTE! this cmd is kinda brokej so dont use it! tnks!!**',
        usage: ' ',
        accessableby: 'everyone'
    },
    run: async (bot, message, args, ops) => {
        const { channel } = message.member.voice;
        const serverQueue = ops.queue.get(message.guild.id);
      try {
        if (!channel) return message.channel.send('**You Need To Join A Voice Channel!**');
        if (!channel.permissionsFor(bot.user).has(['CONNECT', 'SPEAK', 'VIEW_CHANNEL'])) {
            return message.channel.send("**Missing Voice Permissions!**");
        };
        if (message.guild.me.voice.channel) return message.channel.send('❌ **Bot is Already In The VC!**');
      
        if (serverQueue || serverQueue.playing) {
          return message.channel.send("**Cannot Join Another VC While Playing!**")
        }
        await channel.join();
        return message.channel.send("**✅ Joined The Voice Channel!**")
      } catch {
          serverQueue.connection.dispatcher.end();
          return message.channel.send("**Something Went Wrong, Please Try Again!**");
      }
    }
}  

Discord.js Version: 12.5.3

quartz kindle
#

serverQueue is undefined

waxen snow
old cliff
#

I am getting ghost server leave events 😦

#

It doesn't leave any guild but I get the event with guild as an object with undefined properties

quartz kindle
#

you're not the only one

old cliff
#

Ah

earnest phoenix
# old cliff

Yep same for me idk why it is happening like that

earnest phoenix
earnest phoenix
#

bot not online why?

nimble kiln
#

Because of your rainbow console logging

old cliff
#

lmao

delicate shore
#

Hey guys

#

I want to make a new user that has access to only 2 folders in /root/ folder

#

Please guide how can I do so

#

in ssh ^

old cliff
delicate shore
#

Tried this

#

Thanks for help

old cliff
#

What was the outcome of the 1st method

delicate shore
#

It was too long and I knew there was an easier way to do that, just couldn't remember.
I gave up on 1st method after 2nd step

old cliff
earnest phoenix
#

https://sourceb.in/ATQtoxALAJ
can someone help me convert this command into a slash command please?
I tried and it doesnt even work, I know how to do for normal messages, just not embeds (yet)
I am trying out slash commands now
just this one please,will do the rest myself

hybrid cargo
# earnest phoenix https://sourceb.in/ATQtoxALAJ can someone help me convert this command into a sl...

You first need to register the slash command which is completely different from how message based commands work. Read https://discord.com/developers/docs/interactions/application-commands. It has everything which you need to know about. From how to create a slash command and how to use it.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

earnest phoenix
#

command and event handlers

boreal iron
#

Your command structure doesn’t change at all.
All depends on your command handler.
But instead of pushing message as argument to your execute() function, you gonna push interaction as argument.

hybrid cargo
#

^

boreal iron
wooden kindle
#

to get total guilds

#

like this image is it

#

${client.guilds.cache.size}

crystal wigeon
#

hey so while sharding

#

if i pass in a shard list something like [0, 1, 2] shard 0 is never started for some reason

slender thistle
wooden kindle
slender thistle
#

Try it and see Wink

crystal wigeon
#

pls help

#

;_;

slender thistle
#

I believe shard 0 is usually the DM shard

#

Have you tried seeing if the bot responds in DMs?

crystal wigeon
#

nop it also handles guilds i believe, since it says the bot is online in some guilds but is offline in few

slender thistle
#

Ah

crystal wigeon
#

ye, im passing a list [0, 1, 2, 3]. i see shard #1-3 is online but shard #0 is never started, i waited for sometime also

#

weird

split hazel
#

shard 0 does indeed too handle guilds

hybrid minnow
#

Does anyone know how to make bots online 24/7? Actually I followed the instructions but it didn't work :(

hexed bear
#

Hmm, whats ur host?

pale vessel
woeful pike
#

why don't yall use pylon or something

hexed bear
spark flint
#

Lmao

earnest phoenix
#

hi

royal pawn
#

How to use " " in discord.py
Example: await ctx.send("Hi "Just a test"")

pale vessel
#

"Hi \"Just a test\"" or 'Hi "Just a test"'

north kindle
#

Hello, this is not a "code development" question precisely, it's more about the application management. I've entered in the process of my bot's validation in Discord for it to further grow and I'm getting this weird vague error that I don't know what it means. If anyone could help it would be greatly appreciated.

pale vessel
north kindle
#

Wow, didn't even though of it, that might be it. Since I wrote its description for advertising websites only like this one never thought of changing in there. Thanks!

#

Yeah that was it thank you so much :)

earnest phoenix
#

CODE test.js https://sourceb.in/NV2mUupjQH
ERROR been getting this error constantly. tried a lot and nothing worked, help me please

        commands.push(command.data.toJSON());
                                   ^

TypeError: Cannot read properties of undefined (reading 'toJSON')
    at Object.<anonymous> (D:\Bots\slashcommandsbot\deploy-commands.js:11:29)```
#

i sent test.js because the error occurs only when I try to deploy the test.js command, if i remove it, then everything is fine
here is deploy-commands.js https://sourceb.in/7QA3DSmP8v

quartz kindle
#

command.data is undefined

#

you are trying to require a file that does not export a data property

#

this implies that ALL js files in /commands MUST export an object that includes a data property

split hazel
#

CODE test.js
ERROR error

bright talon
#

hi all, is this the place to ask questions about bot development?

slender thistle
#

See channel topic

#

Bot development falls under development

bright talon
#

yeah, I just read it....sorry

#

I am trying to shard my bot. I am new to sharding, and am trying to learn (my bot is in JS, using Node), about converting to functions like broadcastEval. I understand that the objects returned from calls within this scope are stripped of their true object properties, and come back as arrays of objects. I would like to understand how to access an object to do further queries. the documentation implies that it is possible, but everything I do simply returns the arrays of JSON'ed results.

#

for example: the documentation implies that within the helper function scope (serverLookup) I'll have access to the objects before it leaves scope, and then could do a subsequent query, like my "guilds.fetch" but this fails because it still returns an array of objects like the broadcastEval does.

#

what I'd ideally want is that the 'guilds.fetch' call, gives me a Guild object, and then a subsequent call to it allows me to get other nested properties, etc. Without this ability, I'm trying to understand how sharding can accomplish basic tasks. If someone has a good reference github etc...I'm all ears to study and teach myself.

jolly notch
#

That's what I do

split hazel
#

you already overpay colleges so that's perfectly fine

#

college and universities have such poor level of teaching intervention

#

for what you're paying you should be receiving 24/7 round the clock support

loud tree
#
a = int(input("Enter first number "))
b = int(input("Enter second number "))

oper = input("What caluclation do you want? ")

if oper == "+" :
    if a == 56 and b == 9:
        print(77)
else:
    print(a + b)

if oper == "*" :
    if a == 45 and b == 3:
        print(555)
else:
    print(a * b)```
#

it is multiplying when i give + as an input

#

and vice versa

nova basin
#

Hello how I make for remove the subdomain www ?

loud tree
#

faulty calc.

#

assignement

#

daily assignment

#

:(

#

HELP!!!!

earnest phoenix
loud tree
cinder patio
#

b u t w h y

loud tree
#

DAILY assignment

#

bruhhh

cinder patio
#

at least make it make sense

loud tree
#

what can i even do

rustic nova
woeful pike
loud tree
#

main thinkg is that it is MUltiplying on adding

rustic nova
#

overkill

woeful pike
#

functions are higher order citizens or whatever they're called

#

first class citizens

loud tree
#

here we have been mentioned that there are two cases

#

where calculator should print wrong

woeful pike
#

you can just declare that as an if statement inside the operation functions you define

loud tree
#

whenever i give input as +

#

it multiplies

#

and vice versa

#

i am bit confused :(

woeful pike
#

you can still do that with the setup I mentioned

earnest phoenix
#

Anyone can help me in updating pip in vs studio

loud tree
#

but still i am curious

#

whats wrong with my code

woeful pike
#

god imagine if python was a good language and let you do

def add(56, 9):
  return 77
def add(a, b):
  return a + b
loud tree
#

hahah

earnest phoenix
loud tree
#

you are def. functions

clear marlin
clear marlin
#

or if you're using windows try using cmd as admin

earnest phoenix
#

I am in windows

woeful pike
loud tree
#

idk 😂

#

i am new to coding

clear marlin
woeful pike
#

if the operation is + do something, if it's not +, add the 2 numbers together

#

doesn't sound like that's doing the thing you want

woeful pike
#

you want all addition operations to be wrong?

loud tree
#

noo... i was thinking that if those numbers aren't match then computer should simply add them

woeful pike
#

but that's not what you're checking

#

you're adding numbers together when the operation is NOT +

#

because it's in the else branch

loud tree
#

oh fk

#

now i understand

#

computer will now go for *

#
  • will not be counted as if statement is held wrong
#

thanks buddy, gotcha :)@woeful pike

bright talon
#

Xetera, (no tag per channel rules)....I posted a question above...if it scrolls far enough before another dev or person can suggest an answer, should I repost? What's the protocol?

loud tree
#
b = int(input("Enter second number "))

oper = input("What caluclation do you want? ")

if oper == "+" :
    if a == 56 and b == 9:
        print(77)
    else:
       print(a + b)

if oper == "*" :
    if a == 45 and b == 3:
        print(555)
    else:
        print(a * b)```
#

btw i refined my code, i adjusted my intendation

#

now it works fine

earnest phoenix
#

Why so you do a manual check?

#

Just always print a+b and a*b

loud tree
#

i have to make a faulty calc.

earnest phoenix
#

Ehh, ok I guess xD

loud tree
#

haha

limber meadow
limber meadow
#

:P

earnest phoenix
#

Why does this say; TypeError; Code is not a function

const code = require("@hapi/code");


 const suggestontoken = code(10);
            let embed = new Discord.MessageEmbed()
         .setAuthor(message.author.username , message.author.displayAvatarURL())
         .setDescription(suggest)
         .setFooter(`Suggestion Token: ${suggestontoken}`, message.guild.iconURL())      
        .setTimestamp()
        check.send(embed).then(m => {
          m.react('✅')
          m.react('❌')
          message.author.send(`Suggestion Creaed in ${message.guild.name}\nYou will be DM'd when a admin replies.`)
          db.set(`suggest_${suggestontoken}`, m.id)
           db.set(`suggest_${suggestontoken}_msg`, suggest)
          db.set(`suggest_${suggestontoken}_user`, message.author.id)
          message.channel.send(`Suggestion Sent!`)``` `:(`
bright talon
# woeful pike I think you can repost yea

ok thanks. I see in the search/pins there are some people that work on sharding, maybe I can wait until they are online, and then more likely to get an answer. I don't want to spam or bother. 🙂

woeful pike
#

you can also ask in other programming servers

limber meadow
earnest phoenix
#

mhm?

#

But its a package...