#development

1 messages · Page 665 of 1

onyx summit
#
    public clear(): void {
        while (this.logs.length > this.maxLines) { this.logs.shift(); }
    }

    public log(value: string): void {
        this.clear();
        this.logs.push(value);
    }

TypeError: this.clear is not a function
What? its literally declared above it

west sand
#

is it against DBL to force user to join a discord server to use bot?

#

because i'm planning to make bot ranking system based on my server ranks

twilit rapids
#

Will your bot be only for your server

west sand
#

no i'm planning if use has role like (ex. Premium) in my servers Give Them Cool Features in the bot

twilit rapids
#

Then only give them those features if they're in your server, and leave the core/free features for everyone, including people outside your server

west sand
#

okay

earnest phoenix
#

how do i get channel id when i create it (as a bot)?

twilit rapids
#

discord.js?

earnest phoenix
#

i n
w h i c h
l i b r a r y

#

yeah

#

forgot to mention

twilit rapids
#

.then(somecoolname => somecoolname.id)

earnest phoenix
#

the method to create the channel returns a promise with the channel wrapped in it

#

depending on how you handle async, you can use it

#

tnx, ill try it

#

bruhmoment

#

im trying to get channel by name and send msg to it

mossy vine
#

you arent passing a function to .find

maiden mauve
#

so basically

#

when a message is deleted, you want your bot to send a message in that channel?

#

or do you just want the id of the deleted message?

mossy vine
#

im trying to get channel by name and send msg to it

maiden mauve
#

I've never really messed with channel object but that seems intuitively simple if you browse the API

#

if you already have the message object from delete event

#

delmsg.channel.send, no?

quartz kindle
#

if you're not using master with partials enabled, the messageDelete event should give you a full message object, which includes message.channel

maiden mauve
#

I don't understand why you would need to "find a channel name"

quartz kindle
#

if you want to send a message to a different channel, then:
with an id: .get(channel_id)
with a name: .find(channel => channel.name === channel_name)

twilit rapids
#

They want to send a message to a channel named "bruh" whenever a message gets deleted. This will work if every server your bot is in has a channel named that way. If you only want it to send it in a specific guild you can either return if the guild ID doesn't match the guild ID of the guild you want it to only work in or use client.channels.get("ID") to send it to a specific channel whatever the name of it may be

#

.find('name', 'bruh'); works too

maiden mauve
#

oh, like a logging channel

quartz kindle
#

works but its deprecated lul

topaz fjord
#

it won't work for much longer :^)

maiden mauve
#

usually things are deprecated because there is an easier way to do it

inner jewel
#

or better

maiden mauve
#

^

#

quick richembed syntax

#
let inventoryEmbed = new Discord.RichEmbed()
        .setColor('#0099ff')
        .setTitle(`Inventory for ${player.name}`);
        for(let item in player.inventory)
        {
            if(player.inventory.item > 0)
                inventoryEmbed.addField(item, player.inventory.item);
        }
#

that will work right?

topaz fjord
#

test it

maiden mauve
#

ignore the inventory object

topaz fjord
#

and see if it does

maiden mauve
#

pft

#

I didn't wanna load up a discord interact

#

😄 😄

topaz fjord
#

we're not going to test it for you

mossy vine
#

seems right

limpid raptor
#

Hello, I try to fetch a special message by using messages.fetch but it doesn't work. Here is my code : js if(message.content.startsWith(prefix + "checkset")) { let args = message.content.split(" ") console.log(args[1] + "\n" + args[2] + "\n" + args[3]) if(!args[1]) return message.channel.send("french blah blah blah !") if(!args[2]) return message.reply("id not put !") if(!args[3]) return message.reply("No emoji put !") if(args[1] != message.mentions.channels.first()) return message.reply("Channel not found !") if(!message.mentions.channels.first().messages.fetch(args[2])) return message.reply("Message not found ! Verify ID !") if(!message.mentions.channels.first().messages.fetch(args[2]).emojis.get(args[3].id)) return message.reply("Emoji not found !") message.channel.send("wouhou !") }
And my error is : if(!message.mentions.channels.first().messages.fetch(args[2])) return message.reply("Message introuvable ! Vérifiez l'ID saisi !") ^ TypeError: message.mentions.channels.first(...).messages.fetch is not a function
I used a code of an open source bot that I tested and it works good

#

