#development

1 messages · Page 733 of 1

quartz kindle
#

i mean, the websites you have to interact with

modest maple
#

Ik

#

They don't have a login system or anything

quartz kindle
#

cant you write a scrapper instead of using a webdriver then?

modest maple
#

Sadly the scraper need the webdriver to work

#

Was originally using Chrome till we found the lovley issue that the chrome drivers don't close when the page gets closed

quartz kindle
#

i mean, cant you just use an http request and an html parser?

modest maple
#

Possibly? I'd have to double check

#

I use selenium as my main module for scraping data etc...

quartz kindle
#

i heard about it but i've never used it

modest maple
#

I personally love it

#

It's amazingly simply yet unbelievably powerful

quartz kindle
#

but if it is as resource hungry as it appears to be, its probably better to switch

modest maple
#

Probably

quartz kindle
#

i mean, i dont think selenium was designed for production in the first place

#

its more like for testing environments

modest maple
#

Surprisingly for python atleast it's main function is web scraping

#

But probably not on the scale this uses it

#

Still

#

Doing a command then getting a response on average in under a second is still pretty good going

quartz kindle
#

if you're using it anyway, why do you need several of them? cant you use the same instance for all websites?

modest maple
#

Each site has its own seperate stuff that's cached as sometimes caused interference

#

And increased the load times

#

So it was better to sacrifice on ram savings but loose time it takes to load

quartz kindle
#

ah i see

#

welp, you can make a test using http requests directly and monitor its performance

modest maple
#

Yh

#

See how it goes

#

Most of the ram is from the DMV site but ig that's cuz it's gotta load a unique specific URL and then add the .orcbrews too it

#

And the website is a lil underpowered atm

quartz kindle
#

from my own results, http requests done from a vps is more than fast enough, latency-wise

#

even without caching

modest maple
#

Fairs

#

I'll see how it goes tomorrow

#

If it seems like it's gonna be a big issue to switch over I might not do it

#

As on average the ram usage is tolerable just occasionally the system uses alot

quartz kindle
#

yeah well, plan B is always "throw more ram at it"

modest maple
#

Yh xD

#

Just waiting for black Friday and cyber Monday xD

quartz kindle
#

haaha

#

careful not to be scammed

modest maple
#

Yh

#

Amazon tbf are pretty good on BF

#

Last year got 16GB for half price so was a good deal

quartz kindle
#

nice

modest maple
#

Anyway I'm gonna go to sleep for now

#

Cya

#

On a side note I think I'm gonna run out of storage before I run out of ram actually

#

XD

quartz kindle
#

lul cya

native cypress
#

Hi

hoary elm
#

So I am looking for way a basis to work off of for a command that I can run and will tell me how many times a command was used since last restart.... I am coming here because well idk how to start it I have tried linking it to my command handeler but failed

sudden geyser
#

@hoary elm what language.

hoary elm
#

Node

sudden geyser
#

Not a language, but good enough.

Save an object (or some list of commands you have) and set the number of uses to zero. Increment it for every use.

hoary elm
#

Lol JavaScript... Sorry, running on very little sleep

#

And okay

amber quiver
#

hi

earnest phoenix
#

If i have the ping 140.5
How to delete the . and after the .?

scenic kelp
#

if you want rounding you can use toFixed(0)

#

you could also just .split('.')[0] for no rounding

earnest phoenix
#

Ty

scenic kelp
#

note toFixed only works on Number, not on String

earnest phoenix
#

:/

scenic kelp
#

do typeof(client.ping) real quick

earnest phoenix
#

Hmmm

#

Number

scenic kelp
#

okay then use toFixed

earnest phoenix
#

Okay

#

Ty

scenic kelp
#

np mate

earnest phoenix
#

^^

halcyon ember
#

i need help again bois

#

how do make this work

vital lark
#

make what work

halcyon ember
#

say i message !say Hi

vital lark
halcyon ember
#

how do i make the bot respond whatever i say after the (prefix+"say")

vital lark
#

you need to slice the prefix and the command name and get the values as an array

halcyon ember
#

example plesae

#

i dont speak javascript hepl me lmao

#

im new to discord.js sorry

#

xD

scenic kelp
#

JS is not Java

halcyon ember
#

whatever it is

#

javascript

scenic kelp
#

Also not to be rude but please get a basic understanding of the language before asking for help

halcyon ember
#

yes i am much new to javascript

#

dont know anything to do with it other than minecraft stuff

#

xD

scenic kelp
#

Once again Javascript is not the same thing as Java

#

They are two totally different languages

halcyon ember
#

huh

#

sounds the same to my small brain

earnest phoenix
#

When vote rest ?

scenic kelp
#

The name of Javascript is quite confusing considering they're not even the same type of languages. Java is a stongly typed object oriented lang whereas JS isn't strongly typed and is prototype oriented

halcyon ember
#

ah

#

ok

vital lark
#

@earnest phoenix votes reset every 1st day of the month

earnest phoenix
#

@vital lark time ?

halcyon ember
#

anyway for now i still need help with js

vital lark
#

every 1st day of the month (ex: December 1st)

halcyon ember
#

how do u set whatever a user replys after a command like !test <hi> how do u change the <hi> into a array

earnest phoenix
#

@vital lark time. like hours or minutes

valid frigate
#

what is the best way to incorporate localization in kotlin? i'm thinking of enum but not sure exactly how to do it (translating to korean/english and vice versa

halcyon ember
#

ugh

#

google is better than asking yall no offence

scenic kelp
#

Yes because as I previously said

#

you need to have a basic understanding of the language

valid frigate
#

not very kek but hey august come see if this works

enum Translation(val en: String, val kr: String) {
    HELLO("hi", "korean hi lol")
}
#

