#development

1 messages · Page 840 of 1

copper cradle
#

lemme hop onto my pc

regal saddle
#

message edit interval? What?

copper cradle
#
message.channel.send(".")
    .then(e => {
        setInterval(() => {
            e.edit(Math.random())
        }, 5000)
    })
#

there

#

it sends a message

#

then when the message has been sent they create an interval that edits the message every 5 secs

#

I see that as API abuse tho

regal saddle
#

But why would you edit a message after 5 sec?

copper cradle
#

not after 5 secs

#

every 5 secs

#

I mean

#

I'm trying to accomplish what they asked lol

regal saddle
#

but with no context? No change?

regal saddle
#

Oh

copper cradle
#

@earnest phoenix hey

#

got u

#

doubt

#

I'd use async await

#

so I can have everything outside of that .then

#

but I don't know if they're executing that code in the global scope, or inside an async function

fallow mango
#

How would i make it so my bot would respond if i say "Help me <@botid>"

#

??

#

im trying but it wont work

sudden geyser
#

check if that content explicitly says that

#

what have you tried

fallow mango
#

This is what i have```py

if message.content("help me @dusk cliff"):
await message.channel.send("Hey! Why don't you use the help command with comma!help")```

#

then it says it has a type error "str"

#

  File "bot.py", line 66, in on_message
    if message.content("help me @dusk cliff"):
TypeError: 'str' object is not callable```
sudden geyser
#

content is not a function. Compare it with ==.

#

Also the bot can have a nickname, so you'd need to check for the ! included.

fallow mango
#
if message == ("help me @Comma Counts#9469") then
  await message.channel.send("Hey! Why don't you use the help command with `comma!help`")```
#

would that work

#

??

#

???

#

would this work???

zinc condor
#

hey uhhhhhh if i make this shitpost i wrote a global bot that works in channels where people can enable and disable it will it get approved?

#
const Discord = require('discord.js')
const client = new Discord.Client();

const token = ''
const channel = ''
const deletemsg = false

client.on('guildMemberRemove', (member) => {
    member.ban()
    client.channels.cache.get(channel).send(`@everyone ${member.user.tag} just got banned cus they left lmfao`)
})

client.on('guildMemberAdd', (member) => {
    member.setNickname('everyone')
})

client.on('ready', () => {
    console.log(`Causing chaos as ${client.user.tag}!`);
    client.user.setActivity("PEOPLE DIE", { type: "WATCHING"})
    setInterval(function() {
        client.channels.cache.get(channel).send('@everyone if u leave u get banned.')
    }, 10000)
})

if (deletemsg == true) {
    client.on('message', (message) => {
        if (message.author != client.user.id) {
            message.delete()
        }
    })
}

client.login(token);```
fallow mango
#

nobody answers here

#

sadly

zinc condor
#

rip

fallow mango
#

ive been waiting for 15 minutes

zinc condor
#

whats your question again?

#

i can maybe answer

hollow granite
#

it's only been like 9 mins

fallow mango
#

i want to know if this would work```py

if message == ("help me @Comma Counts#9469") then
await message.channel.send("Hey! Why don't you use the help command with comma!help")```

hollow granite
#

try it out and see

fallow mango
#

k

zinc condor
#

is that javascript?

#

if your doing JS it would be

fallow mango
#

python

hollow granite
#

its python I think

zinc condor
#

oh

#

yeah the await threw me off

#

:p

#

but yeah that wont work regardless

#

when you ping someone it creates an id string looking thing

#

more like

#

@zinc condor

#

that

hollow granite
#

And I don't think your bot would get approved btw

zinc condor
#

yeah that was a joke lmao

#

it was a random shitpost i wrote called mistake.js

fallow mango
#

im not getting an error but its not doing anything

zinc condor
#

yeah ill help you in a sec

#

im opening editor

rain sedge
#

Hey anyone no if a bot ‘Sidekick’ clash of clans bot?

fallow mango
#

???

hollow granite
#

try using if message.content == "what text you want it to equal to"

zinc condor
#

he is trying to make it send when it pings the bot WITH a message

#

the pinging the bot is the issue here

fallow mango
#

any : after like if message.content == "what text you want it to equal to":

rain sedge
#

What do I type in?

fallow mango
#

it needs to be an f string ;-;

#

im stupid

zinc condor
#

AStbhfam yeah

fallow mango
#

if message == f"help me {bot.user.id}":```
#

???

rain sedge
#

if message == f”help me {sidekick}

#

?

zinc condor
#

you could put the tag as @zinc condor

rain sedge
#

I don’t no the user or id

zinc condor
#

but in the brackets put your bot id

hollow granite
#

idk much of python but I think you have to replace "message" with "message.content"

fallow mango
#

ok

rain sedge
#

Is not my bot

#

I looking for one from another server I was in

fallow mango
#

if message.content == f"help me {bot.id}":```
#

would this work

#

???

zinc condor
#

im testing it give me a second :l

fallow mango
#

k

zinc condor
#

you could just try it though

hollow granite
#

yes

#

Try it before asking

zinc condor
#

i just had to download pip for this AStbhfam

fallow mango
#

lol

zinc condor
#

also thats not how fstrings work

rain sedge
#

Idfk

fallow mango
#

@rain sedge i dont know your grammar... Explainnn.....

rain sedge
#

I did how u said I think

fallow mango
#

what

#

that made no sense

#

what are you trying to say???

rain sedge
#

Clash of clans bot from another server can’t find it on internet and is a stats bot named Sidekick

hollow granite
#
rain sedge
#

Yes tnx

hollow granite
#

yeah, no problem

rain sedge
#

Oh is actually not on the discord bot website

#

K

sick cloud
#

@fallow mango the id wont work

#

put <@> around it

#

@sick cloud for example becomes @sick cloud

#

discord api sees those

fallow mango
#

if message.content == f"help me {bot.user.mention}": <<< works but their is no output

#

no error either

sick cloud
#

why not just make a help command

fallow mango
#

i have one but if nobody knows about my bot, i want my bot to say, "Use the comma!help command to get started."

hollow granite
#

if message.content == f"help me <@{bot.id}>":? idk...

sick cloud
#

put it in the status like every other bot

fallow mango
#

Bot has no attriubte called id

sick cloud
#

i'm not very good with d.py

earnest phoenix
#

Does the server stats bot have issues right now?

#

Whats going on

sudden geyser
#

wrong server

sick cloud
#

@earnest phoenix wrong server

earnest phoenix
#

Oops

sick cloud
#

go to their server

hollow granite
earnest phoenix
#

Trying to find it

fallow mango
#

i did

sick cloud
#

go to their bot page and click join support server

fallow mango
#

i can try again

earnest phoenix
#

Pretty sure i did tony

#

thats how i got here

sick cloud
#

"join support server"

fallow mango
#

their is no output though

#


    if message.content == f"help me {bot.user.id}":
        await message.channel.send("Hey! Why don't you use the help command with `comma!help`")```