The code of the open source bot is } } if(!channel){ message.channel.messages.fetch(msgID)

earnest phoenix
#

read your code very carefully

limpid raptor
#

Why ?

earnest phoenix
#

fetch doesn't exist on messages because messages returns a collection

#

however

limpid raptor
#

Mmm, so what must I use ?

earnest phoenix
#

a text channel does contain a fetchMessage method

#

which is what you're probably looking for

limpid raptor
limpid raptor
#

Wait, I will research

#

Bruh xD

#

I'm bad i'm bad i'm bad

#

Sorry 😓

earnest phoenix
#

you should probably attempt to write your own code and not copy someone else's

#

it's all good to use someone else's code as a reference sheet to what you're supposed to do, but copying word to word is meh

maiden mauve
#

oh wow I got some interesting output from a "object in" loop

limpid raptor
#

Yes, but i was pretty sure that i never saw it on the library...

maiden mauve
#

so, this works fine

#

however

#

when i log every item its iterating

#

I get every property of the object as well?

broken shale
#

@twilit rapids Sorry to specifically ping you, but your bot uses d.js and lavalink I'm assuming. According to d.js-lavalink, you need a host js const nodes = [ { host: "localhost", port: 2333, password: "youshallnotpass" } ]; but if I'm using a VPS, the host isn't localhost. What should it be?

twilit rapids
#

I don't use discord.js-lavalink

broken shale
#

Oh really?

twilit rapids
#

and do you already have a lavalink server running

broken shale
#

nope

twilit rapids
#

Then start doing that first

tulip solar
#

What are the chances that some day there will be a local offline discord client for developers to be able to code without needing to be online and be able to test

tight heath
#

0%

#

because Discord uses ws

tulip solar
#

ooohh

#

I forgot

tight heath
#

and bots need to send an IDENTIFY call via ws

maiden mauve
#

yeah, thankfully discord api is like snapping legos together

#

generally anything you need to do is pretty simple once you find the right method

twilit rapids
#

@broken shale just wondering, how did you figure that stuff out about me and my bot

unreal cape
broken shale
#

Like what language your bot ran on?

twilit rapids
#

And that I was using lavlaink

#

lavalink*

broken shale
#

language is easy from dbl page, lava-link was assumed since I would think if you have a music bot you'd use lavalink/ytdl-core

stone dust
#

@maiden mauve iirc it’s something having to do with object.hasOwnProperty, no idea how that works with mongo

#

for in loop default iterates over every property of the object

maiden mauve
#

I made a quick fix but i'd rather understand why it's doing it

#

adding a "break;" on the last object that I defined prevents the spill

#

I guess it works 🤷

tight heath
#

that's not very nice tho

maiden mauve
#

yeah, essentially it's a half-way there solution as opposed to making a defined "array"

topaz fjord
#
for (let property in object) {
    if (object.hasOwnProperty(property)) {
        // do stuff
    }
}
#

do this

stone dust
#

was gonna suggest the same yeah

topaz fjord
#

you have to check if the item is actually in the object

limpid raptor
#

By the way, how can I check if a message has this or this reaction ?

#

message.reactions and message.emojis doesn't work

maiden mauve
#

ty Turtle

sudden geyser
#

or you could use object keys

maiden mauve
#

that gave the output I wanted

#

and its fairly simple

topaz fjord
#

@sudden geyser /shrug

maiden mauve
#

it's still technically iterating the loop of nonsense though

stone dust
#

yeah

#

you could try storing the inventory in an array property of the player and iterate over that

#

idk if mongo does that but

topaz fjord
#

^

#

you can use arrays in mongo

maiden mauve
#

an array of objects

#

rather than a nested object

tight heath
#

mongo more like good database

stone dust
#

yeah

maiden mauve
#

maybe in the future.

#

this function is for a minor task comapred to how the rest of bot is coded

topaz fjord
#

its not that hard to switch over to

maiden mauve
#

I'd basically have to change every reference to the objects handling an array

#

essentially it would just be a big replace all in files

stone dust
#

the hasownprop solution definitely works so no pressure either way

maiden mauve
#

what about breaking the loop with hasownproperty as a conditional?

#

for... in , if break

stone dust
#

assumes predictable order of elements

#

idk if that’s an issue but it seemed to work

maiden mauve
#

well all my tests have shown the real elements came out first

stone dust
#

Currently all major browsers loop over the properties of an object in the order in which they were defined. Chrome does this as well, except for a couple cases. [...] This behavior is explicitly left undefined by the ECMAScript specification. In ECMA-262, section 12.6.4

#

yeah I guess that works for the most part

maiden mauve
stone dust
#

until js gets a weird facelift

maiden mauve
#

yeah if it ever went backwards you'd have the opposite problem

#

since I'm not coding paypal I think I'll be alright for the time being

#

😄

stone dust
#

yeah it’s np

#

if anything ever breaks it’s a quick fix

#

put a little book mark in it though in case

maiden mauve
#

a fun adventure in any case

#

thanks all for input

#

haha, top reply had great words of wisdom

#

It is plain wrong to assume a non-failing test provides any sort of concrete proof.

maiden mauve
#

@stone dust well, the break method ended real fast

stone dust
#

hehe

#

that sucks

maiden mauve
#

yeah

#

appears json/array is actually the "correct answer"

maiden mauve
#

Hmm

#

solved

indigo geyser
#
@client.command()
async def emoji(ctx, emoji: discord.Emoji):
	await ctx.send(emoji.url)
```with this the bot have the access only for guild emojis, how can I have it for all emojis n the bot is not in the emoji guild?
maiden mauve
#

to remove a deprecated field from mongodb, document.field = undefined works

earnest phoenix
#

any good places to host a bot? running my bot on my computer doesn't work well since I got a slow computer

amber fractal
#

Have money?

mossy vine
#

get a vps

amber fractal
#

^

#

Best place

#

Mine is $3/month

#

Very inexpensive

#

Very reliable, if you choose the right company

earnest phoenix
#

which one you got?

amber fractal
#

I have two, the $3 is from OVH, the other one I have is from primenodes

#

I havent had problems with ovh

#

I guess their support is slow Ive been told but havent experienced it

stone dust
#

google cloud can get you free credit

#

as do a few other sizable ones

#

is that the micro?

topaz fjord
#

micro pp

#

It's on pinned messages

amber fractal
#

My $3 ovh one is 2gb ram, 20gb storage unlimited bandwidth

earnest phoenix
#

ight just found some random site that offers $0.48/month

amber fractal
#

My primenodes one is $19 but that's because it's cpu is 👌

earnest phoenix
#

I have 0.56 so I think I'm gonna try it

topaz fjord
#

ovh seems to have a lot of problems

amber fractal
#

I use it for my minecraft server mmulu

topaz fjord
#

According to Mr. Miles

amber fractal
#

@topaz fjord never had any

earnest phoenix
amber fractal
#

Uh

#

Wouldnt trust

earnest phoenix
#

I don't trust it either but idc tbh

amber fractal
#

Sounds like what dbm uses

topaz fjord
#

they kept replugging the Ethernet cable on the machine miles had when it was a mobo issue

earnest phoenix
#

"1.5 tb DDos protection" tf that supposed to mean? more storage to not get ddos'd?

#

I wanna put that to the test

amber fractal
#

@topaz fjord my vps has never gone down unless I restarted it, or shut it down myself

earnest phoenix
#

their official discord has 85 members lol

mossy vine
#

it is

earnest phoenix
opaque eagle
#

What website is that

inner jewel
amber fractal
#

@earnest phoenix do you know the difference between quarterly and monthly?

earnest phoenix
#

oh, I didn't realise they weren't both quarterly lol

#

nvm then

mossy vine
#

bruh i get way better shit for that large package price

#

thats honestly a steal

#

for larger complex bots
512mb memory

amber fractal
#

@mossy vine i pay less and get better

#

Anyone using that website has done 0 research

#

@earnest phoenix $3

#

Or around there

#

2gb ram, 20gb storage

#

Unlimited bandwidth

#

That's all I know

#

You never use the panel really

#

But yeah, it's garbage

#

Just select your OS and that's it really

#

Go back to pay

#

They email you the ip and stuff so you can ssh into it

#

But their panel is a little weird

#

@earnest phoenix if you select U.S. you get no VAT tax

#

Love living in the US mmulu

tight heath
#

Imagine using ovh

amber fractal
#

@tight heath been working for me for 7 months

#

Dont know why so many people have issues with them

tight heath
#

My server's disk broke and it took them 2.5 weeks to repair it

broken shale
#

using ovh?

earnest phoenix
#

i need help

#

I have a outdated apex-api and i wanted to update it and says "No Api Key found in request"

#
{"message":"No API key found in request"}```
scarlet phoenix
#

Well you might want to try reading the error. It tells you the exact problem..

earnest phoenix
#

ik what is says but , i don't know how to put the key in the link

broken shale
#

check the docs for that api

earnest phoenix
#

i read them but it's only in http

#

I think i got it

earnest phoenix
#
embed.author.icon_url: Not a well formed URL.
    at item.request.gen.end (e:\somestuff\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
    at then (e:\somestuff\node_modules\snekfetch\src\index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
warning.js:18
(node:4276) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
warning.js:18
(node:4276) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

What should i do?

twilit rapids
#

embed.author.icon_url is not an well formed url

#

Not sure what you're trying to do but look in docs for the user object

earnest phoenix
#
            if(url + "silver3.png")
            {
            const embedapex = new Discord.RichEmbed()
            .setColor("RANDOM")
            .setTitle("User Page")
            .addField("Level:", `${level}`)
            .addField("Rank", "Silver [III]")
            .addField("Wins:",`${wins}`)
            .addField("Kills:", `${hopa}`)
            .addField("Platform:", `${platform}`, false)
            .setAuthor(username, `${avatar}`)
            .setThumbnail(`${rank}`)
            .setFooter("© by Apex Stats Bot");
            msg.channel.send(embedapex);
            }
#

The api doesn't have a Rankname

#

and i tried to make by the image

#
            "rank": 4,
            "percentile": 99.9,
            "displayName": "Rank Score",
            "displayCategory": "Game",
            "metadata": {
              "iconUrl": "https://trackercdn.com/cdn/apex.tracker.gg/ranks/apex.png"
            },
            "value": 2559,
            "displayValue": "2,559",
            "displayType": "Unspecified"
          }```
#

Someone?

#

If someone knows what should i do please DM me , i will go to sleep now.

potent snow
#

Eu amigo yo tambien quiero aprender a configurar esta re Buenardo

#

Salz

analog gale
#

What? Help me

    at WebSocketConnection.client.ws.connection.once.event (C:\Users\X\Desktop\xerobot\node_modules\discord.js\src\client\ClientManager.js:48:41)
    at Object.onceWrapper (events.js:286:20)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.onClose (C:\Users\X\Desktop\xerobot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
    at WebSocket.onClose (C:\Users\X\Desktop\xerobot\node_modules\ws\lib\event-target.js:124:16)
    at WebSocket.emit (events.js:198:13)
    at WebSocket.emitClose (C:\Users\X\Desktop\xerobot\node_modules\ws\lib\websocket.js:191:10)
    at TLSSocket.socketOnClose (C:\Users\X\Desktop\xerobot\node_modules\ws\lib\websocket.js:850:15)
    at TLSSocket.emit (events.js:203:15)
    at _handle.close (net.js:606:12)
(node:6836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of
an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6836) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that
are not handled will terminate the Node.js process with a non-zero exit code.```
outer tulip
#

@analog gale client login token probs wrong

#

check again

analog gale
#

Thanks!

swift topaz
#

I'm getting an args.replace is not a function error

#

here's the snippet

bot.on('message', msg =>{
    if(!msg.content.startsWith(PREFIX)) return;
    const args = msg.content.split(` `);
    const url = args.replace(/<(.+)>/g, '$1');```
mossy vine
#

because its not

swift topaz
#

can you explain further?

mossy vine
#

.replace is a string methjod

#

doesnt exist on an array

swift topaz
#

was tryna follow through

#

nvm I got it done

sinful lotus
#

join it before you replace it

#

args is an array

swift topaz
#

I kind of fixed it except for one thing

#

when i try to skip the song, it gives this error,

const url = args[0].replace(/<(.+)>/g, '$1');
                        ^

TypeError: Cannot read property 'replace' of undefined```
mossy vine
#

args[0] is undefined roeesip

swift topaz
#

@sinful lotus what do you mean by join it before replace? a temp variable?

bot.on('message', msg =>{
    if(!msg.content.startsWith(PREFIX)) return;
    var cont = msg.content.slice(PREFIX.length).split(" ");
    var args = cont.slice(1);
    const searchString = args.slice(0).join(' ');
    const url = args[0].replace(/<(.+)>/g, '$1');
    console.log('URL: ' + url);
    console.log('Search string: ' + searchString);
    const serverQueue = queue.get(msg.guild.id);
    

    var cmd = bot.commands.get(cont[0])
    if(cmd) cmd.run(bot, msg, args, queue, serverQueue, youtube, url, searchString);
    
    else if(!cmd) msg.channel.send(`Puff! (Invalid command!)`);

    }```
#

this is my code btw. I'm using command handlers

earnest phoenix
#

Wtff

swift topaz
#

It works when I queue a music

earnest phoenix
#

YouTube

swift topaz
#

but it doesn't work when I skip the song

earnest phoenix
swift topaz
#

yeah I would prefer help than belittling thanks

lethal sun
#

can someone give me a link to a client.on function that is always looking for reactions to messages?

#

i cant find it in the docs

#

discord.js

mossy vine
lethal sun
#

yeah that

#

thanks

stray garnet
#

how can i let my bot send an message when it joins an server?

winged thorn
#

what library

halcyon nymph
#

Line of code

result = ast.literal_eval(result)

Error

Ignoring exception in command question:
Traceback (most recent call last):
  File "C:\Users\Just_Allexx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/Just_Allexx/Desktop/Bots/Qbot/qbot.py", line 18, in question
    result = ast.literal_eval(result)
  File "C:\Users\Just_Allexx\AppData\Local\Programs\Python\Python36-32\lib\ast.py", line 48, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "C:\Users\Just_Allexx\AppData\Local\Programs\Python\Python36-32\lib\ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    {
    ^
SyntaxError: unexpected EOF while parsing

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Just_Allexx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 863, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Just_Allexx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 728, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Just_Allexx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 88, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: SyntaxError: unexpected EOF while parsing (<unknown>, line 1)
maiden mauve
#

the problem is clearly that you have typoed "Alex"

#

😉

halcyon nymph
#

Where have I typoed?

halcyon nymph
#

Okay, I see

tight heath
#

@stray garnet listen for the guildCreate event

earnest phoenix
#

uh no

#

you'd be spamming everytime you establish a handshake with the gateway nevermind, d.js pipes it to the same event

#

Help
Error

embed.author.icon_url: Not a well formed URL.
    at item.request.gen.end (e:\somestuff\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
    at then (e:\somestuff\node_modules\snekfetch\src\index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
warning.js:18
(node:4276) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
warning.js:18
(node:4276) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Command:
```            const url = 'https://trackercdn.com/cdn/apex.tracker.gg/ranks/';
            if(url + "silver3.png")
            {
            const embedapex = new Discord.RichEmbed()
            .setColor("RANDOM")
            .setTitle("User Page")
            .addField("Level:", `${level}`)
            .addField("Rank", "Silver [III]")
            .addField("Wins:",`${wins}`)
            .addField("Kills:", `${hopa}`)
            .addField("Platform:", `${platform}`, false)
            .setAuthor(username, `${avatar}`)
            .setThumbnail(`${rank}`)
            .setFooter("© by Apex Stats Bot");
            msg.channel.send(embedapex);
            }```
Source:
```          "rankScore": {
            "rank": 4,
            "percentile": 99.9,
            "displayName": "Rank Score",
            "displayCategory": "Game",
            "metadata": {
              "iconUrl": "https://trackercdn.com/cdn/apex.tracker.gg/ranks/apex.png"
            },
            "value": 2559,
            "displayValue": "2,559",
            "displayType": "Unspecified"
          }```
#

embed thumbnail needs to be a url

#

you're passing an int

sudden geyser
#

Are you sure setAuthor is a direct link to the image

earnest phoenix
#

No

#

i want to set it like a thumbnail to the player who use the command to show his in-game rank photo

#

oh i see something now the avatar is undefined

#

I solved it!

#

Ty for help anyway

earnest phoenix
halcyon nymph
#

Hi I'm Having trouble with global variables

global port, questions, pointer
port = 'website for questions'
questions = requests.post(port, json={}).text
questions = ast.literal_eval(questions)['result'][0]
pointer = 0

But, in my program

@client.command(aliases=['quest', 'q', 'start', 'play', 'ask'])
async def question(ctx):
    print(port)
    print(questions)

port is defined, but questions is not for no reason

winged thorn
#

is the error literally just "questions is not defined"

west spoke
#

@halcyon nymph global variables are a bit meh. I redefine things each time for global variables, or make it a function that returns stuff

winged thorn
#

global variables tend to be bad practice most of the time

#

you could create your command in a cog and use self to store data which you need multiple times in different cmds

halcyon nymph
#

How else can I pass variables into async commands that can change on the fly

winged thorn
#

I'd recommend cogs

west spoke
#

Or files.

#

{"string":"output"}

halcyon nymph
#

Idk what cogs are

winged thorn
#

having to open a file each time you run a command isn't ideal

halcyon nymph
#

I don’t think files would work because I need it to change

west spoke
#

writing to json files

earnest phoenix
#

or simply don't

winged thorn
#

Again having to open each command is not ideal

earnest phoenix
#

more often than not, it will lead to corruption

west spoke
#

Also you can make a async loop that checks ~ every 10-20s for it

winged thorn
#

cogs would make it so much easier

halcyon nymph
#

I think I’ll just use a class

west spoke
#

true

halcyon nymph
#

Because classes are global aren’t they?

winged thorn
#

a cog is just a class

halcyon nymph
#

Oh, I didn’t know what you were talking about

west spoke
#

lol

winged thorn
#

Suppose you write this extension
someextension.py

from discord.ext import commands

class SomeCog(commands.Cog):
    @commands.command()
    async def foo(self, ctx, ...):
        ...
    @commands.Cog.listener()
    async def on_some_event(self, args):
        ...

# This is important
def setup(bot):
    bot.add_cog(SomeCog())```


In your main code file in the same directory, you could load it like this
`bot.py`
```py
from discord.ext import commands

extensions = ['someextension']

bot = commands.Bot(command_prefix='')

...
for ext in extensions:
    bot.load_extension(ext)

bot.run(token)```
#

tada

halcyon nymph
#

Yeah, cheers

winged thorn
#

no worries

unreal cape
#

does python 2 work with d.py 0.16.2?

west spoke
#

I think it does

analog gale
#

Da someone code for writing all on pv

grim aspen
#

what

west spoke
#

Wants something in py.

#

If you want us to make it for you you are gonna have to pay

indigo geyser
earnest phoenix
#

don't use heroku

vestal crystal
#

@indigo geyser why not use uptime Robot

prime storm
twilit rapids
#

what did you define message as

indigo geyser
#

@vestal crystal it doesen't work. it goes offline after 1 hour of inactivity

vestal crystal
#

Yeah, that's the downside

indigo geyser
#

And you have to take Repl open

vestal crystal
#

Yeah!

indigo geyser
#

so, VSC is better

late hill
#

Are you sure you pushed those changed to heroku

indigo geyser
#

yes

vestal crystal
#

I don't like heroku becuase I have to pay

indigo geyser
#

no

winged thorn
#

Heroku bad

indigo geyser
#

no u

winged thorn
#

It's bad for bots

indigo geyser
#

I can't pay for a vps

topaz fjord
#

heroku is bad

winged thorn
#

But you're time limited on heroku

indigo geyser
#

i will create a new account

winged thorn
#

So what's the point it's just going to go down anyway

indigo geyser
#

pls stop

winged thorn
#

That is much too much effort than its worth

topaz fjord
#

there are cheap vps linked in this channels pins

indigo geyser
#

I CAN'T PAY

winged thorn
#

Buy a raspberry pi

indigo geyser
#

buy

#

oh

#

teh raspberry

#

maybe

winged thorn
#

Why can't you afford like $1 a month

brazen vault
#

How to make it written that my bot is online?

winged thorn
#

What do you mean

#

I don't understand the question Edward

#

Nice

#

Good job discord

#

You suck as usual

indigo geyser
#

@winged thorn I don't have a credit card

#

And I am too young

winged thorn
#

Debit card.

indigo geyser
#

And my parents will not pay for this

winged thorn
#

Ask for a rasp pi for a birthday or something

indigo geyser
#

Yes

winged thorn
#

Then you can host on that

#

My pi collection is up to 4 now

brazen vault
topaz fjord
#

my parents pay for my vps mmLol

#

and my domain

#

The ??? will disappear when the bot is approved

winged thorn
slender thistle
#

It will disappear when the bot will be in this server, to be precise. Approved != On this server mmulu

topaz fjord
#

My vps is $10 a month and it's suffering mmLol

#

node is fucking it

brazen vault
#

So is he not yet approved? Sorry, I did not know how long should I wait?

winged thorn
#

As long as it takes

#

I'm waiting too

topaz fjord
#

Can be up to week

#

or more

#

Depends on how long the queue is

brazen vault
#

logically

heavy nymph
#

How do we make that there is the server number or is our bot discord (Sorry , I speak French)

indigo geyser
#

api

west spoke
#

You mean how many servers your bot has?

#

You shouldn't use it for anything else

tight heath
#

@topaz fjord my VPS is $70 a month and java is fucking it

indigo geyser
tight heath
topaz fjord
#

nou

tight heath
#

Groovy doesn't use vpss for the main workers and jvm is fucking the cpu

indigo geyser
#

Local Host is the best

tight heath
#

yes

west spoke
#

yes

tight heath
#

127.0.0.1

west spoke
#

heroku restarts

#

once a week at least

tight heath
#

Heroku is gay

west spoke
#

^

indigo geyser
#

@earnest phoenix what

#

ok

#

okk

winged thorn
#

Heroku bad

indigo geyser
#

yes, but actually no

tight heath
#

Just use an overpowered k8s setup

#

Btw once aero gets $$$

#

We'll upgrade that

#

mmmmm

#

I'll probably switch all workers to GG for the low latency

#

And upgrade our current ones

#

What

#

Yeet

#

Mine only contact when they want $$$

twilit rapids
#

I don't have one sad

tight heath
#

need a domain?

topaz fjord
#

sugar daddy

tight heath
#

boi im poor

#

Just nice

quartz kindle
#

I need a domain, or several lul

#

But im gonna be a responsible adult and pay for it with my lunch money

tight heath
#

goodboy

#

Too much

#

I'll be charged $400 for domains and nitro on my bday

quartz kindle
#

Rip

tight heath
quartz kindle
#

Do you actually make money off your bot?

tight heath
#

I make money off Groovy; my bot is currently indev

quartz kindle
#

Is it enough to cover expenses?

#

It probably is lul

mossy vine
#

300 bucks in domains holy shit

twilit rapids
#

@tight heath yes I do

tight heath
#

@quartz kindle I also have other sources of income lmao

#

But Groovy pays a fair amount

#

I also have a sponsor for aero so

quartz kindle
#

@tight heath well yeah lul, but its nice when a bot is self sustainable

tight heath
#

True

twilit rapids
#

I lose $10 per month for keeping up my bot

tight heath
#

But as said aero is indev

twilit rapids
tight heath
#

There's is no running build

#

Just a k8s cluster ready

small prairie
#

i need help

tight heath
#

For the first prod deploy

small prairie
#

how to get list of servers

twilit rapids
#

Yes

tight heath
#

I answered you in general

#

But we need a sharding manager

#

Because sharding in k8s is a tad more complicated

small prairie
#

and that is?

trail dagger
#

@small prairie Want a easy code?

small prairie
#

i got the count

tight heath
small prairie
#

but not the names

trail dagger
#

Learn discord.js

tight heath
#

I need to add wss there

small prairie
#

OOF

#

someone ban him

tight heath
#

And then we can mostly start

quartz kindle
#

I was experimenting with djs shards today, i wrote a weird script with the sharding manager to allow for custom number of processes with x shards each

small prairie
#

i can get the total but not the lest

tight heath
#

Well we have aether

trail dagger
#

@small prairie Did you code asleast one single part of your bot yourself?

tight heath
#

It just needs refinement

small prairie
#

yeah man evberuything

trail dagger
#

no

small prairie
#

i just dont know this part

tight heath
#

We start without using d.js' shardingmanager

slender thistle
#

Could you actually help

small prairie
#

oof everyone has these mf's

#

they are everywhere

tight heath
#

@slender thistle I answered his q twice

#

In general

trail dagger
tight heath
#

That's why we're ignoring him

small prairie
#

me?? oof

quartz kindle
#

What do you want to do @small prairie?

trail dagger
#

@small prairie How old are you?

tight heath
#

List guilds in djs

small prairie
#

names of the servers my bot is on

#

@trail dagger none for your buisness

quartz kindle
#

Are you using discord.js?

small prairie
#

yeah

trail dagger
#

12?

topaz fjord
tight heath
#

@trail dagger just stop

small prairie
#

not your buisness

slender thistle
#

Calm tf down Emil

small prairie
#

whatever this server is not ebing helpfull atm will be back later

trail dagger
#

I am calm?

twilit rapids
#

Watch him go to Discord.js official

trail dagger
#

What part of the code do you need help with? show us the error

quartz kindle
#

You can get the list of servers using client.guilds then you need to extract the names from it. You can use array.map() for example which works on collections

slender thistle
#

Stop the belittle and either contribute to helping (even though as ravy says that question was answered twice already) or stay quiet

small prairie
#

welp found the code one of my friend gave me

#

this wasnt any helpful here

quartz kindle
#

Lmao

small prairie
#

and yeah @slender thistle ravy was ost helpful but didnt understand

#

most*

quartz kindle
#

A code is not something you "find", is something you learn, and we try to teach, not give code for people to copy/paste without understanding

topaz fjord
#

ravy didn't understand 👀

quartz kindle
#

But cool that you found a solution

tight heath
#

@quartz kindle I personally don't like the djs sharding manager so this is how we did it

#

Both are connected via ws

quartz kindle
#

Cool, ill check it out later, im on the phone now

tight heath
#

Next steps are adding wss and signing, as well as an eval event

#

And then I can use it in prod

quartz kindle
#

What i did was passing a process id into shardArgs and incrementing it on each process launch so the forked client knows whish shards to spawn in the client options lul

tight heath
#

Oh that's cool

#

Well currently each pod will only launch one shard

#

So ig could get shards from hostname

quartz kindle
#

Cool

#

I was also experimenting with djs master's memory usage lul

tight heath
#

ohno

quartz kindle
#

I got it down to 80mb ram at 1.5k servers

woven zealot
#

(does anybody know how to eval an emit? I'm trying to be a lazy dev but eval only returns true and doesn't emit the event)

tight heath
#

Woah

#

I use 120 for 62

quartz kindle
#

Lmao

tight heath
#

Tbf I cache all members

topaz fjord
#

why

tight heath
#

Because 62 servers is nothing

woven zealot
#

lmao I reboot my bot every now and again just to delete the cache

quartz kindle
#

I disabled all events except guild create/delete/update, clear all stores on the raw guild create event

#

Then use the raw message event to handle messages

tight heath
#

Oh cool

#

I'm tryna use rawevents but it's weird

topaz fjord
#

can you disable events in jda

#

👀

quartz kindle
#

I tried going further and disablig caching guilds but then djs kinda breaks

#

Lul

tight heath
quartz kindle
#

It starts memory leaking

tight heath
#

Btw if you wanna yank or contribute stg feel free to

quartz kindle
#

Speaking of memory leaks, the zucc package causes a huge memory leak in djs master

#

At least it did everytime i tried it

inner jewel
#

@topaz fjord you can disable guild subscriptions

#

on the v4 lazy loading pr

#

disabling events isnt supported by discord so theres no reason to do it

#

at most you save a couple bytes of allocations that are almost free to gc since you'll most likely be using a generational collector

quartz kindle
#

Also zlib-sync was finally fixed for node v12, it cuts down djs's cpu usage by half

tight heath
#

@quartz kindle i used uws and it caused some d.js callbacks to run before the event actually completed

indigo geyser
maiden mauve
#

anyone know how to fix that on git GUI?

#

(entire file is being flagged instead of specific code)

opaque eagle
#

Add a newline at the end of the file?

maiden mauve
#

like, just hit enter a few times?

opaque eagle
#

No, just one empty new line at the end

maiden mauve
#

like so?

opaque eagle
#

yeah

maiden mauve
#

nah still showing

opaque eagle
#

Don't put anything on that line

#

no space

maiden mauve
#

yeah all i did was make new line and save, still throwing "no new line"

opaque eagle
#

hmm... idk;

maiden mauve
#

😭

#

js question: if you assign a variable at the beginning of a command.js file, will it get overwritten from multiple instances (busy bot)?
ex:

let damage = 0;

function doit () {
    damage = 25;
    return true;
}
function doit2 () {
    damage = 45;
    return true;
}
#

I've run into a small pickle with displaying a variable change that can't be the function return

limpid raptor
#

Hey, I need help. I want to create a personnal prefix for each server. I made it : ```js
if(message.content.startsWith(prefix + "prefix")) {
let args = message.content.split(" ")
if(!message.guild.member(message.author).hasPermission("ADMINISTRATOR")) return message.reply("Permissions insuffisantes.")
if(!args[1]) return message.reply("Le préfixe actuel est " + prefix + ". Si vous souhaitez le changer, précisez le nouveau préfixe.")
if(args[1].length > 1) return message.reply("La longueur du préfixe doit être d'un seul caractère.")
if(args[1] === prefix) return message.reply("Le préfixe actuel est déjà celui précisé !")
prefix = args[1]
fs.writeFile("./administration/prefix.json", JSON.stringify(prefixies), (err) => {
console.error(err)
})

    message.channel.search("Le préfixe a bien été changé en `" + prefix + "`.")
}```

But the output is : (node:11828) UnhandledPromiseRejectionWarning: DiscordAPIError: Bots cannot use this endpoint at item.request.gen.end (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15) at then (c:\Users\Megaport\Desktop\TimeBot\node_modules\snekfetch\src\index.js:215:21) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) warning.js:18 (node:11828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) warning.js:18 (node:11828) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. can someone help me ?

maiden mauve
#

JSON.stringify(prefixies) variable name intentional?

sudden geyser
#

Loaf yes

#

But you can use let to make it local

limpid raptor
#
const prefixies = JSON.parse(fs.readFileSync("./administration/prefix.json", "utf8"))```
#

I've this

maiden mauve
#

the specific error seems related to discord

#

not your variable change

limpid raptor
#

But... what must I do ?

#

My bot is administrator

sudden geyser
#

Hoff you can't use the search endpoint

limpid raptor
#

????

#

what is it ?

#

And where is it ?

slender thistle
#

message.channel.search("Le préfixe a bien été changé en `" + prefix + "`.")

limpid raptor
#

?

#

...

#

i think i have to sleep

#

it's send, not search..

sudden geyser
#

Hoff in stable, check out the TextChannel class for fetching messages. In master, check out the MessageStore

maiden mauve
#

lol

limpid raptor
#

Fuck me

maiden mauve
#

fatigue is always a contributing error 😄

limpid raptor
#

Yeah, it's a very bad thing too

#

So, sorry for the disturbance..

maiden mauve
#

Hey, it's an awareness poster

#

Don't code in the wee hours unless your jacked on caffeine 😄

#

speaking of coffee

#

I need to solve a "repeated code" problem

mossy vine
#

use functions?

maiden mauve
#

hold on ill paste it

#
    sting: {
        reqLevel: 1,
        mpCost: 2,
        errorStr: "Sting requires 2 MP.",

        cast: async (player, message, target) => {
            let spellDmg =  Math.floor(player.maxHP / 20);

            if(target.hasSHIELD)
                spellDmg = Math.floor(spellDmg * 0.75);
            else if(target.hasSHIELD2)
                spellDmg = Math.floor(spellDmg * 0.60);

            target.currentHP -= spellReturn;

            await message.channel.send( `${player.name} casts **STING** on ${target.name}! Damage done: ${spellDmg}! Remaining HP: ${target.currentHP}/${target.maxHP}` );

            return true; // necessary to continue file. Some spells have false returns for case-by-case validation.
        }
    },
#

so I decided to make every spell an object for clean looking c ode

#

but then I realized, "if every damaging spell just causes damage, that should be the return"

#

in other words, the handler could reduce target hp etc.

tight heath
#

how about you also return an object like idk

maiden mauve
#

however, the function itself needs the change to display properly

late hill
#

If all of them are a similar format like that, use a class?

tight heath
#

{ damage: 5000, paralysis: true, ... }

maiden mauve
#

yeah 1 option is a multi return

pastel sky
#

Hey guys, my bot had 68 upvotes and now has 2. Can someone help me?

late hill
#

They are monthly

#

A new month started

maiden mauve
#

if I push it all to the handler the cast function pretty much just becomes a "switch case" for damage done

pastel sky
#

Oh, Ty @late hill <3

maiden mauve
#

not the worst idea though

#

porting 5 lines of repeated code just to stomp on my idea a little bit

tight heath
#

heh

#

_if you paypal me 20 I'll refactor it for you mmLol _

maiden mauve
#

hehehe

#

refactoring is the joy I get out of this project

tight heath
#

I mean if you enjoy refactoring

#

yw have fun

coral trellis
#

Nice run script

tight heath
#

it was originally for docker

#

but docker is trash

#

so it's just laying around

coral trellis
#

Ah

topaz fjord
#

nice one line bans.json

inner jewel
#

i just let my ide do the refactoring for me

topaz fjord
#

refactoring is for noobs

#

I just let the code live like it is

maiden mauve
#

hey, nothing wrong with a 500 line if/else nest

#

if it works, it works

topaz fjord
#

there is

#

A lot

maiden mauve
#

contract job security

#

nobody else will touch it

tight heath
#

between hosts

#

whew

topaz fjord
#

999

tight heath
#

no but like

#

this goes through the whole damn atlantic ocean

topaz fjord
floral bloom
#

Discord.js and JSON
How would I make a JSON based leaderboard?
I've tried a lot, but nothing has worked...
JSON file:

{
    "users": {
        "userID": {
            "points": 100
        }
    }
}

Ping with response please!

earnest phoenix
#

have you thought about not using json files as a database

twilit rapids
#

.json files can corrupt when they are written on a lot. Which can cause you to loose all your data. Use a database like Mongo or SQLite

tight heath
#

also json is hella slow

#

since it needs a fs operation every single time

opaque eagle
#

@floral bloom

maiden mauve
#

@floral bloom as people have said its worth the time investment to figure out a simple db, but the answer to your question is a number of string editting techniques and fs commands

floral bloom
#

Thanks, but I think I found a way.

maiden mauve
#

yeah, I started off doing something similar with my bot

#

and by 15 users I was already having issues with fs object and json

#

cannot write file in use

floral bloom
#

I'm re-coding an old bot and it's never had issues with JSON files being corrupted IIRC.

#

It has over 120 users in the database.

earnest phoenix
#

its not only that, json has strict formatting rules and restrictive data types

maiden mauve
#

if your die hard committed to keeping json 🤷

earnest phoenix
#

mess up formatting and your file is unreadable

inner jewel
#

if you use the non sync methods, you risk corruption by writing twice at the same time to the same file

#

if you use the sync ones, you're locking the whole process to do the write

maiden mauve
#

mongodb/mongoose made all my db issues brainless

#

I removed so much annoying json code

#

it literally took me as long as it took to format the json correctly as it did to learn mongo

#

for example, one of the most annoying parts of json was the discord snowflake

#

you can't store it as an integer in js because its too long

earnest phoenix
#

js is a joke with numbers

#

53 bits lol

maiden mauve
#

this is true

#

anytime your dealing with floats in js it gets weird too

floral bloom
#

I use an NPM package to deal with the 1e problem...

maiden mauve
#

Ace, are you familiar with any other db besides json or just stubborn to leave it? I don't mean to be condescending just curious

#

there is literally no advantage to keeping it that way unless a local file is a necessity for some reason

floral bloom
#

I know a very tiny bit of SQL but that's it.

earnest phoenix
#

there are orm frameworks

#

you dont need to know sql to use sql databases

maiden mauve
#

here's an example of how simple mongoose is

#
const player = await players.findOne({"flake":message.author.id, "serverId":message.guild.id});
    if(!player) {
        player = new players({ flake: message.author.id , name: message.author.username , serverId: message.guild.id});
        await player.save();
        await message.channel.send('`' + player.name + ', you now have a Loaf Bot user profile! Type ?help in the chat room to see all commands.`').catch( (e) => { console.log(e); } );    
    }
#

that's my code to check for a new player in db

floral bloom
#

I mean, it looks more simple, but what does it take to create the database?

maiden mauve
#

mongodb gives you a free host up to 512 MB

#

then you just need to do a little research on connecting it to nodejs

#

it'

floral bloom
#

No, I mean, how do you create the database?

maiden mauve
#

keywords coming in here but

#

mongodb ... specifically mongoose is models and schemas

#

my "model" is players

#

and my "schema" is the players stats

#

that is a Schema, in other words a map of all the variables in the model

#

as soon as you .save a schema, it goes onto the db

#

then on the actual db it looks like this

#

but everything is found by properties as you saw above

floral bloom
#

Huh.

maiden mauve
#

model.findOne({server : server, flake : flake);

#

will always find the correct user

floral bloom
#

Ok, I'll look into it, thanks.

maiden mauve
#

👍

#

I was stubborn in json but after crossing the learning curve of mongo(mongoose specifically) I would NEVER do that again with any project

floral bloom
#

I just use JSON because that's the only thing that I could actually make work

maiden mauve
#

yeah, it's quick to get up and running because you don't have to leave your project folder

#

but it also quickly becomes a project of itself

floral bloom
#

Is it completely free?

maiden mauve
#

Mongo is, yes

#

as long as you don't exceed the limit

#

my project is 82 KB / 512 MB with 30 users

floral bloom
#

Okay. And what is the cluster name for?

maiden mauve
#

whatever, it's sort of irrelevant

#

your project name if you want

tight heath
#

@maiden mauve btw if the name of the value is the same as the key in an object you can write it a lot shorter

#

{server : server, flake : flake} is the same as {server, flake}

#

:)

maiden mauve
#

orly?

tight heath
#

yup

maiden mauve
#

so basically in that instance

#

the shorter version would work?

tight heath
#

pls const

#

but yes

maiden mauve
#

😉

trail dagger
#

a clean background, no background decoration

earnest phoenix
#

background-color @trail dagger

trail dagger
#

i know that

#

but i still get that background decoration shit

warm marsh
#

Any recommendations for a bot language, I've coded in Javascript but I'm kinda bored I'd like to learn a new language.

topaz fjord
#

java

warm marsh
#

Alright

tight heath
#

python is ez

#

if you wanna

#

java is cooler though

opaque eagle
#

Go is really fun

topaz fjord
#

it is

#

but I prefer to use it for rest apis

opaque eagle
#

Rust is also a solid choice if you'd like to try something different

warm marsh
#

Ok, I guess will give them a try. Which is most recommended for command line?

inner jewel
#

command line apps?

warm marsh
#

What?

inner jewel
#

Which is most recommended for command line?

warm marsh
#

Yeah, Meaning doesn't require to be compiled or doesn't use something external for compiling.

inner jewel
#

out of those 3, only python

#

the others need to be compiled

#

although the build tools have ways of running directly (./gradlew run, cargo run)

warm marsh
#

Ok, Thanks!

earnest phoenix
#

asd

outer niche
#

how do i get a text doc. to a py file

west spoke
#

just replace the ext to .py

#

Also if you are using the default IDLE you can press ctrl+n and make one from there.

#

eg filename.txt to filename.py

outer niche
#

idk how to replace

west spoke
#

what OS

#

either way if you dont have a python idle, get one

#

it will make your life a lot easier

outer niche
#

i have a idle

quartz kindle
#

@tight heath lul, i think its a general consensus that uws is bad. i think its being deprecated/removed soon

west spoke
#

@outer niche copy the stuff over, that would be easiest.

#

Then f5 should run it

tight heath
#

@quartz kindle everyone on d.js discord told me it's bad, but it's still officially listed

quartz kindle
#

yeah

#

lmao

outer niche
#

Windows 10 is my operating system

quartz kindle
#

also they should provide some benchmarks/statistics about those extra packages, like "how much improvement do you get from them"

outer niche
#

@west spoke Windows 10 is my operating system I just need to know how to transfer the file

quartz kindle
#

the most impactful one i could notice was zlib-sync, and supposedly zucc should be even better, but i cant use it because it leaks

#

@outer niche you want to change a .txt file to a .py file?

outer niche
#

Yes

quartz kindle
outer niche
#

Ok

#

I don't see how that helps me

#

Don't see where it says how to transfer it into a python file

quartz kindle
#

you just rename it

outer niche
#

That does not do anything

quartz kindle
#

python files are just text files with a .py extension, its literally the same file just with a different name

outer niche
#

Accept I can't get it to go into a python file

quartz kindle
#

why cant you?

outer niche
#

Idk

quartz kindle
#

what are you trying to do?

outer niche
#

Oml

maiden mauve
#

"transfer the file" is rather ambiguous

outer niche
#

I want to transfer the text document into a python file

quartz kindle
#

that is not a thing

maiden mauve
quartz kindle
#

does the text document have python code in it?

outer niche
quartz kindle
#

then do what i told you

outer niche
#

I want to put it into a Python file

quartz kindle
#

you do that by doing what we're telling you

outer niche
#

That's not helping me

quartz kindle
#

you need to enable windows file extensions, so you can see them, and change them

maiden mauve
#

a python file IS a text file, it's just the programs that read it need it to be .py for formatting

quartz kindle
#

if you dont enable file extensions, then you see "file.py" but in reality its "file.py.txt"

maiden mauve
#

we're telling you all you have to do is change the file extension

earnest phoenix
#

do you mean, reading a text file from python?

#

or something else

quartz kindle
outer niche
#

still not helping

quartz kindle
#

did you enable file extensions?

outer niche
#

cant

quartz kindle
#

why not?

#

do you see files like this?

outer niche
#

No

quartz kindle
#

or like this

earnest phoenix
#

well

#

the system auto hides them to make it look clean

#

if you execute a few commands, you can make them visible

outer niche
#

@quartz kindleno

quartz kindle
#

how do you see files then?

outer niche
#

Idk

quartz kindle
#

i mean the file names

#

is it "filename" or is it "filename.something"

outer niche
#

It is only the final name like I said

quartz kindle
#

show a picture?

outer niche
unique nimbus
#

do .py at the end

quartz kindle
#

then your files look like i said "filename" and not "filename.extension"

#

so you need to enable file extensions

#

so you can see them

#

you cant edit them if you cant see them

unique nimbus
#

o

quartz kindle
#

your files need to be shown as "py.txt" and "echo premium.py" and "new text document (.txt"

#

not the way they are now

#

the link i sent you explains how to enable file extensions

outer niche
#

@quartz kindle and like I said before I cannot enable the file extender

quartz kindle
#

why not?

outer niche
#

I don't know why don't you ask my computer

#

Because apparently it does not exist

quartz kindle
#

did you go to where the link said to go?

outer niche
#

Yes I went to the link I still do not understand it I type it into my computer and nothing pulls up

quartz kindle
#

you dont know how to use the control panel?

outer niche
#

No

#

I don't ever use it

quartz kindle
#

Open Control Panel > Appearance and Personalization.  Now, click on Folder Options or File Explorer Option, as it is now called > View tab. In this tab, under Advanced Settings, you will see the option Hide extensions for known file types. Uncheck this option and click on Apply and OK.
#

click on the start menu and type "control panel"

outer niche
#

Computer settings or what

quartz kindle
#

then click on "appearence and personalization" like it says above

inner jewel
#

there's an option in file explorer itself

#

view -> file extensions or something like that

quartz kindle
#

yes there is, but i thought this way would be easier for him to find it lol

outer niche
#

I only see the properties

quartz kindle
#

did you open the control panel?

outer niche
#

There is no option for the control panel

earnest phoenix
#

are you on a mac

quartz kindle
earnest phoenix
outer niche
#

I asked if it was through the actual computer

quartz kindle
#

i said to click on the start menu and type it

outer niche
#

All right I'm on the control panel

earnest phoenix
#

@outer niche just YouTube how

quartz kindle
#

now click on appearence and personalization

outer niche
#

I did I can't find anything

earnest phoenix
#

based on the screenshot they posted above

#

it seems they're on a mac

#

not on a windows machine

#

lol

outer niche
earnest phoenix
#

nevermind

#

Lol

quartz kindle
#

disable that

#

then click apply and ok

outer niche
#

Disable what

quartz kindle
#

the picture i showed

#

hide extensions for known file types

#

disable it

outer niche
#

There's nothing there to disable

earnest phoenix
#

Un tick it

quartz kindle
#

click on the box to untick it

#

thats disabling

outer niche
#

Got it

quartz kindle
#

ok

#

now close everything and go back to your files

#

you should see your "py" file is now called "py.txt"

outer niche
quartz kindle
#

yes

earnest phoenix
#

👏

quartz kindle
#

now rename it, and change ".txt" to ".py"

outer niche
#

Got it

quartz kindle
#

congrats

outer niche
#

The file does not ope

earnest phoenix
#

that took way to long

outer niche
#

Neither of them do

earnest phoenix
#

what does it do?

#

what text editor do you have?

outer niche
#

Open the closest real quick

quartz kindle
#

python files are not supposed to be opened by double clicking

#

they are supposed to be run by python

outer niche
#

My other one opens

earnest phoenix
#

NightzToday at 11:53 PM
that took way to long
because they're a child with probably almost to no past CS experience lol

quartz kindle
#

ie: open the command line in the right folder and type "python yourfile.py"

earnest phoenix
#

@earnest phoenix 😂

outer niche
#

It will not stay open

quartz kindle
#

i told you why

earnest phoenix
#

Do you know basic programming knowledge?

#

@outer niche

quartz kindle
#

you can also google "how to run a python file"

maiden mauve
#

did anyone ask if the PC is plugged in? Thonk

earnest phoenix
#

true 😂

#

have you tried turning it off and on again

maiden mauve
#

Honestly, I try to imagine a positive scenario but if you don't even know the basics of windows file extensions and handling

outer niche
#

I cannot keep the bot running if the python file does not stay open

maiden mauve
#

a "intro to programming" may be in order

earnest phoenix
outer niche
#

Keeping up out open does not have anything to do with python

earnest phoenix
#

@outer niche you obv don't know basic...

maiden mauve
#

@outer niche your in here with a lot of people who have been coding for years and we're all getting the vibe your asking the wrong questions

earnest phoenix
#

if you can't do logical thinking and have no prior experience working with "the behinds" programming is most likely not for you

maiden mauve
#

meaning that your starting in the middle rather than at the root of your problem

earnest phoenix
#

just putting out a TIL

outer niche
#

When file stays open but the two that we just did do not which is where I am confused

earnest phoenix
#

are you following a tut?

outer niche
#

Following what

mossy vine
#

tutorial

earnest phoenix
#

^

outer niche
#

I'm not going to open it

maiden mauve
#

"I don't want a fishing pole, I want to know why my fish isn't cooking"

outer niche
#

I had someone else help me with this last night that kept that file open all the time but the two files that I just did from doing what you guys told me to do does not stay open

earnest phoenix
#

@outer niche, you obviously do not know any basic knowledge of programming, I suggest you to watch some YouTube videos on basics of python. rules state that we shouldn't don't spoon-feed you.

outer niche
#

Now if you guys are really helping me anymore so I'm just going to go find someone that can thank you for your help

earnest phoenix
#

you got help, your problem is that you want someone to do it for you instead of thinking for yourself

#

Rule 7.
" b. If you are a beginner, have a will to learn and do not expect to be spoon-fed."

winged thorn
cursive dagger
outer niche
#

Is that why all my bots ate operational with at least 20 commands each

winged thorn
#

So why can't you get it to work if clearly you know how to code already

maiden mauve
#

you don't even know how to run a single file, but you have multiple bots?

outer niche
#

Yes

winged thorn
maiden mauve
earnest phoenix
#

so it took you like 30 minutes to enable file extensions but you have multiple bots that work....

#

🤔

outer niche
#

Is that a problem

maiden mauve
#

it's highly suspect that you have misinterpreted what people do here

#

you don't answer basic questions about how to program

#

you aren't asking a specific question that makes sense to anyone

earnest phoenix
#

@outer niche all these bots written in python?

outer niche
#

Yes

fast wagon
#

what language are the special bots written it

#

*in

earnest phoenix
#

@outer niche so you have made multiple functional bots in python? but you don't know how to run a file or enable file extensions

fast wagon
#

wut

mossy vine
#

@fast wagon what do you mean by special bots

#

most are made in javascript or python

unique nimbus
#

@mossy vine The role Special Bot they means

#

I think it was written in JS however idk

mossy vine
#

oh yeah

#

im pretty sure theyre js

#

or a js flavor

unique nimbus
#

All Discord Bot Languages has the same functionality its just preference

#

¯_(ツ)_/¯

amber fractal
#

Any reason I'd get 301 when I can open the url in my browser?

unique nimbus
#

what url

amber fractal
#

I've tried it with http and https

unique nimbus
#

I get this

amber fractal
#

yeah

#

it's XML

#

from an api

unique nimbus
#

yes

amber fractal
#

Yeah, trying to get there programmatically is giving me 301

unique nimbus
#

oof

earnest phoenix
#

it's a redirect

amber fractal
#

Yeah I fixed it

#

it wanted www.

#

wait now I'm getting forbidden

#

Outdated api hurts

amber fractal
#

Well I got that to work

#

now Im just having a different problem, I can't seem to concat on my array

#

it doesnt error, but it's just empty

maiden mauve
#

console ftw?

amber fractal
#

I am

#

ftw?

maiden mauve
#

for the win