to be fair, you should come here with specific help that doesn't already have an answer on so or something

scenic kelp
#

You're setting yourself up for trouble if you don't know the gist of the language. @halcyon ember

valid frigate
#

language specific questions are fine, but if it becomes clear that you don't know the lang use google.com

halcyon ember
#

ok

#

cant find the answer for this on google

#

how do you add a variable in a .setDescription on RichEmbed

valid frigate
#

?????

halcyon ember
#

like .setDiscription('hi <var>')

valid frigate
#

string interpolation

halcyon ember
#

<var> being a variable i declared earlier

valid frigate
#

`${var}`

halcyon ember
#

oh

#

thanks

valid frigate
#

very useful yes

halcyon ember
#

@valid frigate

valid frigate
#

this has everything on taht type of string

#

highly recommended read

halcyon ember
#

ooh

#

thanks

#

btw

#

how do u track number of messages in a channel

#

@valid frigate

valid frigate
#

read the docs

halcyon ember
#

like this is how i have it

#

let messagecount = numberofmessages var numberofmessages

valid frigate
#

??

halcyon ember
#

but the variable shows up as undefined

#

like now it shows

#

but its undefined

#

.setDescription('Successfully purged '+numberofmessages+' messages')

#

i got it to display variable

valid frigate
#

??

#

well

#

it looks like you didnt read the docs dude

#

also it means that numberofmessages is undefined

halcyon ember
#

bruh moment

#

my brain tuned out on the docs i needa sleep xd

slender mountain
#

Waitwaitwaitwait

#

Is that light theme

halcyon ember
#

else if(message.author.id !== "430117093573394442"){ message.channel.send(embedNoPerm) i have this

#

but when on a alt i try the command this is attatched to it starts spamming the NoPerm embed

modest maple
#

Cuz there's no command check it looks like it's just checking everytime a user talks

halcyon ember
#

o

#

how do i do dat

#

i am newb on js

#

kthx gotta sleep cya

restive furnace
glacial lynx
#

Hey I need help.

small prairie
#

@glacial lynx node index.js

glacial lynx
#

Okay one second

small prairie
#

@glacial lynx Delete that picture

#

It shows Yur Token

#

Your*

glacial lynx
#

oops

#

let me regnerate

#

the token

small prairie
#

And I might Recommned You to Reset The token

#

Yeah Cool

glacial lynx
#

i did it

small prairie
#

@glacial lynx Cool be careful next time btw

#

Working?

glacial lynx
#

Wait

small prairie
#

k

glacial lynx
#

nope

#

I mean everything is fine

#

And he can't get online

#

Another idea?

#

@small prairie Should I change software?

small prairie
#

Did you ch ange token in bot files?

glacial lynx
#

What do you mean?

#

@small prairie I changed him from the developer site and in VSC.

small prairie
#

Whats Your code??

glacial lynx
#

What do you mean?

#

I'm pretty new in all this stuff.

small prairie
#

DM me Your screenshot

glacial lynx
#

Alright

trail swift
#

Hey bois

earnest phoenix
#

Why does my bot collect logs from every server

#

I have access to everything that was said here

quartz kindle
#

its your bot, you should know

grizzled jackal
#

Idk man, did we write it?

earnest phoenix
#

hi how to make any bot or which bot makes something add to someones username for example [P] OFF-WARD

#

instead of OFF-WARD

#

psl tell

#

i want to make very pro server and is my first yes

vital lark
#

you need to set the user's nickname to it

earnest phoenix
#

but there is a bot that makes it

#

im 100% sure

vital lark
#

not that I know of

earnest phoenix
#

my friend has htis bot but he doesnt want to tell

#

ill tel u names of bots on his serer

#

Rythm dank memer discord server list discord servers donate bot dyno giveawaybot greenboy invitemanager mee6 reactions roles statbot tatsumaki xenon

#

i think its statbot

#

but not sure

#

i wotn get the answer anywhere : (

modest maple
#

Just look up the help command for the bots

#

It'll either be mee6, Dyno or statsbot

cursive gale
quartz kindle
#

that makes no sense

#

is that all there is on line 6?

#

but like, if you're only doing that on 2 items, you might as well just do it in two lines instead of using a loop

earnest phoenix
slender thistle
#

What is val

solar wraith
#

C++ and discord bot development dont mix lol

quartz kindle
#

why not? c++ is used almost everywhere

modest maple
#

CPP is fine

#

If you know how to code it and actually read the docs

#

¯_(ツ)_/¯

#

Also @earnest phoenix gonna need more info?

earnest phoenix
#

no, : )

native cypress
#

Hi

modest maple
#

Okay well then don't ask next time xD

#

Hi

charred loom
#

why am I not going to put the description in the bot, that is, I do it with embed.setDescription (), etc., but it does not appear in _help (the bot command)

past pike
#

do you use javascript?

modest maple
#

Have to created a new rich embed

charred loom
#

discord.js

#

ok

past pike
#

try this:
let Embed = new Discord.RichEmbed()
.setDescription("Your Text")

charred loom
#

ok

past pike
#

and then:
message.channel.send(Embed);

charred loom
#

ok

past pike
#

oh you use it as Function

native cypress
#

Hi

past pike
#

i use it as message

#

then you don't get the error

charred loom
#

how

past pike
#

if you do like this it should work. (no function needed)
client.on("message", (message) => {
if (message.content.startsWith("help")) {
let embed = new Discord.RichEmbed()
.setDescription("Your text here")

message.channel.send(embed);
}

});

grizzled jackal
#

bruh just define discord

past pike
#

btw i have also a question. I'm making a mute command but it seems not working. If i would like to mute someone, the bot says undefied and unmute the user instantly.
Here is the script i made after i learned to not copy codes:
https://paste.mod.gg/igakebutuk.js

crystal salmon
#

anyone here using JDA for his bot?

quartz kindle
#

he doesnt need to get it from Discord

#

the problem is most likely something else and he needs to show his code, dont tell him "do X" without seeing his code first

past pike
#

i did try to help him

charred loom
quartz kindle
#

see, now hes trying to randomly add what you told him without context lol

charred loom
#

:)) ok