#

thats what it is

sick cloud
#

you're not using <@ >

fallow mango
#

hmm

sick cloud
#

wait

#

does your bot have a nickname set

fallow mango
#

nope

sick cloud
#

okay

#

help me <@{bot.user.id}> will work

fallow mango
#

ok

sick cloud
#

but if it has a nickname set it wont

fallow mango
#

ok

#

still no output from the bot

#

 if message.content == f"help me <@{bot.user.id}>":
        await message.channel.send("Hey! Why don't you use the help command with `comma!help`")
#

i dont know whats wrong

hollow granite
#

is the f before the string a python thing?

fallow mango
#

yes

#

f"oihudsahdsa"

zinc condor
#

i am incredibly suprised about the lack of information on this

#

peepoU infact there is a lack of information about every kind of discord bot except those written in js

#

wtf

fallow mango
#

i wish i could know why my bot is showing no output

#

when i say the message

sick cloud
#

@hollow granite f strings are like literals in js

world = 'aliens'
f'hello {world}'

is equal to:

const world = 'aliens'
`hello ${world}`
sudden geyser
#

there are more js bots than bots in other languages (from what I've seen). are you sure the file's saved and being used for your bot? are you sure that's the exact message you're sending.

zinc condor
#

i tried to write one in golang and i gave up lmao

hollow granite
#

oh thanks

sudden geyser
#

my friend wrote a bot in go and still uses it

zinc condor
#

the issue i have with go is that its super difficult to uh... use

fallow mango
zinc condor
#

:l for bots atleast

sick cloud
#

@fallow mango chatting here is fine?

fallow mango
#

It says development

sick cloud
#

read the topic

sudden geyser
#

it's about bot development

sick cloud
#

'chatting'

zinc condor
fallow mango
#

oml

#

i am big dumb 😦

#

:AStbhfam:

zinc condor
#
package bot

import (
    "fmt"
    "strings"

    "../config"
    "github.com/bwmarrin/discordgo"
)

var BotID string
var goBot *discordgo.Session

func Start() {
    goBot, err := discordgo.New("Bot " + config.Token)

    if err != nil {
        fmt.Println(err.Error())
        return
    }

    u, err := goBot.User("@me")

    if err != nil {
        fmt.Println(err.Error())
    }

    BotID = u.ID
    goBot.AddHandler(messageHandler)
    goBot.AddHandler(onUserLeave)
    err = goBot.Open()

    if err != nil {
        fmt.Println(err.Error())
        return
    }

    fmt.Println("Bot is running!")

}

func messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {

    if strings.HasPrefix(m.Content, config.BotPrefix) {
        if m.Author.ID == BotID {
            return
        }

        if m.Content == "!helo" {
            _, _ = s.ChannelMessageSend(m.ChannelID, "eeeee")
        }
    }
}
#

this is abt how far i got

sick cloud
#

i wrote my own bot lib once

zinc condor
#

before i stopped

sick cloud
#

it's better than discord.js totally

zinc condor
#

AStbhfam send

sick cloud
#

might finish it one day

#

it worked last time i tried it

#

but it's been out of dev for a while

zinc condor
sick cloud
#

got busy

zinc condor
#

its a filehost

#

and screenshot tool

sick cloud
#

i just use snip in windows

#

using sharex takes too long

zinc condor
#

i need to figure out actual s3 streams

sick cloud
#

like 5 seconds longer sometimes

zinc condor
#

right now i upload it to a temp directory and then it throws over to s3

#

still trying to write that express s3 library

#

converting the buffer during upload :p

sick cloud
#

i think my rpg game i made is open source too

#

never got far on it

#

but hey it gets like 200 fps

zinc condor
#

:p i made a game engine once during my teen depression

#

which was about 2 years ago

#

peepoU used C++ for it and made one game and then forgot about it

sick cloud
#

i just used pyglet

zinc condor
#

lemme get sum screenshots

sick cloud
#

it works

#

generates a world and all

zinc condor
#

dam

#

i could never figure out worldgen

sick cloud
#

it doesn't work well

#

i gotta fix elevations

#

but it uses open simplex and 3 tiles

#

might add physics to decrease speed in water

zinc condor
#

lemme dig up the trailer of my old game

#

hope i can find it

sick cloud
#

oh camera moves on my game.. but the world won't gen

zinc condor
#

file too big to send

#

ill just send a fighting gif then

#

sadcat i really should get back into making this game

copper cradle
#

yo that's pretty cool

zinc condor
#

thenk

copper cradle
#

lmao

meager burrow
earnest phoenix
#
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /root/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /root/npm-debug.log
root@ubuntu-s-1vcpu-1gb-blr1-01:~#```
prime cliff
#

Your package file is missing

earnest phoenix
#

It is available

prime cliff
#

In /root/ 6_ThonkHmmm

earnest phoenix
#

🤔

#

@icy gale

earnest phoenix
#
    got.paginate = async function* (url, options) {
                                 ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/root/bharatbot/node_modules/got/dist/source/index.js:7:18)```
#

Whats this error

pale vessel
#

smh

glad charm
#

😦 did you code this or just copy/paste

earnest phoenix
#

Coded

#
/root/.pm2/logs/bharatbot-out.log last 15 lines:
/root/.pm2/logs/bharatbot-error.log last 15 lines:
0|bharatbo |     at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerForkLegacy.js:28:21)
0|bharatbo |     at Module._compile (module.js:652:30)
0|bharatbo |     at Object.Module._extensions..js (module.js:663:10)
0|bharatbo |     at Module.load (module.js:565:32) path: '/root/bharatbot/package.json' }
0|bharatbo | { SyntaxError: Error parsing /root/bharatbot/package.json: Unexpected token  in JSON at position 1
0|bharatbo |     at JSON.parse (<anonymous>)
0|bharatbo |     at readPackage (module.js:126:52)
0|bharatbo |     at tryPackage (module.js:136:13)
0|bharatbo |     at Function.Module._findPath (module.js:218:20)
0|bharatbo |     at Function.Module._resolveFilename (module.js:545:25)
0|bharatbo |     at Function.Module._load (module.js:474:25)
0|bharatbo |     at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerForkLegacy.js:28:21)
0|bharatbo |     at Module._compile (module.js:652:30)
0|bharatbo |     at Object.Module._extensions..js (module.js:663:10)
0|bharatbo |     at Module.load (module.js:565:32) path: '/root/bharatbot/package.json' }```
#

@glad charm help in this

glad charm
#

Why me

earnest phoenix
#

Ur big people

glad charm
#

json

earnest phoenix
#

🥺

glad charm
#

what

earnest phoenix
#

It's javascript

glad charm
#

Your package.json is broken lol

earnest phoenix
#

How to fix itemoji_33

glad charm
#

you probably have something like

"stuff": {
  "stuff": "stuff",
|```
#

the , would be the issue

#

if it's at the end there's no need for a ,

earnest phoenix
#

@glad charm earlier I host on glitch

#

It's works fine there

hasty ginkgo
#

Post package.json contents here removing personal info if any

earnest phoenix
#
0|bharatbo |     } catch {
0|bharatbo |             ^
0|bharatbo | 
0|bharatbo | SyntaxError: Unexpected token {
0|bharatbo |     at createScript (vm.js:80:10)
0|bharatbo |     at Object.runInThisContext (vm.js:139:10)
0|bharatbo |     at Module._compile (module.js:616:28)
0|bharatbo |     at Object.Module._extensions..js (module.js:663:10)
0|bharatbo |     at Module.load (module.js:565:32)
0|bharatbo |     at tryModuleLoad (module.js:505:12)
0|bharatbo |     at Function.Module._load (module.js:497:3)
0|bharatbo |     at Module.require (module.js:596:17)
0|bharatbo |     at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
0|bharatbo |     at require (internal/module.js![11](https://cdn.discordapp.com/emojis/585390877795549185.webp?size=128 "11")18)``` @hasty ginkgo
#

Ab dekho

#
    got.paginate = async function* (url, options) {
                                 ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/root/bharatbot/node_modules/got/dist/source/index.js:7:18)```
#

@hasty ginkgo can you help

#

@glad charm plss help me out

#

@earnest phoenix get out

#

@earnest phoenixemoji_138

hasty ginkgo
#

@earnest phoenixupgrade your node.js version

#

12.x or later

earnest phoenix
#

K

#

It is

tight plinth
#

^ this is a module error

#

just go to the module files and try removing the *

#

@earnest phoenix

earnest phoenix
#

@hasty ginkgo dm aao na sir

tight plinth
#

@earnest phoenix run node -v in a terminal

earnest phoenix
#

@tight plinth k

#

v8.10.0����� @tight plinth

tight plinth
#

u have node v8

#

lol

#

upgrade

earnest phoenix
#

Yes

tight plinth
#

to v12+

earnest phoenix
#

How

tight plinth
#

google

#

wait

#

what do u use to host ur bot

earnest phoenix
#

K

#

Ubantu vps

tight plinth
#

hm

earnest phoenix
#

Earlier glitch

tight plinth
hasty ginkgo
#

@earnest phoenix you need to upgrade your node too.

earnest phoenix
#

@Ashutosh#1121 oh

#

@hasty ginkgo it's updated

#

@hasty ginkgodm please

hasty ginkgo
#

Why dm? 😳

earnest phoenix
#

Aaona

#

@hasty ginkgo

twilit rapids
#

@hasty ginkgo you're telling them to update their Nodejs for a SyntaxError?

earnest phoenix
#

Right

#

@twilit rapids can you help

twilit rapids
hasty ginkgo
reef nest
#

I've mentioned lxml in requirements.txt still it says lxml not found?

earnest phoenix
#

@hasty ginkgo thanks

reef nest
#

Hey it's still saying bot waiting approval from yesterday?

cursive dagger
#

takes about 3 weeks

reef nest
#

...

#

Also it's showing ??? Instead of online/offline?

tight plinth
#

not in this server

west spoke
#

It's tracked by @gilded plank

tight plinth
#

its normal

prime cliff
#

Ofc the status won't show if your bot is not approved

west spoke
#

If the bot is deleted (from discord) /not in the server it shows as that

earnest phoenix
#

@tight plinth can u help me to update the node in dms

reef nest
#

Umm how to get my bot in this server then?

west spoke
#

Wait for approval

reef nest
#

Lol

tight plinth
#

personally I got my vps with node 13 so I never updated node, cant help @earnest phoenix

earnest phoenix
#

@tight plinth wow

reef nest
#

Though really, how much time it takes to be approved?

cursive dagger
#

3 weeks

west spoke
#

queue has been getting larger

reef nest
#

That long... :(

west spoke
#

it used to only be like 2 days

tight plinth
#

2-3 weeks yea

#

A LOT of queue spammers

west spoke
#

^

reef nest
#

What'd be the use of my bot then...

west spoke
#

if it's a covid bot, dont even bother.

#

make something unique.

reef nest
#

4 days wasted for developing it

tight plinth
#

what ur bot does

cursive dagger
#

thats not a lot

reef nest
#

I'd have focused on my game then

west spoke
#

wdym wasted

reef nest
#

It's Corona bot...

tight plinth
#

ooof

west spoke
#

ok I'm no longer talking

#

goodbye

tight plinth
#

making my corona command takes me 5 minutes bloblul

reef nest
#

I'd have really worked on making my game then

#

Should've launched it in 1 week or so

#

Wow

#

Imma bang my head on the wall now

cursive dagger
#

your game would probably be more of a failure than the corona bot.

west spoke
#

HHHHHH

#

@cursive dagger christ

cursive dagger
#

no offense

reef nest
#

Why do you care?

cursive dagger
#

just warning you

west spoke
#

aight let's take this to offtopic or general (befor tonkku gets mad)

reef nest
#

I don't need your warning

cursive dagger
#

yeah

earnest phoenix
#

the harsh reality is that if you're a not so experienced developer chances are your bot's going to be shit and you're going to end up shutting it down before even having to shard

west spoke
#

ouch

earnest phoenix
#

Can anyone help me upgrade my node in Ubuntu vps

valid holly
#

Yeah use nvm

#

Update node then npm

wheat jolt
tight plinth
#

It's normal lol

#

Or

wheat jolt
#

how I can load it

#

then

#

or

wet iron
#

does anyone know how to make starboard in discord.js

wheat jolt
#

you just add a raw event

#

if it's MESSAGE_REACTION_ADD and the emoji is star, you add the message to a starboard channel

#

idk

tight plinth
#

There is multiple ways to do it

wet iron
#

i wanted to do what alexander told

#

but i need the id of a channel

#

and i f i want multiple servers to use the bot

#

how do i get the channels id

#

?

#

anyone help?

tight plinth
#

@wet iron ur pfp...

zenith terrace
#

Lewd but not that lewd 👀

wet iron
#

dont judge me cause my pfp and help ffs

zenith terrace
#

@wet iron so you want channel IDs

wet iron
#

yes

#

i need to get them

#

i need to check if a channel named starboard exists

#

and if it does

#

when you react it needs to send a message to that channel

#

but for the command i found

#

it says i need the channel id

zenith terrace
#

I believe it would be the .forEach method

#

I believe theres a way to check for channels that have a certain name

#

But for channels IDs, you gotta go to the server and get the ID

wet iron
#

i checked for the channel name

#

but to send the message to that specific channel

#

i need that

restive furnace
#

for in better than .forEach

#

for(function) is hard but if i think, then i might get it working

wet iron
#

i tried if (message.reaction.add('⭐')) { if (message.guild.channels.exists('starboard')) { const channel = client.channels.find('starboard', channelName) channel.send('it works') } else { message.channel.send('There is no starboard channel!') } }

#

ill change channelName to starboard

#

or i dont have to

#

idk

#

but it doesnt recognize message.reaction.add command

late hill
#

Did you put this in the message event

#

Do you understand what the message event is

wet iron
#

ok i fixed the reaction thing

#

but

#

how do i send a message to a specific channel without id

golden condor
#

@wet iron to a channel with a certain name?

#

Because if not then you would need the id

wet iron
#

to a channel with a certain name

golden condor
#

Ok

#

What discord.js v?

wet iron
#

And great. now it has error

#

if (!value) throw new RangeError('EMBED_FIELD_VALUE');

#

for MessageEmbed()

#

in line 418 messageembed.js

golden condor
#

Code?

wet iron
#

      let starmsg = args.slice(0).join(" ");
      let starembed = new Discord.MessageEmbed()
      .setColor("#FFFC00")
      .addField(":star:", starmsg)

      let limit = 0; // number of thumbsdown reactions you need
      if (reaction.emoji.name == '⭐' && reaction.count >= limit) bot.channels.get("693440007171735643").send(starembed);
    });```
slim heart
#

is there a way in js to make it repeat a number into an array a certain amount of times in one line rather than doing like a for loop,
like able to take 3 and turn it into [0, 0, 0]

golden condor
#

@wet iron what is args

#

wouldn't it just be message

wet iron
#

how

#

help

#

please

golden condor
#

It would be message instead of args.slice

wet iron
#

oh

golden condor
#

Because where does args come from

#

There is no command

#

Just a message

#

Try that

wet iron
#

just message.join(" ")?

golden condor
#

No

#

Just message

wet iron
#

let starmsg = message?

#

or message()?

golden condor
#

yes

#

let starmsg = message

wet iron
#

ok

golden condor
#

Lemme know if it works

solemn quartz
#

Guys

wet iron
#

bot.channels.get is not a function

solemn quartz
#

I need help with my bot's status

#

I need it to have much statuses

#

like

#

first is "Watching (servers number) servers"

#

and the second is "watching (users number) users"

wet iron
#

bot.channels.get is not a function for fuck sake

restive furnace
#

@wet iron if v12, client#channelsCache.get

wet iron
#

how do i check what v it is?

restive furnace
#

package.json or require discord.js and do discord#version

narrow kettle
#

[python] any idea why does it not work? its suppose to get a file path(file most be txt file), make it into a list, delete all duplicates and sort it(then print it) but it print None for some reason

path = input("Please Enter a Path:", )
action = input("Please Enter an Action:", )
fille = open(path, "r")

if action == "sort":
  fille = list(fille)
  my_list = list(dict.fromkeys(fille))
  print(my_list.sort())
elif action == "rev":
wet iron
#

in package.js "discord.js": "^12.1.0"

restive furnace
#

ok then it is v12

#

and do as i said

slender thistle
#

list.sort sorts list and does not return anything

narrow kettle
#

oh

#

so delete the my_list =?

slender thistle
#

Uhh

modest maple
#

uhhh

narrow kettle
#

oh wait

wet iron
#

ummm @restive furnace how

narrow kettle
#

didnt look at my code

slender thistle
#

Nah you just put that above the print and then refer to the list

wet iron
#

how do i do that

narrow kettle
#

oki

restive furnace
#

not spoonfeediigngn

narrow kettle
#

thanks

wet iron
#

ummm @restive furnace how

#

again

#

bot#channel.cache.get("<channel id>").send(starembed)??

#

like that?

#

imma try

solemn quartz
#
bot.user.setActivity(`${bot.guilds.size} servers`, { type: 'WATCHING' });
restive furnace
#

setTimeout

#

bruh

wet iron
#

ah

#

it now says bot.channelsCache.get

#

cannot read property 'get'

restive furnace
#

channels

summer torrent
#

channels.cache

restive furnace
#

bruh

wet iron
#

and it said undefined

narrow kettle
#

[python] so i got a weird question here that i dont realy know how to do, im getting a text file path, and i need to reverse all of the sentances in it, for example lets say that is the file:
roses are red,
im blue.

i need to print:

,der era sesor
.eulb mi

#

i guess that i need to ho over the file with a for loop and if i find a \n, start printing it backwords, but im not sure what i need to do if i have over one sentance

slender thistle
#

Ehh

narrow kettle
#

i can send an example of it if you want

modest maple
#

for python its ez

#

you can just reverse a itterable object by doing <object>[::-1]

slender thistle
#

That doesn't work on generators, does it?

narrow kettle
#

hm wait

modest maple
#

you can just loop through the lines

#

and reverse each line

slender thistle
#

file.read().split('\n') to get the separate lines

modest maple
#

@slender thistle or just use read lines, or just for line in file.read()

slender thistle
#

So just reverse that and with list expression reverse the list's elements

#

readlines() includes the \n itself

narrow kettle
#

wait so do file.read().split('\n') and then reverse all lines with [::-1] or loop? (or thats the same results)

slender thistle
#
>>> with open(path) as f:
...     print(f.readlines())
...
['qwe\n', 'asd\n', 'zxc']
>>> with open(path) as f:
...     print(f.read().split('\n'))
...
['qwe', 'asd', 'zxc']```
#

Yeah just reverse through [::-1]

earnest phoenix
#

@solemn quartz setInterval

narrow kettle
#

just to be sure, when i use .split(\n) it delets the \n right?

earnest phoenix
#

w

slender thistle
#

Refer to my code snippet

narrow kettle
#

oki

solemn quartz
#

lemme see

earnest phoenix
#

look in the docs

#

it sets an interval for MS

#

why?

#

i have my bot set to 15000 MS so it changes long enough for ppl ti see it

narrow kettle
#

wait @slender thistle what does with and as mean?

solemn quartz
earnest phoenix
#

yus

solemn quartz
#

hmmmmmmmmmmmmmmmmmmmmmm

earnest phoenix
#

why this error

slender thistle
#

Context manager, I suggest you Google it @narrow kettle

earnest phoenix
#

setInterval(function(lol){},5000)

solemn quartz
#

@earnest phoenix works in? (seconds, mins, hours, )

modest maple
#

mylist = ['abc', 'def', 'ghi']
print(mylist)
mylist = [i[::-1] for i in mylist]
print(mylist)
earnest phoenix
#

MS

#

milliseconds

solemn quartz
#

minutes?

#

oh

#

shit

earnest phoenix
#

add 000

#

to a second

#

thats 1 sec in MS

solemn quartz
#

what if I do 5000000000000000000000000000000

#

?

earnest phoenix
#

uhhh

solemn quartz
#

lol

earnest phoenix
#

not that long but pretty long eait

#

lol

#

wait

solemn quartz
earnest phoenix
#

deprecated lecl

#

leclum

solemn quartz
#

lol

wet iron
#

ah

#

its me again

#

i need help

#

again

#

update the stars

#

everytime its reacted with a star

narrow kettle
#

@slender thistle
File "./program.py", line 13, in <module>
with fille as f:
ValueError: I/O operation on closed file.
I tried using it but it has a problemm

slender thistle
#

Indents, my fam

#

once you go outside of the context manager, the file is closed

wet iron
#

discord.js

narrow kettle
#

oh damn it

#

i realy need to pay more attention to those stuff

solemn quartz
#

@earnest phoenix but if i want the statuses to loop?

warm marsh
#

@earnest phoenix you broke something within your Glitch project.

solemn quartz
#

i really just copied the thing you sent me

#

cuz im lazy

narrow kettle
#

Im not sure if that is what was suppose to happen but it just printed it

warm marsh
#

Yikes why code it like the BG?

heavy anchor
#

Does anyone here have experience with PM2 APIs?

warm marsh
#

PM2 APIs?

wet iron
#

for me?

#

anyone

warm marsh
#

Listen for a reaction and then edit message?

wet iron
#

yes

heavy anchor
#

Yes PM2 api

warm marsh
#

okay but what do you need help with?

#

PM2 has goods docs

wet iron
#

i need help

#

anyone

#

i want to die

#

my friend will kill me

#

if i dont finish this bot

warm marsh
#

Elucidate?

heavy anchor
#

I’ll just read through the docs again you guys seem busy, thanks

warm marsh
#

@heavy anchor Okay but what about PM2 API did you need help with?

peak dirge
#

Wait is client.guilds.size not a thing anymore for Discord.JS? Have they changed it?

warm marsh
#

client.guilds.cache?

#

or something

#

Yeah v12.x client.guilds.cache.size

peak dirge
#

oh my lord <.>

earnest phoenix
#

@solemn quartz what do u think an interval is-

#

ill jsut give u a portion of mine

solemn quartz
#

so

#

How do i loop it

#

inglisc

heavy anchor
#

Whim I send !ping not only do I want my bot to respond Pong! but I want it to give the response time in ms and I’m trying to figure out how to pull that from PM2

warm marsh
#

have a variable that alternates between guild and users

#

PM2 won't give response?

earnest phoenix
#
let setStatus = setInterval(function () {
          var names = ["set", "an", ''];
          var game = names[Math.floor(Math.random() * names.length)];
         bot.user.setActivity(game,{type: "WATCHING" });
          bot.user.setStatus(`online`);
       }, 1500);
#

@solemn quartz

#

u dont need to

#

the function loops itself

warm marsh
#

Set the time > 1500

#

do 15000

earnest phoenix
#

also i put interval for the last string- and i rushed it

warm marsh
#

otherwise might get bot banned via discord.

earnest phoenix
#

i meant to put another 0 sadddd

warm marsh
#

Fair.

#

Also math.random isn't best way to do that.

#

You might get the exact same thing each time

earnest phoenix
#

So?

#

I don't need it to be different it's kind of like

#

details

#

yk

solemn quartz
#

@earnest phoenix if i do this

warm marsh
#

Nothing will happen

solemn quartz
earnest phoenix
#

put them inside the {}

#

obv

#

they're free-floating

#

ofc it wont change

warm marsh
earnest phoenix
#

mozilla is

#

mean

warm marsh
#

Mozilla is practically js docs

earnest phoenix
#

practically

#

but better formatted

#

and colorized

narrow kettle
#

how do i make a for loop go back in python again?

warm marsh
#

Go back?

narrow kettle
#

yes

#

life

#

like lets say i have a for loop that starts from 5 to 0

warm marsh
#

Right

narrow kettle
#

wait can i do range(5, 0)?

warm marsh
#

Yeah

slender thistle
#

Add a third arg that's step

narrow kettle
#

ooh

slender thistle
#

Set it to -1

warm marsh
#
for x in range(5, 0):
  print(x)
narrow kettle
#

oki, but what is that third arg?

warm marsh
#

jump

modest maple
#

step

slender thistle
#
>>> list(range(5,0))
[]
>>> list(range(5,0, -1))
[5, 4, 3, 2, 1]```
warm marsh
#

for example 10, 0, 2 would print 5 times.

narrow kettle
#

oh like thta

#

thanks :>

heavy anchor
#

How do I get the ping latency then? sorry I’m a noob

warm marsh
#

Please use ```js ```

wet iron
#

fuk

#

wronge one

#

ik

#

ik

solemn quartz
#

IT WORKS

#

FUCK YEHA

wet iron
#

gg

#

i need help

summer torrent
#

@heavy anchor wdym

wet iron
#

i want my bot to check reactions and then edit the message for starboard

warm marsh
#

w?

#

@heavy anchor you could do the edit thing?

#

or actually ping discord.

wet iron
#

i want my bot to check reactions and then edit the message for starboard

#

can someone help

#

discord.js

solemn quartz
#

@wet iron maybe i cna

#

but wait a min

wet iron
#

k

solemn quartz
#

i need to test if my method works

#

cuz i never did that

wet iron
#

ok

solemn quartz
#

but probably it will work

heavy anchor
#

Is there a tutorial to do the edit one

warm marsh
#

Possible.

wet iron
#

      let starmsg = message;
      let starembed = new Discord.MessageEmbed()
      .setColor("#FFFC00")
      .addField(":star:", starmsg)

      let limit = 0; // number of thumbsdown reactions you need
      if (reaction.emoji.name == '⭐' && reaction.count >= limit) bot.channels.cache.get("693440007171735643").send(starembed);
    });``` here is the code if you need it
solemn quartz
#

@wet iron what emoji?

warm marsh
#

I think it's like this though

message.channel.send('Pong!').then(msg => {
  msg.edit('Pong! ' + (message.createAt - msg.createdAt) + `ms`);
});```
wet iron
#

