#development

1 messages Β· Page 793 of 1

grizzled raven
#

and hold on, $3?

#

wait

quartz kindle
#

1 cpu, 1gb ram

late hill
#

there's 3 bots on mine

grizzled raven
#

oh nvm actually

late hill
#

it's like 60k guilds total

grizzled raven
#

i have 2gb ram and like twice the storage

late hill
#

but half of em probably never do anything

#

unnecessary data wearybread

grizzled raven
#

oof

#

wait whats your host then?

late hill
#

contabo

grizzled raven
#

oh yeah

#

i was considering contabo

#

but i had to buy a domain with it, and

#

and i was impatient and didnt want to figure their website out LUL

late hill
#

outdated website design

#

yes

quartz kindle
#

contabo's prices + the ugly design makes it look like a scam

modest maple
#

but their actual services aint bad

knotty fiber
#

hello! can someone give some tips how to make customizable prefixes for servers? i'm using discord.js, mysql and mysql library and but can't figure it out

#

adding to database and so on was quite easy but the prefixes, i just can't get it

quartz kindle
#

create a table for guilds

knotty fiber
#

yeah i got that

#

guildID | prefix |

quartz kindle
#

good

#

now for starters, when you receive a message, make a database query to retrieve the guild row and get its prefix

#

if the query doesnt return anything, default it to the default prefix

earnest phoenix
#

Or. Just when you create the bot

#

Or is that a python only thing?