#

delete

#

done

past pike
#

then i don't help people anymore. fine

quartz kindle
#

you help but always ask for code first

#

whats your original code Ciprica?

past pike
#

not every code

charred loom
#

if you delete const info = client.categories          .map (cat => stripIndents`` ** $ {cat [0] .toUpperCase () + cat.slice (1)} ** \ n $ {commands (cat)} ``)          .reduce ((string, category) => string + "\ n" + category);
It's going to put embed.addDescription , but I want everything

past pike
#

tim don't give arguments that are not true

charred loom
slender thistle
past pike
#

yes but what tim said was not necessary

quartz kindle
#

@charred loom console.log(info) after your reduce function

crystal salmon
#

damn why 90% people here use JS

quartz kindle
#

see what appears in your console

grizzled jackal
#

The one thing i'm learning from this is that I don't have the patience to teach people

charred loom
#

ok

twilit rapids
#

move the embed.setDescription(info) outside of the .send() and put it above it

#

and send embed

fossil frigate
#

I dont like his code layout

crystal salmon
twilit rapids
#

Could be better, but should work

charred loom
#

ok

quartz kindle
#

if we judged code layouts, we would be flaming each other 24/7

crystal salmon
#

his layout says I just copy/paste code here so whatever

vital lark
#

also the stripIndents is wron

twilit rapids
#

Let's not judge layout here

quartz kindle
#

lets focus on the actual problem

modest maple
#

Everyone has their own styles

#

And indeed

past pike
#

i use await messages in js. works fine

fossil frigate
#

I mean true, but it will be a pain later

quartz kindle
#

a pain that must be experienced

last ferry
#

is there a way to remove all reactions for a specific emote on a message besides looping through each reaction user and deleting it in discord.net

quartz kindle
#

in order to grow

last ferry
#

i know theres a RemoveAllReactions() function but i want to remove just a specific emote not all of them

modest maple
#

Can't u just pass it reaction?

quartz kindle
#

the api doesnt have an endpoint for that unfortunately, unless its not documented

last ferry
#

so the only viable way is going through one by one?

charred loom
#

@twilit rapids a example, because it does not come out

quartz kindle
#

they have
DELETE/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me
DELETE/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}
DELETE/channels/{channel.id}/messages/{message.id}/reactions

last ferry
#

rip

quartz kindle
#

the function you want would be DELETE/channels/{channel.id}/messages/{message.id}/reactions/{emoji}

#

if it exists, its not documented

last ferry
#

yeah so close yet so far xd

quartz kindle
#

xd

last ferry
#

whatever ill try and figure something out

earnest phoenix
#

you will have to remove one by one

#

even the official client has to do it like that

last ferry
#

thats true i guess

modest maple
#

Would be a better idea just to disable emoji adding

#

Nd manually clear it

#

As for you is just right click n clear reactions

charred loom
#

"move the embed.setDescription(info) outside of the .send() and put it above it
and send embed"
Example please?

vital lark
#
message.channel.send(embed)
charred loom
#

ok

slender thistle
#

I don't think .setDescription really returns anything

vital lark
#

@slender thistle it returns the embed class

#

to chain itself

late hill
#

It returns the embed

#

yes

slender thistle
#

The one with description?

vital lark
#

yea

slender thistle
#

well rip my hopes and dreams

charred loom
#

_help

vital lark
past pike
#

now i have my own script for muting people, does it still not work -_-

native cypress
#

Still have not verified my bot

fossil frigate
#

This is rip

#

If you can try keeping your embed stuff in one place it will make it way easier later

#
                .setDescription(`${user.username}'s Avatar:`)
                .setImage(user.displayAvatarURL)
                .setAuthor(message.author.username)
                .setColor(0x00AE86)
            return message.channel.send(embed);
        });```
past pike
#

this is why i hate coding sometimes, no error but bot responds with undefined

slender thistle
#

JS be like

past pike
#

and now i need to figure out why i get undefined

#

with no other errors

fossil frigate
#

Idk how to do code blocks from phone lol

slender thistle
quartz kindle
#

console.log() your variables to see why it returns undefined

past pike
#

i will try that

fossil frigate
#

Aha i found it, it was a subkey `

vital lark
#

also it's TextChannel#send

#

message.channel.send(<content>)

quartz kindle
#

i made a message.send method lol

vital lark
#

oh

#

ok

#

nvm

fossil frigate
#

I just typed it wrong in my code block

quartz kindle
#

but yeah, it doesnt exist on default d.js

past pike
#

if i use console.log command it says: d

#

that's only what i get

quartz kindle
#

what were you expecting to get?

past pike
#

why the bot says undefined when i am trying to mute someone

quartz kindle
#

i mean

#

your variables

#

you should have a general idea of what data they contain

#

for example if a variable you made to hold someone's user id, you should know that it should contain a user id, and you can console.log it to make sure it actually has a user id like you expect it to

#

so console.log your variables to make sure they hold the correct data as you made them

#

or if there is anything unexpected going on

past pike
#

ah now i get a result with console log

#

lets take a look

#

my argument is null he says

quartz kindle
#

that still doesnt help, so debug further until you can recognize what your code is doing

past pike
#

i logged now the ms command

grizzled jackal
#

` let messageArray = message.content.slice(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);

let mutetime = args[1];`
That's what he's trying to do. I dont have the patience to explain it to him