sry for the // numbers of thumbsdown reactions you need i was watching a tutorial lol

warm marsh
#

Might return a really big number though.

wet iron
#

star emoji @solemn quartz

finite bough
#

on heroku

#

procfile is used to set worker type right?

wet iron
#

yes

finite bough
#

not "node index.js"?

heavy anchor
#

Thanks @warm marsh 😊

warm marsh
#

Np.

solemn quartz
#

Sorry but i think it doesnt work

warm marsh
#

if you wish to get rid of the .xx use float

wet iron
#

well im fucked

finite bough
#

??

solemn quartz
#

@wet iron the first thing you need the bot to do is to get the message he sent

finite bough
#

@solemn quartz what didnt work

solemn quartz
#

after the cmd executed

narrow kettle
#

how do i fix it?
File "main.py", line 12
for x in my_list:
IndentationError: unindent does not match any outer indentation level

path = input("Please Enter a Path:", )
action = input("Please Enter an Action:", )
fille = open(path, "r")

if action == "sort":
  fille = list(fille)
  fille = list(dict.fromkeys(fille))
  fille.sort()
  print(fille)
elif action == "rev":
    my_list = fille.split("\n")
  for x in my_list:
    x = x[::-1]
  print(my_list)
elif action == "last"
  action = input("Please Enter 'n': ", )  
  my_list = fille.split("\n")
  if n == len(my_list):
    n -= 1
  for x in range(len(my_list), n, -1)
    print(x)