knotty fiber
#
`SELECT prefix FROM servers WHERE serverID IN (${guild.id})`;```
#

like this?

quartz kindle
#

a sample code would be something like this js client.on("message", message => { database.query(`SELECT * FROM guilds WHERE guildid = ${message.guild.id}`).then(result => { let prefix = result ? result.prefix : "defaultprefix"; }) })

#

assuming your db library supports promises

#

now this is enough for a basic bot, but as your bot grows, you will need to add a cache layer

#

to avoid hitting the database too frequently

knotty fiber
#

yeah i was thinking about that too

#

sounds like it'd get resource heavy

quartz kindle
#

a sample code would be js client.on("message", async message => { let prefix = prefixCache.get(message.guild.id); if(!prefix) { await database.query(`SELECT * FROM guilds WHERE guildid = ${message.guild.id}`); if(result) { prefixCache.set(message.guild.id,result.prefix); prefix = result.prefix; } else { prefix = defaultPrefix; // optionally set it to cache as well, so it doesnt attempt to repeatedly query the database for non-existent guilds } } })

earnest phoenix
#

wait

#

so

#

@quartz kindle

quartz kindle
#

me

knotty fiber
#

thanks a lot!

earnest phoenix
#
def get_prefix(bot, message):
    prefixes = ['%','>']
    if not message.guild:
        return '%'
    return commands.when_mentioned_or(*prefixes)(bot,message)


bot = commands.Bot(command_prefix=get_prefix)
knotty fiber
#

πŸ‘Œ

earnest phoenix
#

js doesnt have something similar?

#

and also wtf are promises. i hear the word a lot

modest maple
#

async futures being returned

quartz kindle
#

discord.js does not have a built in prefix handler

modest maple
#

d.py is the only lib with a inbuilt command handler like that

earnest phoenix
#

OH WAIT that client.* syntax kinda looks like pre-rewrite discord.py

#

ohhh

quartz kindle
#

also, your example shows predefined prefixes, not user-defined prefixes stored in a database

earnest phoenix
#

well yea

#

but it can be stored in a db

#

but ansura doesnt have configurable prefixes yet

modest maple
#

also you have a syntax error iirc in that code

earnest phoenix
#

nope

modest maple
#

either that or youre attempting to index a tuple with a tuple

#

on a function aswell

#

xD

quartz kindle
#

its so hard for me to understand python, it just looks so weird

#

lmao

earnest phoenix
#

btw i'm pretty sure commands.when_mentioned_or returns a function @modest maple

quartz kindle
#

btw does d.py still have that default "invalid command" message? o was it already removed

modest maple
#

its still a thing if it cant find the command

earnest phoenix
#

ye.

#

but

#
class ErrorHandler(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        print("Error handler loaded")

    @commands.Cog.listener()
    async def on_command_error(self, ctx: commands.Context, error: Exception):
        if hasattr(ctx.command, 'on_error'):
            return

        ignored = (commands.CommandNotFound, commands.UserInputError)

        error = getattr(error, 'original', error)

        if isinstance(error, ignored):
            return

        elif isinstance(error, commands.MissingPermissions):
            await ctx.send("You can't do that! >.>\n" +
                           str(error))

        elif isinstance(error, commands.BotMissingPermissions):
            await ctx.send("Oops. Doesn't look like I was given the proper permissions for that!\n" +
                           str(error))
modest maple
#

i dont use the inbuilt handler personally

earnest phoenix
#

you can supress it

quartz kindle
#

yeah, but isnt it bad design to have it enabled by default?

modest maple
#

not rlly

#

it only triggers if its got a command loaded

#

that it then cant reference

earnest phoenix
#

or if you type %ajhdskfhdgkjerfjdkgfdlehbfrguifrgkhbfjgrkfn

quartz kindle
#

thats the point, bots should ignore invalid commands, not reply to them

earnest phoenix
#

noo it does in console

#

it doesnt reply in chat

#

just console

#

I didn't know that there was promises in python πŸ€”

quartz kindle
#

it used to reply in chat iirc

earnest phoenix
#

there arent promises tho?

#

that ik of

#

we have async/await

modest maple
#

pst

#

they are futures

earnest phoenix
#

xD

#

πŸ˜‚

#

That's a pretty cool name

modest maple
#

theyre python's version of promises

earnest phoenix
#

see i dont understand the whole future/promise thing. i have a LOT of trouble with some of the asyncio things cuz of that

modest maple
#

asyncio is amazintg

#

on of my fav libs

quartz kindle
#

is tuple an array?

modest maple
#

no

#

tuple is just an imputable object

earnest phoenix
#

ye

modest maple
#

python does have arrays which are good for fast data set movement

earnest phoenix
#

also i remember when i wrote code to ping a mcpe server. its the only time i will ever use socket i stg

modest maple
#

but they can still be edited

earnest phoenix
#
@commands.command(pass_context=True)
    async def bping(self, ctx: discord.ext.commands.Context, url: str, port: int = 19132):
        try:
            if len(url.split(":")) == 2:
                port = int(url.split(":")[1])
                url = url.split(":")[0]
            sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            sock.setblocking(False)
            sock.settimeout(10)
            sock.sendto(bytearray.fromhex(
                "0100000000003c6d0d00ffff00fefefefefdfdfdfd12345678"), (url, port))
            data, addr = sock.recvfrom(255)
            status = data[35::].decode("ISO-8859-1").split(";")
            e = Embed()
            e.title = url
            e.description = re.sub("[Β§Γ‚].", "", status[1])
            e.add_field(name="Players", value=status[4] + "/" + status[5])
            e.add_field(name="Version", value=status[3])
            e.add_field(name="Protocol", value="v" + status[2])
            e.add_field(name="World Name",value=re.sub("Β§.", "", status[7]))
            e.add_field(name="Default Gamemode",value=status[8])
            await ctx.send(embed=e)
        except socket.timeout as t:
            await ctx.send("*Oops ):*\n Looks like the ping I made to " + url + ":" + str(port) + " timed out. "
                            "Either the server is down, not responding, or I was given a wrong URL or port.")
        except socket.gaierror as e:
            await ctx.send("I can't figure out how to reach that URL. ): Double check that it's correct.")
            return
        except Exception as e:
            await ctx.send("*Uh-oh D:*\n An error happened"
                           " while I was pinging the server.")
            print(e)
quartz kindle
#

ah so tuples cannot be edited?

earnest phoenix
#

this hurt my brain to do

modest maple
#

mhmm

earnest phoenix
#

i will wanna write a bot that can join an mcpe server and mirror chat

#

but i cant get past the first handshake

modest maple
#

Cry's done that before

#

xD

quartz kindle
#

im pretty sure i've seen something like that before as well

earnest phoenix
#

@earnest phoenix tell me your secrets

modest maple
#

diffrent language thos

earnest phoenix
#

for minecraft BEDROCK?

#

not java

#

but bedrock?

quartz kindle
#

dont remember

modest maple
#

no

#

why would you use bedrock

earnest phoenix
#
(node:9724) UnhandledPromiseRejectionWarning: ReferenceError: cmd is not defined
    at Client.<anonymous> (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\index.js:64:3)
    at Client.emit (events.js:333:22)
    at MessageCreateHandler.handle (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)    
    at WebSocketPacketManager.handle (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:321:20)
    at Receiver.receiverOnMessage (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\ws\lib\websocket.js:789:20)
    at Receiver.emit (events.js:321:20)
(node:9724) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)     
(node:9724) [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 tell me what's up with that?

#

i run bedrock and java servers

#

"cmd is not defined"

modest maple
#

also u think normal futures are annoying

#

wait till you try multithreading async

earnest phoenix
#

you accessed a variable before you declared it @earnest phoenix

#

i attempted to write a thing to sandbox a mc server program and send i/o to-from but i gave up

#

Or you din't defined var. cmd

#

we should have roles for the libraries we use

modest maple
#

nah

earnest phoenix
#

i did it for java

#

oh ):

#

i want to play around with bedrock though

#

just didn't get around to doing it

#

school is killing my free time

#

^^

#

i mean if you ever wanna collab and try

#

i don't like working with other people most of the time but i don't mind sharing tips and tricks etc

#

ohhh

#

oki

modest maple
#

you guys ever just wonder why exactly you started storing some Ids but dont use them

earnest phoenix
#

wha

modest maple
#

my logs are just full of that

#

xD

earnest phoenix
#

w h y

modest maple
#

cuz webhooks

#

lots and lots of webhooks

earnest phoenix
#

wh

modest maple
#

also pretty sure the global webhook ratelimit is pathetic af

#

or my Internet just dies when it sends them

earnest phoenix
#

xD

modest maple
#

its like 5/s

#

which is

#

meh

#

could do with being higher xD

solemn quartz
#

FINALLY I HAVE NITRO athink

earnest phoenix
#

o

solemn quartz
modest maple
#

yeh okay enough of that

solemn quartz
#

xd

valid holly
#

@summer torrent would you please like to give me a link to the docs for parseEmoji() as I can’t find it.

summer torrent
#

i can't find it on docs

knotty fiber
#

@quartz kindle seems like my db library doesn't support promises

solemn quartz
#

@summer torrent

#

U online?

summer torrent
#

yes

solemn quartz
#

Watttttttttttttttttaaaaaaaaaaaaaaaaaaaaaa

#

Btw im in like 5 servers what are discord partners but discord bot list isnt a discord partner...

#

I wanna die

summer torrent
#

yes

solemn quartz
#

Hey @summer torrent Are u english? Im italian

#

And btw i would like to do a currency system on my bot, can u help me?

summer torrent
#

Hey @summer torrent Are u english? Im italian
@solemn quartz i am azerbaijanian

#

sure

solemn quartz
#

: D

#

@solemn quartz i am azerbaijanian
@summer torrent Google Translate Im Coming To You

#

So what's the first thing i need to do

#

I need to do a folder?

summer torrent
solemn quartz
#

ty

#

THIS IS SO MUCH LONG

modest maple
#

welcome to coding

solemn quartz
#

Imma see a shorter yt video 200iq

modest maple
#

how not to learn shit

solemn quartz
#

-bots @modest maple

gilded plankBOT
modest maple
#

the docs arnt long for no reason

solemn quartz
#

hmm

#

hmmmmmmmmmmmmmmmmmmmmmmmmmm

#

@earnest phoenix

quartz kindle
#

@knotty fiber then you need to use callbacks

#

and create your own promises

solemn quartz
#

@earnest phoenix

modest maple
solemn quartz
#

ik

#

i was unlocking the names

#

cuz i looked at them i was seeing the ids

unborn steeple
#

How would I get the number of votes my bot has in javascript

summer torrent
#

dbl.getVotes()

digital ibex
#

how do i make two bots be online with the same VPS on filefilza?

quartz kindle
#

make one folder for each bot

#

then use a process manager like pm2

digital ibex
#

Tim, I already got two folders per bot, but when i put on into the VMs side it goes in my other bots folder

#

@quartz kindle

quartz kindle
#

lost is your user/profile folder

#

it should be /lost/bot1 and /lost/bot2

#

at least thats what it looks like

astral yoke
#

I have a question, for js, so with top.gg, you're able to make it so when someone votes for your bot, it would say it in like a #votes channel. Something like (Bot): @astral yoke has voted for (Bot) on top.gg! Thank you!

#

How would you make that?

modest maple
#

get vote

#

well actually

#

wait for vote event

#

on vote event

#

send message to channel

#

you can get the user from the userid given to you from the site

digital ibex
#

oh

quartz kindle
#

@astral yoke use webhooks with dblapi.js

astral yoke
#

I've never heard of dblapi.js.

quartz kindle
astral yoke
#

Rt.

#

Ty*

#

Vouch.

vestal star
#

just gonna ask, could I send a user a dm, if they react with a certain symbol?

copper cradle
#

You can do anything

#

Why would you ask this

tame ginkgo
#

Fr ^^^

#

And y do you need to ask in multiple channels

copper cradle
#

these white names Β―\_(ツ)_/Β―

tame ginkgo
#

Shush

#

Lol

vestal star
#

Lol, my main @earnest phoenix got banned from disc... making a new bot

#

It was not banned from this server

tame ginkgo
#

I posted mine on the 6th and they said it takes about 2 weeks so it should be soon @copper cradle

copper cradle
#

@tame ginkgo I wasn't referring to u lol

tame ginkgo
quartz kindle
#

you can use either the reaction add event or attach a reaction collector to a message

#

depends on the language and library you're using

vestal star
#

@quartz kindle what I am doing is making it so that on every reaction, depending on the symbol and content (image or not) to send the user a DM with a link

quartz kindle
#

yes that should be fine

#

(i misread and thought you were asking how)

vestal star
#

okay ty

topaz kite
#

Snd

broken shale
#

anyone use mongodb?

quartz kindle
#

many people do

earnest phoenix
#

How Can I Make A YouTube ViewBot

simple barn
#

Frick

#

How do I know when my bot is approved

broken shale
#

I am getting this error

Cannot connect to the MongoDB at 127.0.0.1:48382.

Error:
No such cmd: saslStart``` (MongoDB v2.4 because of Rasp pi 4B, tried getting a newer version but no luck) Is there a reason for this error/any way to fix this?
quartz kindle
#

@simple barn luca will dm you

simple barn
#

Oh

hushed berry
#

why are you using such an old version Thonk @broken shale

broken shale
#

@hushed berry I tried upgrading it to at least v3.x but the pi runs on 32 bit

#

and mongo requires 64 bits

earnest phoenix
#

run a vm