past pike
#

i'm going to try log other things

#

i think the problem is args

grizzled jackal
#

You're getting warmer yes

past pike
#

i downloaded now visual studio code so he gives me options which i can use

earnest phoenix
#

if vsc is he

#

then vs is she

#

🤔

modest maple
#

🤣

grizzled jackal
#

angeryBOYE how dare you assume its gender

modest maple
quartz kindle
#

and what is sublime?

slender thistle
#

an attack helicopter?

quartz kindle
#

they/them or it?

#

lul

grizzled jackal
#

A zenxzio or some shit like that LMAO

past pike
#

and now my whole script doesn't work -_-

quartz kindle
#

at least you know your changes are working

past pike
#

i mistyped a letter lol

slender thistle
#

Positivity :wesmart:

quartz kindle
#

my worst nightmare has always been when i change stuff and the code behaves like i didnt change anything

#

happened lots of times due to dns caching

slender thistle
#

Like yesterday when my VS went to full shit somehow

earnest phoenix
#

happened lots of times due to dns caching
literally my worst nightmare

#

dns caching was happening at my ISP's level and i was wondering why my content changes didn't work at all

quartz kindle
#

yeah

#

even disabled all forms of local cache didnt work

past pike
#

now i thought it is going to work but nope

earnest phoenix
#

learn how to debug

#

not everything is going to work first try

#

step into your code and inspect where's the issue

quartz kindle
#

make it work one step at a time

past pike
#

i already know one let command is wrong, but i am not sure which one

quartz kindle
#

for example
"when the code reaches this point, these variables should contain the user id and a proper time in milliseconds, lets put a console.log here logging them, and fix the code until this part works. then move on to the next part"

past pike
quartz kindle
#

thats mostly for debugging compiled code, js doesnt need that

cerulean salmon
#

how to get an user object via discord tag in discord.js

earnest phoenix
#

filter through the users collection

#

keep in mind that it only keeps cached users

#

there's no actual way to get a user by the tag

cerulean salmon
#

or by username ?

earnest phoenix
#

again, same

#

you might even get multiple users if you filter by username

#

it's safer to filter by username & discriminator

past pike
#

what the hell now he says args is not a function

#

but i haven't changed something

#

this is more difficult then i thought

cerulean salmon
#
var k=client.users.get("647445284342726686");
#

returned " undefined "

mossy vine
#

is that code outside of the ready event

#

oh wait

#

likely the user isnt cached

cerulean salmon
past pike
#

i am at a point to remove the whole command. i changed the code but still it gives undefined

grizzled jackal
#

Well carefully read/examine what your code does from start to end

#

and like they said, console log the variables to see that they contain what youd expect them to contain

past pike
#

i used different console logs but still don't know what the problem is

grizzled jackal
#

I'll give a hint where to start
This line of your code let messageArray = message.content.slice(" ");

mossy vine
#