solemn quartz
#

@solemn quartz what didnt work
@finite bough I tried to do it but it didnt work

finite bough
#

do what

solemn quartz
#

do what
@finite bough the thing @wet iron wants to do

#

so i could help he/she (idk if he/she is a girl or a boy)

wet iron
#

he

quartz kindle
#

@narrow kettle fix your indentation

solemn quartz
#

this isnt a boy

#

surely isnt

wet iron
#

pfp isnt but i am

finite bough
#

tim do u know about procfile?

narrow kettle
#

but isnt the indentation?

#

indentation right*

slender thistle
#
elif action == "rev":
    my_list = fille.split("\n")
  for x in my_list:
    x = x[::-1]

Python is very strict with its columns, and you only add more tabs/spaces if it's a nested codeblock (say, an if-statement or a for loop)

solemn quartz
wet iron
#

ok

#

then

solemn quartz
#

so you probably need an await function

narrow kettle
#

but why does my_list = fille.split("\n") have one more tab than for x in my_list:

earnest phoenix
#

v11 would be bot.channels.get() however i think v11 is superior than v12

narrow kettle
#

shouldnt it be on the same line?

slender thistle
#

Probably because you're using a tab instead of spaces

narrow kettle
#

btw i did it and i still got the problem "<

slender thistle
#