#

on a pi

#

for a 64 bit os

#

do it you wont

broken shale
#

Any suggestions on which one is the better ones to pick from?

#

I tried to boot ubuntu but that was a complete failure

earnest phoenix
#

i was kidding

#

a vm on the pi is a bad idea

quartz kindle
#

just backup and install an x64 image

earnest phoenix
#

or that

broken shale
#

Damn raspbian suks

earnest phoenix
#

Anyone here

manic light
#

ye

earnest phoenix
#

Do you how to setup lavalink on my mobile

#

I have vps

manic light
#

no :(

earnest phoenix
#

Ohk

amber fractal
#

Any reason why usr/bin/env: Not a directory would ever happen? Google didnt help me with anything (including adding it to path and doing permissions)

copper cradle
#

/usr/bin/env

amber fractal
#

I just didnt copy it all, but still the same

#

using ls in /usr/bin

earnest phoenix
#

pretty sure it's one of those virtual directores maybe?

#

i cant ls /usr/bin/env/ either

amber fractal
#

that was the ls command in /usr/bin showing that it exists

earnest phoenix
#

ik

#

but if you try to do what i did, which should have listed the files in env

#

it throws that error

#

so its either some sort of virtual directory or a mount point of some sort

sudden geyser
#

well, would it be a directory?

earnest phoenix
#

judging by what i'm reading rn, no

#

btw, if you do ls -F it shows if a file is a dir or not @amber fractal

amber fractal
#

Tensorflow is just trying to access usr/bin/env/python for building

#

Which is my problem

#

And it doesnt seem to exist

earnest phoenix
#

hm

amber fractal
#

here's the error exactly, I was trying some stuff but nothing worked /usr/bin/env: 'python': Permission denied

#

I'm running as root

earnest phoenix
#

you shouldnt have to run as root unless you're installing

amber fractal
#

I am building tensorflow from source

earnest phoenix
#

can you post the entire stack trace

#

?

amber fractal
#

That's all it really gives but yeah

#
/usr/bin/env: 'python': Permission denied```
earnest phoenix
#

what are you running on?

amber fractal
#

Ubuntu 18.04

earnest phoenix
#

so a laptop or pc

amber fractal
#

Well it's a dedicated server so a pc I'm guessing

earnest phoenix
#

well as long as its not arm

amber fractal
#

How would I check?

earnest phoenix
#

uname -m

#

but i doubt it is

#

i only mention arm cuz tensorflow wont build on my pi

amber fractal
#

nah x86_64

#

which is 64 bit

earnest phoenix
#

ik

#

have you tried using an earlier version of tensorflow?

amber fractal
#

I tried 1.15 and 1.15.2 which are the versions I can use

#

I also added #!/usr/bin/env python to the top of the script didnt do anything

#

I have an idea

earnest phoenix
#

what if you add #!/usr/bin/python instead?

#

im trying to think of a good way to handle 'skills'

#

atm was just going to have a big object on the user database entry

#

with the skills and their various levels

#

any advice?

#

maybe i can make it an array

#

and have the skills be a big json

#

and shoved in the array

#

yea ill do that

#

so its dynamic

#

nvm

amber fractal
#

I think I fixed mine by adding a symlink for python3.7 and python

earnest phoenix
#

oki

#

Are we allowed to make DM commands

earnest phoenix
delicate zephyr
#

iirc yea you should be able to

grim aspen
#

pretty sure i do not have an index.js nor got

#

i use a server.js

outer niche
#
async def on_raw_reaction_add(payload):
    message_id = payload.message_id
    if message_id == 680245854350737418:
        guild_id = payload.guild_id
        guild = discord.utils.find(lambda g : g.id == guild_id, bot.guilds)

        role = discord.utils.get(guild.roles, name=payload.emoji.name)

        if role is not None:
            member = guild = discord.utils.find(lambda m : m.id == payload.user.id, guild.members)
            if member is not None:
                await member.add_roles(role)
                print("done")
            else:
                print("Member not found.")
        else:
            print("Role not found.")```   ```File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\utils.py", line 200, in find
    if predicate(element):
  File "C:\Users\culan\Desktop\py\beach hosting.py", line 39, in <lambda>
    member = guild = discord.utils.find(lambda m : m.id == payload.user.id, guild.members)
AttributeError: 'RawReactionActionEvent' object has no attribute 'user'

grim aspen
#

ah fuck i see why

#

my package system errored out and decided not to save

earnest phoenix
#
let url = `https://www.googleapis.com/customsearch/v1?key=${config.searchAPI}&cx=002179459082311215073:avnitmw59ol&q=${search}`;
            
            request(url, function (err, response, body) {
                let searchItem = JSON.parse(body);

                if(!searchItem) {
                    const searchEmbed = new Discord.RichEmbed()
                        .setColor(`#03d3fc`)
                        .addField(`Error`, `No results!`, false)
                        .setFooter(`Provided by: ${config.clientName} & https://developers.google.com/custom-search`)
                    message.channel.send(searchEmbed)
                        .catch(error => sendLog(error));
                    sendLog(message.author.username + ` sent: \` ` + message.content + `\` in channel \`` + message.channel.name + `\` of guild \`` + message.guild.name + ` \``);
                    return;
                }
                else {
                    const searchEmbed = new Discord.RichEmbed()
                        .setColor(`#03d3fc`)
                        .addField(`Search Time`, `${searchItem.formattedSearchTime}s`, false)
                        .addField(`Total Results`, `${searchItem.formattedTotalResults}`)
                        .setFooter(`Provided by: ${config.clientName} & https://developers.google.com/custom-search`)
                    message.channel.send(searchEmbed)
                        .catch(error => sendLog(error));
                    sendLog(message.author.username + ` sent: \` ` + message.content + `\` in channel \`` + message.channel.name + `\` of guild \`` + message.guild.name + ` \``);
                    return;
                }

This is the code and im getting this output. idk why its undefined

#
{
  "kind": "customsearch#search",
  "url": {
    "type": "application/json",
    "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
  },
  "queries": {
    "request": [
      {
        "title": "Google Custom Search - lectures",
        "totalResults": "402000000",
        "searchTerms": "lectures",
        "count": 10,
        "startIndex": 1,
        "inputEncoding": "utf8",
        "outputEncoding": "utf8",
        "safe": "off",
        "cx": "002179459082311215073:avnitmw59ol"
      }
    ],
    "nextPage": [
      {
        "title": "Google Custom Search - lectures",
        "totalResults": "402000000",
        "searchTerms": "lectures",
        "count": 10,
        "startIndex": 11,
        "inputEncoding": "utf8",
        "outputEncoding": "utf8",
        "safe": "off",
        "cx": "002179459082311215073:avnitmw59ol"
      }
    ]
  },
  "context": {
    "title": "Suu"
  },
  "searchInformation": {
    "searchTime": 0.268336,
    "formattedSearchTime": "0.27",
    "totalResults": "402000000",
    "formattedTotalResults": "402,000,000"
  },
  "item
#

that is the output of the API

grim aspen
earnest phoenix
#

@grim aspen isnt that just a syntax error?

#

the astricks sign

grim aspen
#

trying to figure out where it's coming from

#

i don't have an index.js

#

i am using server.js

#

unless digitalocean is being a bitch and has a hidden file

earnest phoenix
#

can you send the whole error

#

and the index.js its mentioning isnt your main bot file its the node modules file

#

at the bottom of that error

#

it should say where it came from

grim aspen
#

i think i found where it's at

#

a hidden npm file

#

fuck, nope

earnest phoenix
#

im sure the error is in your main code file

grim aspen
#

oh wait

#

it's in the node_module

earnest phoenix
#

just ctrl+f and search got.paginate = async function

#

@grim aspen its not

grim aspen
#

yes it was

#

now i have to fix server.js

earnest phoenix
#

unless you went into the node modules file yourself and changed code

#

there shouldnt be a need to mess with it..

grim aspen
#

deleting the got folder just fixed the issue

#

in the node_modules

earnest phoenix
#
/root/.pm2/logs/xxx-out.log last 15 lines:
/root/.pm2/logs/xxx-error.log last 15 lines:
2|xxx      |     at Object.statSync (fs.js:948:3)
2|xxx      |     at new ShardingManager (/root/node_modules/discord.js/src/sharding/ShardingManager.js:39:22)
2|xxx      |     at Object.<anonymous> (/root/xxx/sharder.js:2:17)
2|xxx      |     at Module._compile (internal/modules/cjs/loader.js:1144:30)
2|xxx      |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
2|xxx      |     at Module.load (internal/modules/cjs/loader.js:993:32)
2|xxx      |     at Function.Module._load (internal/modules/cjs/loader.js:892:14)
2|xxx      |     at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:27:21)
2|xxx      |     at Module._compile (internal/modules/cjs/loader.js:1144:30)
2|xxx      |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10) {
2|xxx      |   errno: -2,
2|xxx      |   syscall: 'stat',
2|xxx      |   code: 'ENOENT',
2|xxx      |   path: '/root/index.js'
2|xxx      | }```
#

Anyone for this

sinful lotus
earnest phoenix
#

@south plover

south plover
#

yep

earnest phoenix
#

why not just use this

#

wait nvm

#

im dumb

#

xD

#

no wait

#

are you looking for custom statuses

#

or

#

online, offline, etc

#

@south plover ?

south plover
#

yep

#

like i wanna make user infor cmd

earnest phoenix
#

you said yep

#

when i asked

#

either or

#

i know its a userinfo command

#

i asked whether you were looking for their custom status or if they were offline, etc ;p

astral yoke
#

When I try to run a command, it says client is undefined.

#

How would I change that?

hoary elm
#

@astral yoke language?

astral yoke
#

javascript

#

nevermind tho

hoary elm
#

Okay lol

earnest phoenix
#

@astral yoke define client :)

#

const client = new Discord.Client();

#

And for discord
const Discord = require("discord.js");

hoary elm
#

Gotta love when people ping you and answer the question even though you said nevermind to the last person πŸ€·πŸ»β€β™‚οΈπŸ˜‚

earnest phoenix
#

low iqism

slender thistle
#

They're just insisting on helping

modest maple
#

And sometimes your solution isn't always the best solution

hoary elm
#

Yeah isn't there more reliable ways to define client?

earnest phoenix
#

you can't provide a solution without diagnosing the problem first

#

that's like a doctor giving you paracetamol for terminal cancer lol

hoary elm
#

Now this is true

slender thistle
#

I mean it might work with magic...
...and some surgeries

digital prism
#

Someone could help me use chartjs i don't understand

flint ruin
marble juniper
bitter sundial
#

repost

marble juniper
#

Yes

bitter sundial
#

also not a meme channel

crude oriole
#

Who is know to make bot in glitch?
I need some help

quartz kindle
#

just post your question, dont ask to ask

grim aspen
#

i do

crude oriole
#

Ok

#

And there is no error

grim aspen
#

first

#

might wanna reset your youtube token

#

it's visible

#

second is there any error?

crude oriole
#

No

grim aspen
#

check your errors.js

crude oriole
#

Ok

#

There is No error

grim aspen
#

hold on

#

is there code in the errors.js? or are you trying to store the error?

crude oriole
#

Yes there is a code

jaunty pike
#

How to make my bot online on discordbots page?

slender thistle
#

What does the status say

#

And no you don't post stats to DBL to get your bot online

crude oriole
#

Ok

quartz kindle
#

if the bot is not online in the website, it means its not in this server. check the mod log to see if it was kicked or banned

grim aspen
#

does the bot have permissions to connect and speak?

crude oriole
#

Yes

glossy pasture
#

Is there a discord bot that can add emoji's to your server(e.g you do .add [url_to_photo], . being the prefix. That it'll be added as an emoji. Couldn't find much on google

crude oriole
#

He have all the permissions @grim aspen

grim aspen
#

oh wait

#

i might see the problem

crude oriole
#

Ok

slender thistle
#

Fetch the emoji data from the URL inside the code and pass it to your create-emoji function

grim aspen
#

it doesn't have any content to run the command by

#

like when you say !help

glossy pasture
#

not asking how to, I'm asking if there is a bot for that πŸ™‚

slender thistle
crude oriole
#

@grim aspen I have prefix !

grim aspen
#

gimme a sec

crude oriole
#

Ok

grim aspen
crude oriole
#

No thinks so

quartz kindle
#

your code is a mess tho, its difficult to find the exact problem as it has many problems

glossy pasture
#

Thanks! I found a bot that can do it!

grim aspen
#

oh wait that's a different method

#

you're using exports

#

wait does glitch even the export method?

#

allow*

quartz kindle
#

ofc it does

#

errors.playSong

#

why is your play function in the errors file?

crude oriole
#

I don't know

quartz kindle
#

why do you have bot.destroy()?

crude oriole
#

Where?

quartz kindle
crude oriole
#

OK I will delete it

ocean frigate
#

how to create a webhook listener using dblpy?

quartz kindle
#

why are you requiring Discord, Client, ytdl and Opus if you're not using any of them?

slender thistle
#

Only webhook_port is required to run the webhook technically, other webhook kwargs have default values

ocean frigate
#

how to create a webhook listener using dblpy?

slender thistle
#

I think I answered that question

crude oriole
#

I don't created all this command, I created only part of it someone help me and created the other part

quartz kindle
#

then ask them

ocean frigate
#

to create a webhook py self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
this can be used, but what does this do, where do it post the data and how to use it?

quartz kindle
#

if you dont know what half of the command does or how it works, its very hard to fix it

crude oriole
#

They don't know what the problem

slender thistle
#

The webhook will be running under http://<ip>:<port><webhook_path>

quartz kindle
#

then debug your command, put console.log's in all lines and make sure the values are all correct

#

and also move the play function out of the error file lol it makes no sense

slender thistle
#

If you set any integer value to webhook_port dblpy will attempt to create the webhook for you

ocean frigate
#

will it automatically trigger the bot event on_dbl_vote?

slender thistle
#

If the port is open yes

#

and the vote is an actual vote instead of a test request

quartz kindle
#

^and the url in the site is correct

ocean frigate
#

you mean url of site given on DBL?

quartz kindle
#

yes

ocean frigate
#

k

#

thx

#

I was confused if the line would auto trigger the async bot event on_dbl_vote or not.

ocean frigate
#

DBL webhook post on 5000 port TCP or UDP protocol?

earnest phoenix
#

what

#

it's neither lol

ocean frigate
#

wut

slender thistle
ocean frigate
#

?

earnest phoenix
#

you have a misconception and you're trying to sound smart - don't

#

it just opens a port where it hosts a small webserver so it can accept http requests

ocean frigate
#

??

true ravine
#

TCP and UDP are protocols not ports right?

earnest phoenix
#

I think so

ocean frigate
#

Well yeah I asked which protocol it is

earnest phoenix
#

No

#

port =/= protocol

ocean frigate
#

mistake in my message

modest maple
#

its still wrong af

earnest phoenix
modest maple
#

just because its on port 5000 dont mean shit

earnest phoenix
#

to clear things up, http/2 and under does use tcp as a transport layer protocol usually

#

but you're not aware of what you asked doesn't make sense

ocean frigate
modest maple
#

why is it custom

#

when its litterally a http webserver

ocean frigate
#

custom means I am opening a port access that is not in default list

modest maple
ocean frigate
#

I do not want to know the difference, I want to know which protocol should i open to inbound rules for the DBL webhook port

modest maple
#

well enjoy learning somthing in your life by reading :P

copper cradle
#

Yeah

#

Why wouldn't you want to learn the diff

vestal star
#

Is it ok if anyone reacts with πŸ“· on an image, my bot will upload that image to imgur and dm the user the link

earnest phoenix
#

automatically, here? no

vestal star
#

Ok

earnest phoenix
#

automated actions should be opt in not opt out

modest maple
#

oh boy could you abuse the fuck out of that

vestal star
#

Someone said it was fine

earnest phoenix
#

that someone was wrong

modest maple
#

take bot -> send multiple thousands of photos (could very easily be illegal)
user same bot or just self bot -> react with emoji
result -> thousands of links that are not linked to your account in anyway

vestal star
#

Yah, now I see

#

I mean, the bot uploads them annomously on imgur

modest maple
#

still ur ip being the thing getting logged :P

vestal star
#

Β―\_(ツ)_/Β―

ocean frigate
#

use tor, XD

vestal star
#

I'll probably make a trigger command to turn that on for a minute so someone could select an image

modest maple
#

the solution is not "use tor"

ocean frigate
#

lul

#

XD

earnest phoenix
#

ahahahha so funny LMAO WHO MADE THIS 🀣

vestal star
#

Tor does literally nothing, also running a bot off Tor would mean a shitty response time

ocean frigate
#

yup

earnest phoenix
#

is heroku down for anyone else?

#

it wont let me push my updates

modest maple
#

we dont support heroku here

#

ask heroku not us

ocean frigate
#

^

vestal star
#

Who TF uses heroku?

earnest phoenix
#

cheapskates

copper cradle
#

A lot of ppl actually

modest maple
#

who tf uploads any image they get reacted to imgur

ocean frigate
#

XD

vestal star
#

Unless you pay for it it's useless

#

If you want to host something for free, I had a good experience with glitch.com, I get a really good ping, and very rarely get downtime. Also heroku free does not work all the time, you only get 500 hours a month, which is not a full month.

modest maple
#

NO

vestal star
#

?

earnest phoenix
#

literally just avoid free hosting

modest maple
#

^

vestal star
#

That too

modest maple
#

you want to run a decent bot you do not run free hosts

#

it limits you

ocean frigate
#

^

earnest phoenix
#

glitch isnt supported here lol

#

right?

vestal star
#

I'll be switching to Google cloud compute once ppl actually start using it

modest maple
#

no

earnest phoenix
#

anything that claims it's a free product is often a con and more times than not you're the product

modest maple
#

why the fuck would you use google cloud compute

vestal star
#

Mostly the best response time

modest maple
#

that is

tight plinth
#

Heroku has a 16ms ping

earnest phoenix
#

quite literally host anywhere in the us and you'll have good latency

modest maple
#

^^

#

not to mention

#

like it makes the most insignificant diffrence

earnest phoenix
#

iirc discord api servers are in NYC

ocean frigate
#

^

modest maple
#

when discord is having a oopse your fucked anyway

ocean frigate
#

?

vestal star
#

When discord has a oopse, there is a chance Google cloud is having an oopse and I won't be paying for when discord is down

modest maple
#

lmao that is a rather

#

interesting way of thinking

tight plinth
#

When discord has a oopse, ur bot is fucked no matter what

modest maple
#

and just cuz discord is having issues doesnt mean your server will be

ocean frigate
#

what does oopse mean?

modest maple
#

discord is massive

#

your bot

#

will not be on the same servers as discord

#

when the API is having moments your system will almost certainly not even notice anything going on, so that logic is flawed

late hill
#

the problem however is that all your end-users will think your bot is broke

#

and you get to live through that

modest maple
#

im debating selling two of my servers and buying a newer one

earnest phoenix
#

one of the main reasons i dont have a public bot anymore is that users are stupid bloblul

modest maple
#

oh god yh

late hill
#

literally have to lock support channels during bad outages

#

you can have a bold message up above that states the discord issues

#

and they'll still go

bot broke n??J!!1

modest maple
#

yano maybe i wont get a ddr4 server

#

fuck that shit

#

ill stick with my ddr3 and have a decent amount of ram xD

earnest phoenix
#

when i fetch db.push(actions_${user.id}, Action ${num}) it gives it like (1 , 2) is there a way to split 1 , 2 in a new line in html ?

amber fractal
#

Any reason why (python and discord.py) a bot would relog after a command with no errors in console?

modest maple
#

probably a shard disconnect

amber fractal
#

It has two servers

modest maple
#

if you have logging enabled you will see alot of breif connects and disconnects

amber fractal
#

It just fires the on_ready event

modest maple
#

on every command?

amber fractal
#

Basically

ocean frigate
#

😱

modest maple
#

you got a rouge client.logout somwhere or what

amber fractal
#

No. There is no logout or extra login

quartz kindle
#

does the command take too long to respond?

amber fractal
#

Well it's an AI so it takes time to process

#

Is there a way I can make the timeout longer?

slender thistle
#

Sounds like blocking

wicked pivot
#
    var userlove = Math.floor(Math.random() * 100) + 1;

    if(userlove )```


how can i check the number given and between such and such number?
quartz kindle
#

if the code is blocking your thread, your client will disconnect due to innactivity

modest maple
#

you shouldnt run blocking code in your main thread anyway

quartz kindle
#

you should fire another thread/process for heavy computing

modest maple
#

thats why run_in_executor exists

quartz kindle
#

you should or you shouldnt?

modest maple
#

shouldnt****

slender thistle
#

run_in_executor(print('a'*10000))

modest maple
#

still blocking

amber fractal
#

It has 48 gb mem and 24 threads, and I'm relatively new to python can I limit processing to certain threads?

modest maple
#

python doesnt rlly work like that

#

you cant choose which thread it goes in

#

you can tell it to run the code in a diffrent thread

amber fractal
#

So if the ai basically uses all the threads and takes too long it'll disconnect because of blocking?

#

Gives me something to work off of

#

Thanks

quartz kindle
#

it should use all available threads except the main one where the bot is running

#

there should be a way to do that in py

modest maple
#

your AI wont be using multiple threads by defualt no?

#

and python handles that by defualt anyway

amber fractal
#

Tensorflow is multi threaded to my knowledge

quartz kindle
#

if its a library that is designed to use multiple threads, it will probably use all of them by default

amber fractal
#

Can I check what threads it's running on?

modest maple
#

you dont

amber fractal
#

Dont what

modest maple
#

dont know what thread its running on

#

you can get the thread number but das it

#

tensor flow uses concurrent futures iirc

#

that manages threads

#

you just let it go

#

it will only use as many as its allowed

amber fractal
#

But something isn't working clearly

#

If it relogs after every command

modest maple
#

thats cuz tensor flow is still blocking lmao

#

it uses threads to speed shit up

amber fractal
#

Exactly

modest maple
#

not stop the main thread being blocking

amber fractal
#

So how do I fix it

modest maple
#

use run_in_executor

amber fractal
#

Ill try it

#

Weird now it's relogging, not generating and not erroring

lean swan
#

Oof

modest maple
#

What did you end up putting

amber fractal
#

Oh run_in_executor wasnt defined. I mistook that it was just something that was just there. So I looked it up and I need to import asyncio and run it on the running event loop?

modest maple
#

Yes

amber fractal
#

@modest maple getting a different error. can only concatenate str (not "coroutine") to str but I am awaiting the result

modest maple
#

what

#

what is your code

amber fractal
#
loop = asyncio.get_running_loop()
block = await lop.run_in_executor(None, self.generator.generate(...))
return block```
The `None` comes from the python docs so Im not sure if it's required
modest maple
#

you know if its None it uses the main thread right

#

hence why the examples show how to use concurrent fututre's threadpoolexecutor and processpoolexecutor

amber fractal
#

So which should I use

modest maple
#

depends on ur task

#

if its more IO bound then threadpool
if it takes processing power then ProcessPool

amber fractal
#

Well considering it uses all the cpu I'd say processing pool mmulu

#

But idk if that's the cause of the error

#

The concatenate str one

#

Yeah it didnt

modest maple
#

you know you dont call the function right

#

you give it the fucntion

#

un-called

#

and then give it the args to pass

#
import asyncio
import concurrent.futures

def blocking_io():
    # File operations (such as logging) can block the
    # event loop: run them in a thread pool.
    with open('/dev/urandom', 'rb') as f:
        return f.read(100)

def cpu_bound():
    # CPU-bound operations will block the event loop:
    # in general it is preferable to run them in a
    # process pool.
    return sum(i * i for i in range(10 ** 7))

async def main():
    loop = asyncio.get_running_loop()

    ## Options:

    # 1. Run in the default loop's executor:
    result = await loop.run_in_executor(
        None, blocking_io)
    print('default thread pool', result)

    # 2. Run in a custom thread pool:
    with concurrent.futures.ThreadPoolExecutor() as pool:
        result = await loop.run_in_executor(
            pool, blocking_io)
        print('custom thread pool', result)

    # 3. Run in a custom process pool:
    with concurrent.futures.ProcessPoolExecutor() as pool:
        result = await loop.run_in_executor(
            pool, cpu_bound)
        print('custom process pool', result)

asyncio.run(main())```
amber fractal
#

Im on that

#

That doesnt explain how to pass args

modest maple
#

self.generator.generate(...) != cpu_bound

amber fractal
#

Ik

#

I made that mistake

modest maple
#

you just pass it the args

#

result = await loop.run_in_executor(pool, cpu_bound, arg1, arg2, etc...)

amber fractal
#

Alright

#

Now that it's giving a traceback I can give that to you in a sec

#

Sorry that it's taking so long Im just slow in more ways than one

#
0|main     |   File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
0|main     |     await coro(*args, **kwargs)
0|main     | Traceback (most recent call last):
0|main     |   File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
0|main     |     await coro(*args, **kwargs)
0|main     |   File "/root/AIDungeon_bot/bot/main.py", line 166, in on_message
0|main     |     result = await current_story_managers[message.author.id].act(action)
0|main     | TypeError: can only concatenate str (not "coroutine") to str```
earnest phoenix
#

Anyone have a solution for pretty embed tables

#

Using ascii tables but people are complaining even tho I think it's better

modest maple
#

whats ur code again @amber fractal

amber fractal
#

I forgot to await something mmulu

#

Im just getting a name error now which is easier for me to understand

modest maple
#

πŸ€”

amber fractal
#

Well it wasn't just that ```0|main | Traceback (most recent call last):
0|main | File "/usr/lib/python3.7/multiprocessing/queues.py", line 236, in _feed
0|main | obj = _ForkingPickler.dumps(obj)
0|main | File "/usr/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps
0|main | cls(buf, protocol).dump(obj)
0|main | TypeError: can't pickle _thread.RLock objects
0|main | """
0|main | The above exception was the direct cause of the following exception:
0|main | Traceback (most recent call last):
0|main | File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
0|main | await coro(*args, **kwargs)
0|main | File "/root/AIDungeon_bot/bot/main.py", line 166, in on_message
0|main | result = await current_story_managers[message.author.id].act(action)
0|main | TypeError: can't pickle _thread.RLock objects

#

Or not ones that I'm capable of doing

modest maple
#

show code

amber fractal
#

The only code I wrote is

    result = await self.generate_result(action_choice)
    self.story.add_to_story(action_choice, result)
    return result

async def generate_result(self, action):
    loop = asyncio.get_running_loop()
    block = None
    full_action = self.story_context()  + action
    with concurrent.futures.ProcessPoolExecutor() as pool:
        block = await loop.run_in_executor(pool, self.generator.generate, full_action)
    return block``` the generate function is gpt-2 and tensorflow stuff
#

weird indents

#

copied wrong

modest maple
#

self.generator.generate <-- show this func

amber fractal
#
    def generate(self, prompt, options=None, seed=1):

        # print("*****\n\nBEGIN GENERATION\n\n*****")

        debug_print = False
        prompt = self.prompt_replace(prompt)

        # print(f"*******\n\n PROMPT: {prompt} \n\n************")

        if debug_print:
            print("******DEBUG******")
            print("Prompt is: ", repr(prompt))

        # print("********\n\n GENERATE RAW\n\n**********")
        text = self.generate_raw(prompt)
        # print(f"**********\n\n TEXT AFTER RAW: {text}\n\n************")

        if debug_print:
            print("Generated result is: ", repr(text))
            print("******END DEBUG******")

        result = text

        # print(f"**********\n\n REPLACE\n\n************")
        result = self.result_replace(result)
        # print(f"**********\n\n TEXT AFTER REPLACE: {result}\n\n************")
        if len(result) == 0:
            # print(f"**********\n\n NO RESULT\n\n************")
            return self.generate(prompt)

        return result```
#

I dont understand most of that. it's gpt-2 and ai stuff that I just use

modest maple
#

just a thought

#

move that return

#

to just under the wait and with

#

not that should do anything but maybe

#

TypeError: can't pickle _thread.RLock objects tends to mean that task hasnt actually finished yet and is threadlocked

amber fractal
#

I've got to go, I'll try and get that done later when I have more time. Thanks.

#

I'll probably be back just bad time

earnest phoenix
#

hell yeah

#

i managed to memory read the discord process and get the token out of there

#

fun

modest maple
#

lmao

mossy vine
#

@earnest phoenix sell that on the dark web 😳

modest maple
#

^^

fossil void
#

BOOT

#

alguem do brasil aqui mds

modest maple
#

@coral trellis Yeet this child

#

ty

bitter sundial
#

@earnest phoenix that's a rude way to tell someone to stop spamming

earnest phoenix
#

ok

bitter sundial
#

that kind of language isn't tolerated here

earnest phoenix
#

ok

grizzled raven
#

huh

smoky quartz
#

!play moonlight ear rape

frozen cedar
#

best way to store image in array?

#

some sort of encoding for it, pref

solemn quartz
#

Hello Guys

#

Yesterday I did a mute cmd,

#

But

earnest phoenix
#

store the byte buffer @frozen cedar

solemn quartz
#

Now I did the unmute cmd

#

And this is it:

#

case 'Unmuta':
const Unmutato = message.mentions.members.first()
const EliminaRuoloMutato = message.guild.roles.find(r => r.name === "Mutato")
if(!message.member.roles.find(r => r.name === "Super Bot Master")) return message.reply('Non Hai Il Permesso Di Usare Questo Comando!')
if(!Unmutato.roles.find(r => r.name === "Mutato")) return message.reply('Scusa, Ma Quell Player Non Γ¨ Stato Mutato.')
if(!message.guild.roles.find(r => r.name === "Mutato")) return message.reply('Scusa, Ma Non Ho Trovato Il Ruolo, Perfavore Crea Un Ruolo Chiamato "Mutato" E Inserisci le varie opzioni.')
Unmutato.removeRole(EliminaRuoloMutato)
break;

#

Non Hai Il Permesso Di Usare Questo Comando! = no perms

#

Scusa, Ma Non Ho Trovato Il Ruolo, Perfavore Crea Un Ruolo Chiamato "Mutato" E Inserisci le varie opzioni. = Role Not Found

frozen cedar
solemn quartz
#

Scusa, Ma Quell Player Non Γ¨ Stato Mutato. = that player isn'tmuted

#

Before I Test It Should I add Something?

earnest phoenix
#

you can't rely on role names

solemn quartz
#

?

earnest phoenix
#

you have to store the id of the mute role in a database

#

and then pull it from there

solemn quartz
#

nu

earnest phoenix
#

and then get the role

#

anything that can be changed by a user - you can't rely on it

solemn quartz
#

look at EliminaRuoloMutato const

earnest phoenix
#

lol

#

re-read what i said

#

someone can change the role name easily

solemn quartz
#

Im italian ok

earnest phoenix
#

and boom your bot is broken

#

and i'm croatian - how is that relevant?

frozen cedar
earnest phoenix
#

not here

solemn quartz
#

btw GiveawayBot does this too and it is much famous

earnest phoenix
#

the giveaway bot doesn't rely on role names

solemn quartz
#

Yea

earnest phoenix
#

it relies on ids, which can't be changed

#

they can either exist or not exist

solemn quartz
#

It says if u have a role named "Giveaways" you can do giveaways

earnest phoenix
#

yes but that's something entirely different

#

it's not a mute role

#

it's not functional

#

it doesn't do anything, it doesn't have any perms

#

it's just a flag on the user that giveaway bot checks for

#

a mute role is not equivalent to a flag role like Giveaways or a DJ role

#

you can't make a moderation bot without a database - you need to use ids and store them somewhere

#

otherwise you're writing shitty code and asking for your bot to be broken

surreal sage
#

const prefix = "cd";
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);
const command = args.shift().toLowerCase();
if(message.author.bot) return;

#

i have this on all my bots

#

but if i like do ax

#

it reacts too

solemn quartz
#

watttaaaaaaaaaaaaaa

earnest phoenix
#

ok and

surreal sage
#

like the prefix = cd
and i do ax it reacts

earnest phoenix
#

because you just check for the length

#

not for the actual prefix

surreal sage
#

if tried if(!message.content === prefix) return;

#

but it still not work

earnest phoenix
#

think about that for a moment

#

you're comparing the entire message content to your prefix

#

and incorrectly may i add

#

!== exists

surreal sage
#

so whats the final piece of code?

earnest phoenix
#

i'm not spoonfeeding it to you

#

figure it out

torn cliff
#

Ey hello

earnest phoenix
#

i told you what's the problem

surreal sage
#

if(message.content.startsWith !== prefix) return;

earnest phoenix
#

close

#

but not quite

#

look up the usage of startsWith

solemn quartz
#

@earnest phoenix So ur saying me that i should redo all with not "addrole" but with "createrole" and doing an if to see if the role arledy exists

surreal sage
#

hmm

#

i dont see it

earnest phoenix
#

So ur saying me that i should redo all with not "addrole" but with "createrole" and doing an if to see if the role arledy exists
not what i said at all

solemn quartz
#

something like that btw

earnest phoenix
#

you need to rewrite your code to depend on ids that are stored in a database if you don't want your bot to break

prime cliff
#

If your prefix was ! for example you would have to check if it starts with ! but you should also block it if it starts with the prefix and a space just so it does not trigger on anything else

solemn quartz
#

huh?

#

i dont know english perfectly OK

prime cliff
#

❌ !SPACE
tickYes !

vestal star
#

what new feature that my bot should have?

earnest phoenix
#

whatever you want it to be

vestal star
#

geez... i just need suggestions

solemn quartz
#

Ok this is confusing to me..

earnest phoenix
#

welllllll you know what they say

solemn quartz
#

I think im gonna copy paste my mute-unmute cmds in a folder at my desktop and ill do it when ill know

earnest phoenix
solemn quartz
#

-bots @earnest phoenix

gilded plankBOT
#

tickNo This user has no bots

solemn quartz
#

A so good bot developer

earnest phoenix
#

i used to have a 2.5k guild bot lol

vestal star
#

-bots @earnest phoenix

gilded plankBOT
earnest phoenix
#

i just quit public bot deving

solemn quartz
#

@fossil nebula

#

cool

earnest phoenix
#

i now do private full stack deving and for good amount of money lol

vestal star
#

try doing that in a testing channel

earnest phoenix
solemn quartz
#

ik

vestal star
#

-_- you make discord bots and have no public bots?

earnest phoenix
#

correct

slender thistle
#

Not everyone makes public ones

hoary elm
#

Lol

#

I mean there is even an option in the dev portal to make it private so it can't be invited by anyone but the owner πŸ€·πŸ»β€β™‚οΈ

vestal star
#

anyway, anyone have bot ideas for me?

earnest phoenix
#

english only in this channel ^^

wicked pivot
#

possible on discord js to know if a user and on computer or telephone? (my version of discord js: 11.4.2)

earnest phoenix
#

no, not on 11.4.2

wicked pivot
wheat jolt
#

Why bots can't mention all roles?

#

even if they have that permission

earnest phoenix
#

if they can't - they don't have permission to mention the role

valid holly
#

how come fetching the owner of this server returns undefined

#

πŸ€”

wheat jolt
#

provide the code?

#

without the token

valid holly
#

🀝

wheat jolt
#

So, give us some code?

valid holly
#
guild.fetchMember(guild.owner);
wheat jolt
#

huh

valid holly
#

lib: discord.js

wheat jolt
#

just use guild.owner

earnest phoenix
#

fetchMember is a promise

valid holly
#

returns undefined

earnest phoenix
#

anything that is prefixed with fetch returns a promise

prime cliff
#

@wheat jolt they chaged that because bots were using role mentions for certain features but noone wanted it to be pingable

valid holly
#

oh then I’ll need to resolve it

#

thanks

earnest phoenix
#

so when i fetch the actions it returns as 1 , 2
on the website
is there a way to make it like a new line?
1
2

#

what

valid holly
#

fetch actions ??

summer torrent
#

split(" ").join("\n") πŸ€” @earnest phoenix

valid holly
#

I don’t think he needs to split

earnest phoenix
#

doesnt split into a new line in EJS though

valid holly
#

Just join

summer torrent
#

what is the type of 1, 2

crude oriole
#

I need help please

exports.run = async(client, message, args) => {
  const db = require("quick.db");
    const Discord = require("discord.js");
    if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send(`the current Perfix is {prefix} Please provide a prefix to change server prefix`) 
	
};
db.set(`prefix_${message.guild.id}`, args.join(' '))
	.then(i => {
		message.channel.send(`Server Prefix has been changed to ${i}`);
}
        }
module.exports.help = {
  name: "setPrefix"
}

There is a error

summer torrent
#

show error

valid holly
earnest phoenix
#

so db.push(actions_user.id)

#

it doesnt work on EJS

#

xd

crude oriole
earnest phoenix
#

recheck your syntax

#

how do i make for every comma it goes to a new line?

#

on EJS

valid holly
#

split(β€œ,”) to split into an array

#

and join every by \n escape seq.

crude oriole
#

There is a error

exports.run = async(client, message, args) => {
  const db = require("quick.db");
    const Discord = require("discord.js");
    if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send(`the current Perfix is {prefix} Please provide a prefix to change server prefix`) 
	
};
db.set(`prefix_${message.guild.id}`, args.join(' '))
	.then(i => {
		message.channel.send(`Server Prefix has been changed to ${i}`);
}
        }
module.exports.help = {
  name: "setPrefix"
}
earnest phoenix
#

stop

#

doing that

#

and read the damn error

ocean cedar
#

I just got stuck in the bot and I want to open Ticket, what do I do?

earnest phoenix
#

and i told you to recheck your syntax

crude oriole
#

Ok

ocean cedar
#

@crude oriole I just got stuck in the bot and I want to open Ticket, what do I do?

crude oriole
#

Hm

earnest phoenix
#

jesus christ what is up with the low iqsm today

wheat jolt
#

now really

#

My bot can't mention roles

#

even if it has that new permission

ocean cedar
#

I just got stuck in the bot and I want to open Ticket, what do I do?

earnest phoenix
#

discord added new mention permissions

crude oriole
#

I didn't found what the error is @earnest phoenix

ocean cedar
#

@crude oriole

valid holly
#

your .then is missing )

crude oriole
#

@ocean cedar what

ocean cedar
#

I just got stuck in the bot and I want to open Ticket, what do I do?

#

?

crude oriole
#

@ocean cedar what

surreal sage
#
const args = message.content
        .slice(prefix.length)
        .trim()
        .split(/ +/g);```
It checks on prefix lenght...
With what do i need to replace it so it checks on the prefix's content?
valid holly
#

args[n]

#

0 is your first pos

#

/command

surreal sage
#

@earnest phoenix y, i love that new update

wheat jolt
valid holly
#

args[0] // β€œcommand”

crude oriole
#
exports.run = async(client, message, args) => {
  const db = require("quick.db");
    const Discord = require("discord.js");
    if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send(`the current Perfix is {prefix} Please provide a prefix to change server prefix`) 
	
};
db.set(`prefix_${message.guild.id}`, args.join(' '))
	.set(i => {
		message.channel.send(`Server Prefix has been changed to ${i}`);
 }
        }  //here is the error 
module.exports.help = {
  name: "setprefix"
        }
earnest phoenix
#

Yeah the new shit with mention everyone, here, all rΓ΄les When the mention is disabled

#

This is better to make an other permission for mention all rΓ΄les When mention is disabled

valid holly
#

check your error bruv

#

it literally tells you what’s wrong

surreal sage
#
const args = message.content
        .slice(prefix.length)
        .trim()
        .split(/ +/g);```
It checks on prefix lenght...
With what do i need to replace it so it checks on the prefix's content?
valid holly
#

Nah today this chat is doomed

earnest phoenix
#

literally cursed lol

wicked pivot
valid holly
#

you cant

#

then and catch it

#

or try catch

hoary elm
#

@crude oriole I guess I'll be the guy that breaks it down for you you have a line .set(i => { that you never closed

});
You left the bracket open

surreal sage
#

const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);

#
const args = message.content
        .slice(prefix.length)
        .trim()
        .split(/ +/g);```
It checks on prefix lenght...
With what do i need to replace it so it checks on the prefix's content?
valid holly
#

send returns a promise

amber fractal
#

@modest maple you still available? I had to do school stuff

valid holly
#

@surreal sage we replied to your concern please stop asking

surreal sage
#

where

#

send link of msg

valid holly
#

check

surreal sage
#

@valid holly where do i need to put or change args[0]

earnest phoenix
#

my softban to be problematic because the user does not accept private messages how can I check if the user accepts mp?
you can't, the only way to know is to actually dm the user, if it errors out you can't

crude oriole
#
exports.run = async(client, message, args) => {
  const db = require("quick.db");
    const Discord = require("discord.js");
    if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send('Please provide a prefix to change server prefix')
	.then(msg => msg.delete({
		timeout: 10000
}); //the error is here 
        }
db.set(`prefix_${message.guild.id}`, args.join(' '))
	.then(i => {
		message.channel.send(`Server Prefix has been changed to ${i}`);
	}
  
}
module.exports.help = {
  name: "setPrefix"
       }
earnest phoenix
#

literally

#

stop

#

like holy shit

crude oriole
#

Hm

#

Ok

#

emoji_2 someting do the error

hoary elm
#

@crude oriole look how you posted your code originally and then look where I tagged you

#

You are adding it in the wrong area

#

πŸ€·πŸ»β€β™‚οΈ

crude oriole
#

Ok

hoary elm
#
message.channel.send("message here")
   });
} //End of code```
#

You never closed the Bracket for (i

crude oriole
#

Workkk

#
exports.run = async(client, message,
 args) => {
  const db = require("quick.db");
    const Discord = require("discord.js");
    if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send('Please provide a prefix to change server prefix')
	.then(msg => msg.delete({
		timeout: 10000
        })
        );
db.set(`prefix_${message.guild.id}`, args.join(' '))
	.then(i => {
		message.channel.send(`Server Prefix has been changed to ${i}`);
	});
  
}
module.exports.help = {
  name: "setPrefix"
       }
#

This is work

earnest phoenix
#

how to i change the status to how many users its watching

#

i use discord.js

hoary elm
#

Btw for your message.delete you can just do message.delete(10000) @crude oriole

crude oriole
#

Ok

hoary elm
#

.then(msg => msg.delete(10000)

marble juniper
#

why you do !args.join(' ')

#

you can just do args[0]

#

!args[0]

hoary elm
#

I didn't even notice that πŸ˜‚πŸ˜‚

summer torrent
#

how to i change the status to how many users its watching
@earnest phoenix setActivity(${client.users.size} users, {type: "WATCHING"})

earnest phoenix
#

what do i need to replace it with?

summer torrent
#

"client.user.setActivity"

earnest phoenix
#

ok

#

@summer torrent showed error

summer torrent
#

show error

earnest phoenix
solemn quartz
#

Hi again

#

My terminal just broken

#

yay

crude oriole
#

How I do that it will write the currently prefix?

earnest phoenix
#

@summer torrent

restive furnace
#

@hoary elm if on d.js dev u cant do that, and you dont need to close brackets eg: .then(i => {})

summer torrent
#

add `

earnest phoenix
#

where?

solemn quartz
#

@summer torrent Hi

#

My terminal just broke

#

I hate my fucking life

summer torrent
#

@earnest phoenix error says

#

look ^

crude oriole
#

How I do that it will write the currently prefix?

summer torrent
#

@solemn quartz show err

hoary elm
#

@restive furnace wouldn't know that I don't use 12-dev

tame ginkgo
#

Does anyone know how to hook up a website to a discord account like you can manage servers and shit from a dashboard?

earnest phoenix
#

can u write whole command? to see what im doing wrong

hoary elm
#

@earnest phoenix your missing a `

earnest phoenix
#

where?

hoary elm
#

Before ${client

summer torrent
#

@earnest phoenix before $

earnest phoenix
#

ok

summer torrent
#

error says it

#

follow ^

earnest phoenix
#

i did that tho

crude oriole
#

Someone knows How I do that it will write the currently prefix?

summer torrent
#

fetch it from db

earnest phoenix
#

Does anyone know how to hook up a website to a discord account like you can manage servers and shit from a dashboard?
oauth2