thats about as helpful as saying start at client.on('message'...

grizzled jackal
#

If you're so eager to help, do it yourself

mossy vine
#

im only here to criticize /s

grizzled jackal
#

And that's your problem :^)

mossy vine
#

at this point i dont even know what "gives undefined"

past pike
grizzled jackal
#

It's his time variable

#

let mutetime = args[1];

mossy vine
#

what is ms?

grizzled jackal
mossy vine
#

args[1] is the user mention

grizzled jackal
#

It's not

#

I gave him the hint earlier and you probably overlooked it

past pike
grizzled jackal
#

but if you console log his variables

#

you end up with this

past pike
#

so i need to log args?

valid frigate
#

are you perhaps

#

setting a message event listener for every event received somehow

earnest phoenix
#

i'm pretty sure they're just listening for the event for each command

#

which like

#

why

vital lark
#

memory leaks

past pike
#

that is not the problem for now

brittle pasture
#

hi i brought a bot from Tbjbu2#0001 last week.
and his bot and server is banned from top.gg due to his misconduct(i think?)
i already email to appeals@dbots.zendesk.com but it says it take up to 3 working days.

So i try ask here,first.
Is it possible to get the bot and server unbanned?
as i am not related to the previous owner.
sorry if this is not the right place to ask this

modest maple
#

If he was the original owner of the bot and the one who listed it on the site it probably isn't comming back

brittle pasture
mossy vine
#

unless the appeal is successful

modest maple
#

Yh nah he isn't gonna get let back

#

He was warned multiple times got alot of warns and massively abused the system

brittle pasture
#

but the bot have a change of owner,so i hope they will allow it.

#

as i am the new owner

loud salmon
#

@brittle pasture We are not going to be letting the bot back onto our site.

brittle pasture
#

but i did nothing wrong worryrip

loud salmon
#

¯_(ツ)_/¯

#

thats just our existing policy here

modest maple
#

And also

#

The bot n that got banned back in April

#

Like you should of checked before you brought the bot if it on the site or if It got banned

#

If you had known it got removed and the original owner got banned why buy it

brittle pasture
#

he told me if i appeal most likely will have no issue keksplosion

modest maple
#

Should of looked up the reason for his ban

loud salmon
#

🤷 sorry

brittle pasture
#

really cant give me a chance?

loud salmon
#

no. Its been our policy in the past, I don't believe we are going to change it.

modest maple
#

The dude rlly fucked you I'm afriad

brittle pasture
#

i mean his crime isn;t mine

modest maple
#

Best you could do is make a new bot

loud salmon
#

oh i forgot about that lmAO

brittle pasture
loud salmon
#

nah making a new bot wont work @modest maple

modest maple
#

Well ZX can make a new bot themselves

#

Not saying copy the code

earnest phoenix
#

shave your head, change your identity, move to hawaii and start over

modest maple
#

I'm saying if you want to own a bot and list it make it yourself so you can maintain it

brittle pasture
#

wut even new bot wont work?

modest maple
#

If you program it new it'll be fine

#

But you gotta understand

#

If you can't program it what u gonna do if there's a update

loud salmon
#

chillfish is taking this out of context

#

and trying to help

#

when its not needed smh

modest maple
#

Reee

#

I mean if they want a bot on DBL so bad they can program one

brittle pasture
modest maple
#

F

brittle pasture
#

wonder if the other voting site even useful

modest maple
#

idk

#

depends if he got banned from there aswell xD

#

but thats nothing todo with DBL

brittle pasture
#

he using the other site worryjuice

loud salmon
#

there are like 12 other botlists lul

#

if you mean discordbothub

quartz kindle
#

speaking of which, i've lost track on what lists my bots and servers are in

loud salmon
#

then thats his own site

#

¯_(ツ)_/¯

quartz kindle
#

it will be a pain in the ass to find them all and remove the listings

modest maple
#

F

quartz kindle
#

one of my servers has half a dozen bots for server listing, but idk what lists they are from

#

lmao

loud salmon
#

gg

quartz kindle
#

good thing that most people migrated to dbl/top, so now you dont need to maintain 2353452 listings anymore

slender thistle
#

bad thing is most of those bots are straight up copies but that's another story :^)

modest maple
#

yh

#

they all want to be the next mee6 that does everything

#

so they just copy moderation code and other stuff and slap it together

quartz kindle
#

welp, let them try

modest maple
#

on an actual note:

Anyone got any experience using Google Drive API with python?

quartz kindle
#

they'll give up after a few months probably

modest maple
#

most of the bots dont even run 24/7

#

or use glitch

past pike
#

glitch is shit

quartz kindle
#

i wonder how many thousands of dead bots are listed rn

slender thistle
#

eh... probably 1-2k

past pike
#

glitch is most time down or it does not start the bot (that's the problem i had)

modest maple
#

cuz its not designed for bot hosting

quartz kindle
#

thats most likely a code problem, not a glitch problem

past pike
#

nope

quartz kindle
#

as bad as glitch is, if your code is good, even glitch will run it

past pike
#

i moved to Heroku and now everything runs fine

modest maple
#

Heroku is still not good

#

idk if you use python or not

#

but if you do

past pike
#

i use javascript

modest maple
#

there is a dedicated essay on the issues with heroku

#
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request

# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']

def main():
    """Shows basic usage of the Drive v3 API.
    Prints the names and ids of the first 10 files the user has access to.
    """
    creds = None
    # The file token.pickle stores the user's access and refresh tokens, and is
    # created automatically when the authorization flow completes for the first
    # time.
    if os.path.exists('token.pickle'):
        with open('token.pickle', 'rb') as token:
            creds = pickle.load(token)
    # If there are no (valid) credentials available, let the user log in.
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        # Save the credentials for the next run
        with open('token.pickle', 'wb') as token:
            pickle.dump(creds, token)

    service = build('drive', 'v3', credentials=creds)

    # Call the Drive v3 API
    results = service.files().list(
        pageSize=10, fields="nextPageToken, files(id, name)").execute()
    items = results.get('files', [])

    if not items:
        print('No files found.')
    else:
        print('Files:')
        for item in items:
            print(u'{0} ({1})'.format(item['name'], item['id']))

if __name__ == '__main__':
    main()```
#

ahhhhhhhhhh

quartz kindle
#

lmao

modest maple
#

fuck Gdrive api man

past pike
#

i have no problems with Heroku

vital lark
#

no

quartz kindle
#

i do

vital lark
#

vscode

modest maple
#

Pycharm

quartz kindle
#

i use sublime text 3

vital lark
#

I use VSCode, IntelliJ, and Rider

quartz kindle
#

lmao

#

google for html a tags

#

urls should be placed in <a>

#

<link> is for linking resources, such as js and css files

#

anyway, whats the actual problem you have?

mossy vine
#

yeah look up <a> tags

quartz kindle
#

thats exactly what an <a> tag will do

slender thistle
#

imo Google API python wrappers are hard, but then again I never worked with Google APIs

quartz kindle
#

google drive api in particular is hard

#

because it needs to have so much security and shit

slender thistle
#

Judging by the code snippet above, I can't disagree

quartz kindle
#

what did you write?

#

lol

#

i told you to google it

#

obviously you didnt

slender thistle
#

Has anyone worked with CLion?

mossy vine
#

no but ive heard its pretty good

earnest phoenix
#
<p> <?php echo json_encode($_SESSION['guilds']); ?></p>
#

How do I filter the servers that only the administrator has?

quartz kindle
#

only administrator has? what do you mean?

earnest phoenix
#

Only manage_guilds

#

I'm doing a PHP Discord bot panel

#

for @old oak

charred loom
glacial mango
#

How do I save an image to local?

loud salmon
charred loom
#

yes

#

example

grizzled jackal
#

lmao

modest maple
#

welp from reading above

#

im facked

#

slowly we will get there

#

atleast ive got it listing files stored

#

and can acsess files

#

but pguihdaguahd

charred loom
mossy vine
#

Discord is not defined

quartz kindle
#

find the differences

fluid widget
charred loom
#

help?

fluid widget
#

@earnest phoenix

slender thistle
charred loom
#

@quartz kindle
and what do i do? help me?

slender thistle
#

Anything correct is marked with green

#

anything incorrect is marked with red

#

Apply common sense to replace incorrect with correct

charred loom
#

yes, and how they do

#

without Discord.?

slender thistle
#

Try it

quartz kindle
#

@_@

copper cradle
#

that code is from the internet isn't it?

#

I mean

#

if that's your own code then you'd know why it isn't working

native cypress
#

Hey why are my bots not online

#

The bots I made are not online

copper cradle
#

show your code and the error

#

@native cypress

native cypress
#

What code

copper cradle
#

there it is

#

what did yoy expect to happen

#

the bots you just made won't go online by magic

#

you have to code 'em

#

you can learn to code online

native cypress
#

Where I start

copper cradle
#
#

there

#

find a language

#

then learn that language

loud salmon
#

@copper cradle OI

#

stop being a cunt

#

pls

#

its getting excessive

blissful scaffold
#

@native cypress do you know any programming languages?

copper cradle
#

Bruh

loud salmon
#

i would take a look at the highlighted area

native cypress
#

K

#

I read it now I go to that website

loud salmon
#

ok

native cypress
#

What happends when I’m there

loud salmon
#

you read it

#

and you need to learn how to actually code

#

its a skill that needs to be developed

native cypress
#

K

loud salmon
#

not something you can do in an hour and be done with it

native cypress
#

Where I learn how to code

loud salmon
#

no

#

bad

blissful scaffold
#

Ah, I had not really read it, I will remove the link

loud salmon
#

how old are you btw? I can get some guides that would be suited to your age group

native cypress
#

Which node.js do I download

loud salmon
#

just go on that website and sign up so you can start to learn how to code

glacial mango
#

Can I pick a random file from a folder?

vital lark
#

yes u can

#

read the directory and randomize the files

glacial mango
#

Do you have a code for example?

loud salmon
#

no, we dont spoonfeed here

#

look at your language docs to figure out how to read a directory

#

then get a list of the files in the directory

#

then pick a random file using your languages randomness

grizzled raven
#

hint, fs.readdir returns an array of every file in a folder 😎

glacial mango
#

I tried this

var fs = require('fs');
var files = fs.readdirSync('/resources/');```
#

But gives me this error:
Error: ENOENT: no such file or directory, scandir '/resources/'

grizzled raven
#

lol idk much about fs

#

but try fs.readdir('./resources/');

#

wait no youre ok actually

#

just the input is invalid

glacial mango
#

How do I know what the right input is

grizzled raven
#

do ./resources/ instead

#

if the folder is not in any other folder

glacial mango
#

doesn't work

#

gives undefined

grizzled raven
#

try fs.readdir('./resources/');

glacial mango
#
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function```
grizzled raven
#

var files = await fs.readdir('/resources/');

#

idk

#

that is what i did

#

kinda

#

no nvm it is what i did

native cypress
#

I’m back

#

From that coding program learning

glacial mango
#
SyntaxError: await is only valid in async function```
#

TheNoob^

native cypress
#

So can I program my discord bot I made now

vital lark
#

@glacial mango need to add an async keyword in the callback

glacial mango
#

I don't know where the callback is

vital lark
#

did you add the callback in readdir

#

Might wanna use readdirSync to do it without the callback

#

so like readdirSync(path) which returns an array of files

quartz kindle
#

thats what he was using already

#

the problem is has nothing to do with async or callbacks, just that it cant find a folder named "resources"

vital lark
#

oh

quartz kindle
#

fs.readdirSync('/resources/'); is correct, but keep in mind the following:
/resources will look for a folder called "resources" in the root directory, not the current directory
./resources will look for it in the current directory
../resources will look for it in the previous directory

vital lark
quartz kindle
#

because he told him to use await fs.readdir('/resources/'); lol

vital lark
#

oh ok

quartz kindle
#

which is wrong eitherway because readdir() is not a promise, unless you promisify it first

vital lark
#

I guess I kinda misinterpreted that GWovoRaphiXD

abstract crow
#

What are your must haves for development? Curious and kinda wanna use new stuff

mossy vine
#

a brain

#

a computer doesnt hurt either

#

a serious answer would be vim keybindings

abstract crow
#

Lol. I’ll try some vim stuff

mossy vine
quartz kindle
#

for me, a must have is sftp integration

#

for auto-upload on save

scenic kelp
#

^ absolutely

mossy vine
#

isnt that just writing code on prod with extra steps

quartz kindle
#

well, yeah but what are the extra steps?

mossy vine
#

the transfer

#

¯_(ツ)_/¯

quartz kindle
#

would you prefer coding inside an ssh terminal?

mossy vine
#

yes i do that sometimes

quartz kindle
#

ew

#

lmao

mossy vine
#

:(

scenic kelp
#

That or just do it locally then open WinSCP or something and move them over there

#

but it's much more hassle

quartz kindle
#

i mean, coding on ssh is like coding with lag

#

keyboard lag lmao

mossy vine
#

i experience more lag on school pcs and those dont even have any connections theyre just bad

quartz kindle
#

lmao

scenic kelp
#

I mean tbf the latency on SSH isn't really noticeable at least to me

quartz kindle
#

its very noticeable for me

#

the faster you type, the worse it is

scenic kelp
#

Yeah

vital lark
#

I would use postman for rest apis

scenic kelp
#

Then again it differs for everyone. I find that I can see it, but it's not really too bad unless I'm typing rather fast

quartz kindle
#

also depends on your location, its not that bad if you live in the same country as your vps for example

scenic kelp
#

yeah exactly

mossy vine
#

its a bit noticable but not too bad for me

scenic kelp
#

I live in the same country as my VPS so it's < 100ms there and back

#

at least when my internet isn't dying

quartz kindle
#

another issue is hotkeys

#

you cant really use them with ssh

scenic kelp
#

I really wish windows explorer natively supported SFTP tho

#

it supports FTP but not SFTP for some reason

quartz kindle
#

ye

scenic kelp
#

I'm just so used to Explorer that any non-native one running on Windows feels off

quartz kindle
#

there are software that can do that tho

#

map an sftp connection as a network drive

scenic kelp
#

Yeah

#

which I might actually use lul

quartz kindle
#

until you get hit by a crypto virus and it affects your network drive

#

lmao

scenic kelp
#

Couldn't you just have it so that you have to type in your password every time tho?

#

Unless you use keys huh damn

quartz kindle
#

yeah but how would that work if you're gonna edit a file directly on it

#

is it smart enough to keep a session open only for that file?

scenic kelp
#

Yeah nvm

mossy vine
#

does the discord api give me an error if a message embed cant be dispalyed because no perms

scenic kelp
#

Well the solution to that is not to get a crypto virus

quartz kindle
#

nice typos/edits

#

you get a perm error if you dont have embed links permissions i think

tawny panther
#

does anyone know how to add a Status on to a discord.py bot?

mossy vine
#

read docs

modest maple
#

It legit on the 'comonly asked questions' page

#

Smh

short ocean
#

im getting a 'm3u8stream/lib/parse-time' module not found

#

Theres no redirect to the file where the prob is

#

Ping me once asnwered

#

Pls and ty

modest maple
#

code? @short ocean

short ocean
#

Its the music code but in many different filea

#

files

modest maple
#

bruh

#

there are like

#

4 or 5+ music programs

short ocean
#

Ytdl core

modest maple
#

and what language

short ocean
#

ja

#

F

#

Js

earnest phoenix
mossy vine
#

its open source so you could probably write an implementation of it

short ocean
#

@earnest phoenix idk lmao

earnest phoenix
#

But I don't understand too much python

modest maple
#

ik theres a module

#

i cant for the life remeber the name

vital lark
mossy vine
earnest phoenix
#

No anguwu

vital lark
#

oh

earnest phoenix
#

MMmh i will test this

vital lark
#

table does the same thing

#

but Shrug

earnest phoenix
#

But this use console log

vital lark
#

you can just console.log(table)

mossy vine
#

yeah you can configure table to use custom chars

earnest phoenix
#

Yup

#

@mossy vine good idea ty

grizzled raven
#

oh yeah

#

stupid me

#

i promisified the fs.reeddir

#

but it doesnt matter anymore lol

earnest phoenix
#

!help

tacit stag
#

my bots like not connecting at all for some reason

#

it usually works fine, but now it just cant login

high anchor
#

is there a bot login rate limit? I'm getting "shard took to long to get online"
discord.js

tacit stag
#

so it might not be me then?

#

could be a buncha people

high anchor
#

yeah

#

mine too

#

might be API downtime

mossy vine
#

api might be shitting itself

high anchor
#

possibly

mossy vine
#

got a connection issue on mobile a few minutes ago

high anchor
#

ill try regenning my token

#

discord developer portal is inaccessible

#

api is shitting itself yeah

#

my already logged in bots are functioning fine

tacit stag
#

yup. i was just running some tests on my bot, tryna log it back in, and just couldnt

high anchor
#

portal working again, regenned my token and now my bot can login again @tacit stag

tacit stag
#

just tried to login again. thanks 🙂

high anchor
#

np

earnest phoenix
#
let tchf = guild.channels.filter(c => c.type === 'text');
    if (tchf.size > 0) {
        client.guilds.map(g => 
            if(humains < 5) return await tchf.first().send(`:flag_fr: Le serveur n'a pas un minimum de 5 membres\n:flag_us: The server does not have a minimum of 10 members`) && await client.guilds.get(guild.id).leave()
            
    }```

It doesn't work, how do I do it? :/
atomic quarry
#

So how do I keep my Bot online

#

Because my bot won't turn on

sudden geyser
#

You're trying to use await in a function that's not async. Make it async.

loud salmon
#

@atomic quarry you need to code your bot to make it online

earnest phoenix
#

No wait

atomic quarry
#

@loud salmon I know that I have it coded but the code isn't working so well

loud salmon
#

ah gotcha

atomic quarry
#

Would you like to see what I have?

loud salmon
#

uh yea, post the specific issue that you're having

#

and then someone may come along and help

atomic quarry
#

Ok

earnest phoenix
#
ers`) && await g.leave()
                ^^
SyntaxError: Unexpected token if
client.on('message', async (message) => {
    if (message.content.startsWith(`${prefix}cg`)) {
        if(message.author.id == config.owner){}else{return;}
        const total = guild.memberCount;const bots = guild.members.filter(m => m.user.bot).size;const humains = total - bots;

        let tchf = guild.channels.filter(c => c.type === 'text');
        if (tchf.size > 0) {
            client.guilds.map(g =>
                if(humains < 10) return await tchf.first().send(`:flag_fr: Le serveur n'a pas un minimum de 10 membres\n:flag_us: The server does not have a minimum of 10 members`) && await g.leave()
            )
        }
}
});```
sudden geyser
#

oh god

scenic kelp
#

put them in a {} @earnest phoenix

earnest phoenix
#

Okay okay

#

Don't kill me please

scenic kelp
#

you can't use ands to chain statements unless there's some extremely odd thing I'm not aware of

earnest phoenix
#

Oh okay ty

earnest phoenix
#

Guys anyone know about all ytdl audio quality type's ? i need all like highest, lowest etc.

amber fractal
#

taken right from the ytdl-core npm page

earnest phoenix
#

@amber fractal there is only two types for audio highest or lowest

amber fractal
#

did you read the itags part

earnest phoenix
#

@amber fractal yes but still didn't find anything there

atomic quarry
#

@loud salmon I fixed my code and I have one command Now!! 🙂 🙂

#

sorry for the ping

earnest phoenix
charred loom
sick cloud
#

@charred loom why are you using .setDescription in thin air

#

there's nothing to use it on

#

you need to add embed or whatever your embed constructor is defined as

#
embed
.setDescription()
.etc
charred loom
#

ok

#

@sick cloud help me with example for me?

sick cloud
#

i gave you an example

charred loom
#

well it doesn't work

sick cloud
#

you're just randomly putting .setDescription in your code

#

of course it won't work

charred loom
#

but

sick cloud
#

because you need to put something in front of the function to use

#

ie. an embed

charred loom
#

ok

sick cloud
#

move the embed code to below the setColor or add embed in front of setDescription

#

that might help

charred loom
#

ok

glacial mango
#

Can I let my bot have multiple prefixes?

thin acorn
#

what's the estimated time to get your bot approved?

lunar crystal
quartz kindle
charred loom
#

done

#

it works now, thanks

marble juniper
#

since you can make multiple fields

#

you don't set them

#

but you add one

#

simple if you think logical

grizzled raven
#

@charred loom also, remove the backticks from the description

#

footer*

marble juniper
#

or

#

${}

#

but that would be usless

#

so remove them

grizzled raven
#

${} would confuse him xd

#

also no dots

#

smh

marble juniper
#

why

#

its ez

#

you just put it in those brackets

grizzled raven
#

its easy, really simple

#

but

#

xd

#

telling him to use ${} would probably result in him doing \message.guild.me.displayName, message.guild.me.displayAvatarURL`${}`

#

cough

#

nvm

#

but yeah just remove the backticks

marble juniper
#

imagine backticks if you only want to display a value and nothing else

#

and no additional text

dark swift
#
@client.event
async def on_member_join(member):
    for channel in member.guild.channels:
        if channel.name  == "general":
            await channel.send(f"""Welcome to the server {member.mention}.\n Current number of members in the server: {guild.members}""")
#

how do i make a member count?

slender thistle
#

Member count of which server exactly? The one the user joins?

#

Your member variable is an instance of a Member class, which contains a property guild...

dark swift
#

just any server

#

that the bot is in

slender thistle
#

<guild>.member_count if you don't cache everything
len(<guild>.members) if you cache everything

#

<guild> being an instance of a Guild

dark swift
#

guild being the server id?

slender thistle
#

Do you know the difference between a class and an instance?

dark swift
#

no

#

probably not

#

lol

slender thistle
#

sigh

#

Alright, just a hint

#

I never mentioned any integers

dark swift
#

okay

slender thistle
#

Yeah, you don't have any guild variables defined

#

member has a property guild

dark swift
#

yeah

slender thistle
#

That you literally used in your for loop

dark swift
#

so i need to define guild

slender thistle
#

So to get the guild the user joined, you use member.guild

#

and to get the member count of that guild, you access the member_count property of the guild instance

dark swift
#

okay

#

where should I add that in?

slender thistle
#

Let's apply common sense

#

if we define guild variable under the lines of code where it is used, will it work?

#

meh fck it, just put it above your for-loop

dark swift
#

haha

grizzled raven
#

oop

dark swift
#

lol

dark swift
#

wait did someone actually gift you nitro today because of ur status?

grizzled raven
#

yeah lol

dark swift
#

damn sounds like something I need to try

slender thistle
#

I suggest you go through python courses after this

#

Because I don't think you understand how to declare variables

dark swift
#

yeah

#

i got to like for loops in that learn python in 4 hours

slender thistle
#

Unless the bot issue is urgent, I really advice you to take a step back and get cozy with Python itself before getting to complex variables such as discord.py

dark swift
#

okay yes

#

wait one more thing

#

colon?

#

no that doesnt work

slender thistle
#

Nop, that's not how variables are declared in python

#

definitely the wrong way lul

dark swift
#

():

#

maybe?

slender thistle
#

You don't understand the difference between declaring a variable and a function

dark swift
#

okay\

slender thistle
#

See, you didn't take your time getting used to basic Python syntax first

#

and that's not the right way to make a good Discord bot

grizzled raven
#

i dont know python, but isnt it just guild = member.guild?

#

or something like thqt

slender thistle
#

I wouldn't spoonfeed

dark swift
#

okay

slender thistle
#

but yes

earnest phoenix
#

rtfd

#

🤷‍♂️

grizzled raven
slender thistle
#

nah cry, it's more of a "learn python" thing at this point

earnest phoenix
#

yeah tbh

slender thistle
#

:p

dark swift
#

bruh

grizzled raven
#

i have small knowledge on python so like

dark swift
#

await outside async

slender thistle
#

oh boy, Python with its indents will be hell for you at this rate

grizzled raven
#

oh yeah

dark swift
#

haha

grizzled raven
#

shiv

dark swift
#

i have no idea lol

grizzled raven
#

if you are indenting something normally, then on one line you indent further than needed, what does that cause?

dark swift
#

errors

#

no thats not the problem

slender thistle
#

That causes an IndentationError

dark swift
#

yeah

slender thistle
#

Did you seriously just declare an unnecessary function under an event

grizzled raven
#

oh ok thanks

dark swift
#

idk

#

like

#

i don't need the await i don't think

#

it goes under if

modest maple
#

bruh

#

gonna just point somthing out yh...

#

do you understand how async works with python and the await command

slender thistle
dark swift
#

ah im pretty shit at this

#

I setup two commands though pretty happy at that haha

earnest phoenix
#

dude, idk much about python, or the syntac

#

i learn when i get an example

#

Copy->paste->learning->developing->pr0

#

jkjk

#

surprisingly

#

that's what a lot of "bot devs" here do

#

lol

dark swift
#

bruh I can't even get a member count working

#

its so confusing

#

also how do you get bot dev role

modest maple
#

by having a bot

#

that is approved

#

also

grizzled raven
#

in this server

dark swift
#

okay

modest maple
#

dude you dont even seem to know how await works so no wonder why member count isnt working

dark swift
#

await