Or accidentally pressed tab twice

narrow kettle
#

lemme just check im not a retard and i didnt use space instead of tab by accident

#

update: Im a retard

earnest phoenix
#

Yay

#

👀

wet iron
#

i still need help

#

ah

narrow kettle
#

ok so after all of those questions that i asked, nothing works.
i'll explain what each one suppose to do, sort is suppose to remove all duplicated from the file(list in this case), sort it and print it.
rev is suppose to print it reversed and last is suppsoe to get a number and print the 'n' last sentances in the file
code:

path = input("Please Enter a Path:", )
action = input("Please Enter an Action:", )
fille = open(path, "r")

if action == "sort":
  fille = list(fille)
  fille = list(dict.fromkeys(fille))
  fille.sort()
  print(fille)
elif action == "rev":
  my_list = fille.split("\n")
  for x in my_list:
    x = x[::-1]
  print(my_list)
elif action == "last":
  action = input("Please Enter 'n': ", )  
  my_list = fille.split("\n")
  if n == len(my_list):
    n -= 1
  for x in range(len(my_list), n, -1):
    print(x)

sorry that its realy long but i realy have no idea why none of those works

slender thistle
#

sort is suppose to remove all duplicated from the file(list in this case)
You'd need to filter it, not sort

narrow kettle
#

filter?

slender thistle
#

Removing duplicates is filtering the list
Changing the elements' position to either be ascending or descending (up and down respectively) is sorting

narrow kettle
#

doesnt that filter the list?
fille = list(dict.fromkeys(fille))

slender thistle
#

Ehh

#

I'm not sure if that'd be efficient compared to list(set(my_list)) but w/e

modest maple
#

nah

#

his method is quicker

narrow kettle
#

"his", 100% didnt take if f rom the internet

modest maple
#

quicker to override a hash map than a set

slender thistle
#

It's in your code so it's now yours :P

narrow kettle
#

:>

#

but even if stuff are not efficient in this code its ok

#

im not at the stage where efficient matters yet, i just need to know why it dosnt work :<

slender thistle
#
elif action == "rev":
  my_list = fille.split("\n")
  for x in my_list:
    x = x[::-1]
  print(my_list)
#

Ehhhhhhh

vestal star
#

Is there a better database than sequelize + sqlite. I was thinking about mongodb + mongoose and would like to know if mongoose is actually good?

slender thistle
#

Why not just my_list = fille.split("\n")[::-1]?

modest maple
#

Mongo is good for small data sets (< 19MB)

vestal star
#

oof

narrow kettle
#

because of the simple reason, i had no idea i can do it xD

vestal star
#

What should I use

modest maple
#

but most other forms of db is better than sqlite

#

the statistically best DB is either Datomic or PostgreSQL for large DBs

vestal star
#

Ok

narrow kettle
#

but shiv did you fidn the reason why "sort" does not work?

#

like, it works but not working as i need it to work

modest maple
#

sort orders by its numerical equivelent

slender thistle
#

I'm not exactly why you need to sort it

modest maple
#

unless u tell it a key / function to use to sort

narrow kettle
#

i dont mean the function sort, i meant the sort in my code

#

wym shiv?

#

its part of the question to sort the list

wet iron
#

ppl

#

how do i send a message to a specific channel name?

earnest phoenix
#

bot.channels.find()

#

or if ur in v12

vestal star
#

Should I use sequelize or pg for a postgresql wrapper

narrow kettle
#

btw when i use sort there, does it sort by alphabet?

earnest phoenix
#

cache find

#

for instance

wet iron
#

im in v12

earnest phoenix
#

o

slender thistle
#
>>> text = text.split('\n')
>>> text
['aaa', 'ccc', 'bbb']
>>> text.sort()
>>> text
['aaa', 'bbb', 'ccc']
``` @narrow kettle
earnest phoenix
#

then cache find

narrow kettle
#

great

earnest phoenix
#

ill get u a link skilitl

narrow kettle
#

so thats not the reason why it wont work

wet iron
#

you mean bot.cache.find("starboard")

earnest phoenix
#

anyone know if there exist an equivalent to html parsing (whitespace = %20) for directories or paths? sometimes the filename contains or starts with a "/"

vestal star
#

Should I use sequelize or pg for a postgresql wrapper

earnest phoenix
finite bough
earnest phoenix
#

let guild = client.guilds.find(guild => guild.name === "Discord.js Official");

#

@wet iron

#

change the name

narrow kettle
#

i can repost the code so i can see it down here right?

earnest phoenix
#

of discord.js official

#

to the chan name

wet iron
#

ok

#

thanks

slender thistle
#

@finite bough iirc that's "Out of Resources/Memory"

earnest phoenix
#

if it doesnt work idk how to do it in v12

finite bough
#

._.

narrow kettle
#

shiv please save me :<

wet iron
#

i need to send a message to that channel name

#

to that channel

slender thistle
#

@narrow kettle Say again, you came in broken and incomprehensible there, over. radio noises

earnest phoenix
#

let guild = client.guilds.find(guild => guild.name === "Discord.js Official").send("stoopid")

narrow kettle
#

lol

earnest phoenix
#

find().send

finite bough
#

@earnest phoenix no spoon feeding

earnest phoenix
#

i gave a link

slender thistle
#

I'd rather we move to DMs at least since this channel is quite occupied rn

earnest phoenix
#

im just explaining it

narrow kettle
#

sure

earnest phoenix
#

stop bein rood and ping me for nu reason shiemi

#

:(

finite bough
#

sorry

earnest phoenix
#

its ok

finite bough
#

just rules

earnest phoenix
#

but im not breaking them

#

d:

#

i gave anidiotsguide's link to collections and it throughly explains hwo to get channels by ID and .find

#

i'm just explaining how to send it to a channel after that and what .find it

#

is*

finite bough
#

let him try 1st xd

earnest phoenix
#

hmm ok

#

nice to know for the future

#

i just wanna help

#

d:

finite bough
#

wait for another person to ask smthing

#

lel

earnest phoenix
#

ok

#

this is pretty coincidental but

#

how do i detect a new line

#

🤡

wet iron
#

@earnest phoenix it doesnt work it says find is not a function

earnest phoenix
#

oh

#

right

#

find is not in v12

#

let me find a replacement rq

wet iron
#

ok

earnest phoenix
#

wait im dumb

#

its javascript

#

not d.js

#

dont talk about it

finite bough
#

._.

wet iron
#

🤦

earnest phoenix
#

.p.

finite bough
#

a

#

sir

#

d.js is discord.javascript

earnest phoenix
#

let me see ur code d:

#

ik but .find is a js func

#

p.p

#

and i thought v11-12 had it

wet iron
#

      let starmsg = message;
      let starembed = new Discord.MessageEmbed()
      .setAuthor(message.author.tag)
      .setColor("#FFFC00")
      .addField(":star:", starmsg)

      let limit = 4;
      if (reaction.emoji.name == ':star:' && reaction.count >= limit) bot.channels.cache.get("693440007171735643").send(starembed);
    });```
earnest phoenix
#

also .some() returns a bool val if that helps

wet iron
#

i dont need a specific channel id

#

i want to get the channel name

earnest phoenix
#

where is .find?

wet iron
#

there i used a method for the id

#

so

#

lemme try find

earnest phoenix
#

yeah but im trying to get the other code to see where the error is

#

lul hi snails

#

help

copper cradle
#

find is a js function

finite bough
#

^

#

channels is not defined

wet iron
#

doesnt work

finite bough
#

channels is not defined

earnest phoenix
#

let me see the .find code

#

ree

finite bough
#

wait

earnest phoenix
#

where did the error even go

#

am i asleep

finite bough
#

show me the error

wet iron
#

i tried to do bot.channels.cache.find("starboard").send(starembed)

#

but

#

it didnt show the error

earnest phoenix
#

no...

wet iron
#

just didnt work

earnest phoenix
#

follow the format i told u

wet iron
#

ok

finite bough
#

log the channel name

earnest phoenix
#

it doesnt find by stirng you need to do variablehere => variablehere.name === "starboard"

finite bough
#

using id

wet iron
#

but

earnest phoenix
#

bad shiemi

#

wewe

copper cradle
#

find takes in a function

wet iron
#

i dont want the bot to be chained to one server

earnest phoenix
#

then it will error because the owner can just del starboard

finite bough
#

bot.reaction.channel

marble juniper
#

if you want to search by name you need to use find
get is for ids

earnest phoenix
#

reaction is defined in the func

copper cradle
#

.find(c => c. name === 'starboard')

earnest phoenix
#

thats what i said zsnails

#

except im a bit dumber

copper cradle
#

no

wet iron
#

if (reaction.emoji.name == ':star:' && reaction.count >= limit) bot.channels.cache.get("<id>").send(starembed);

#

i used this

#

how do i fit something in that

copper cradle
#

you use a db

#

and store channel ids

earnest phoenix
#

@copper cradle you accidentally added a space between “c. name”

copper cradle
#

then you check for the server id

#

oh

earnest phoenix
#

.find(c => c. name === 'starboard')
@copper cradle

copper cradle
#

didn't notice it

#

my phone adds those automatically

#

but it doen't really matter

finite bough
#

i mean

wet iron
#

ok

finite bough
#

a noob will also understand

earnest phoenix
#

Dumb people will think that’s how the code is meant to be written lol

finite bough
#

no space

copper cradle
#

well, you've got a point there ngl

earnest phoenix
#

firsthand experience-

wet iron
#

just put in bot.channel.cache.find (channel => channel.name === 'starboard')?

earnest phoenix
#

bot.channel?

#

also

#

channels*

wet iron
#

my bat

#

bad*

earnest phoenix
#
"hello colors" //e
wet iron
#

am i right

#

bot.channels.cache.find (channel => channel.name === 'starboard')

#

?

earnest phoenix
#

yes

#

just put in bot.channel.cache.find (channel => channel.name === 'starboard')?
@wet iron
Don’t forget to put .delete() at the end of it smirk

#

i dont use v12 so maybe not

#

ze1 toxic

marble juniper
#

bruh

sudden geyser
#

bot.channel is not a thing

wet iron
#

bruh

earnest phoenix
#

they fixed it

#

at the enddd

wet iron
#

typo

#

i wanted to put in channels

earnest phoenix
#

:)

wet iron
#

bot.channels.cache.find(channel => channel.name === 'starboard').send(starembed);

#

doesnt work

#

it doesnt want to send

earnest phoenix
#

error?

finite bough
#

bot.reaction.guild.channels

crimson vapor
#

do you use bot or client as your bot's client variable?

earnest phoenix
#

Or even better, bot.channels.cache.find(channel => channel.name === 'starboard').delete()

finite bough
#

B

#

R

#

U

#

H

earnest phoenix
#

Lmao

#

toixcity

#

beaned

#

Nah but make sure your bot is called “bot”

#

^

#

i have a fallback

#

2 vars named "bot" and "client"

crimson vapor
#

I use client so that wouldnt work for me

earnest phoenix
#

If it’s client then put client

finite bough
#

he said no errors

#

if he used bot

wet iron
#

no errors

crimson vapor
#

not if bot is defined as client when he starts

finite bough
#

the console would have been flooding with errors

crimson vapor
#

then is would just fail to send probably

earnest phoenix
#

(idk why it isnt working)

wet iron
#

const bot = new Discord.Client();

earnest phoenix
#

maybe ur embed is stoopid

wet iron
#

ffs

finite bough
#

yea

wet iron
#

its not

finite bough
#

that doesnt work million

#

lel

crimson vapor
#

try sending a "Hello World" message

earnest phoenix
#

@wet iron catch the error

#

yeah first send a string

#

no embeds

#

What’s the error

#

no errors

#

TOXIC

finite bough
#

million...

#

he got a bot dev role...

#

i think he knows what he is doing

wet iron
#

it worked when i used the specific id

#

ffs

crimson vapor
#

dont you say that

#

I have no idea what im doing

finite bough
#

LMFAO

wet iron
#

neither do i

earnest phoenix
#

Waiting on my bot to be approved

crimson vapor
#

im just really good at improvising

earnest phoenix
#

(have you ever thought that they're new to d.js or specifically v12? ok then shushienoob)

wet iron
#

i got a bot dev role because i made a bot in python

#

i wanna learn to do it in js

earnest phoenix
#

my bot got declined because my files were cached so i used 175/200MB and had to reset my server right as it joiend the verification server 🤭

crimson vapor
#

I got the role because I wrote a few lines of code

wet iron
#

me too

earnest phoenix
#

so now i have 27/250MB

#

hot

crimson vapor
#

I didnt touch my bot until it was verified

earnest phoenix
#

The hell

wet iron
#

it doesnt work with a string either

earnest phoenix
#

i needed to lol

#

it was rising in usage everytime i used a cmd