#development

1 messages · Page 521 of 1

bright spear
#

first you need to code the bot

hushed berry
#

Did you even read what I said?

earnest phoenix
#

yes

keen drift
#

lmao

#

🍿

queen sentinel
loud salmon
#

🍿

keen drift
#

continue groovy

earnest phoenix
#

i dont got time now

keen drift
#

come back when you got time

earnest phoenix
#

sure

#

yo

#

whats poppin

zenith moss
#

Life

slender thistle
earnest phoenix
#

life

zenith moss
#

Oof I didn’t realize this was development

earnest phoenix
#

oh yea xD I honestly thought i was in #general

#

😂

#

my bad

#

same

tight heath
#

@keen drift yeah it's not much

#

but I'm not a coder

#

so

#

¯_(ツ)_/¯

#

studying psych, not IT

topaz fjord
#

ur a weeb

tight heath
#

oh okay

keen drift
#

wots the ping for

tight heath
#

this

keen drift
#

o

tight heath
#

i repli

#

not like reddit OPs

earnest phoenix
#

where do i go to create bot commands

sick cloud
#

in your code

tight heath
#

10/10 support would call again

#

5 ⭐ ⭐ ⭐ ⭐ ⭐

earnest phoenix
#

how do i get vote count from dbl?

tight heath
#

see api docs

earnest phoenix
#

where

tight heath
earnest phoenix
#

k, tnx

tight heath
#

can you please first look around

#

then ask

#

it's like

#

a

#

big button on the website

earnest phoenix
#

didnt see it before

tight heath
empty owl
#

Can someone help me I dont know what to do. I dont get an error message:

discord.js


Client.on("message", (message) => {
    if (message.content.startsWith(prefix + "order")) {
        // Easy way to get member object though mentions.
        if (!message.member.roles.some(r => ["Owners", "Developers", "Chief Of Training Officer", "COO", "Founders", "CDO"].includes(r.name))) return message.channel.send("Insufficent Permissions");
      const args = message.content.slice(prefix.length).trim().split(/ +/g);
      const command = args.shift().toLowerCase();
          let order = args[0]
      let notes = args.slice(1).join(" ")
        // Kick
        message.channel.send(`You have successfully ordered ${order} with ${notes}. NOTE: All spam orders will be denied.`).then((member) => {
            // Successmessage
          let orderembed = new Discord.RichEmbed()
            .addField('NEW ORDER', `Order from ${message.author}`)
            .addField('🗒Order', `${message.author} has ordered ${order}`)
            .addField('📝Details', `${message.author} has requested that you ${notes}`)
            message.channel('513163875672391695').send({orderembed});

        }).catch(() => {
             // Failmessage
            message.channel.send("FAIL Please contact @bobthemoose#2065 to get this fixed.");
        });
    }
});```
#

pls help

brittle nova
#

message.channel('513163875672391695').send({orderembed}); would not work

empty owl
#

o

#

but how do I get it to send into a certain channel?

brittle nova
#

I don't use discord.js anymore but I don't think message.channel is a function

#

also

#

.send({orderembed}) will have to be .send({ embed: orderembed })

mossy vine
#

message.channel is definitely not a functiom

empty owl
#

@brittle nova I dont use json embed I use richembed

mossy vine
#

Same thing tho

brittle nova
#

^

#

richembed just turns it into json iirc

mossy vine
#

Yes

empty owl
#

nvm i got it

#

HEALLLLP

#

how does one generate order values that can be stored and used for claiming?

mossy vine
#

Uhm

#

Just generate them lol

empty owl
#

how?

#

and store them in a json?

mossy vine
#

I aint gonna spoonfeed you, generating strings is simple enough

empty owl
#

oh ok

#

well ill look at the documentation

mossy vine
#

Just store the characters in an array and randomly select from them

#

Its not in docs but ok

empty owl
#

ok

#

but I need them to not repeat

#

like discord donuts but for roblox planes

mossy vine
#

Wh

#

Okay

#

Im sure you can figure it out by yourself

#

Its not too hard

#

I believe in you

empty owl
#

ok

zenith moss
#

@empty owl did you figure out how to send to a curtain channel?

empty owl
#

here I got this from my master coder friend

#

Client.channels.get('513163875672391695').send({embed});

zenith moss
#

Yeah

split dune
#

but why {embed}

unreal smelt
keen drift
#

Read the error

unreal smelt
#

i readed resolved no work

idle mountain
#

your long description is 300 characters?

#

the "detailed description of your bot" field

keen drift
#

send screenshot of resolved desc

unreal smelt
idle mountain
#

the one below that

unreal smelt
#

Look

inner jewel
#

wrong field

#

also you need more than 300 characters

keen drift
#

detailed description

empty owl
#

HEALp

#

nvm

idle mountain
unreal smelt
inner jewel
#

now you read that

empty owl
#

YOU ARE NOT DOING IT CORRECTLY

idle mountain
#

Screenshot both descriptions

#

and send them here

unreal smelt
#

finally i resolved the problem

keen drift
#

👏

#

now wait for the decline jerrycheese

unreal smelt
#

fine i will wait

#

Recused I Will Try To Modfy The Bot Desc

#

Its Have 300 Characters

earnest phoenix
#

is that

#

actual sentences

#

or is spam to hit the 300 words

unreal smelt
#

no look

earnest phoenix
#

is it spam not oh look it hits the 300 woo

shadow barn
#
 → /home/minasan/node_modules/better-sqlite3/build/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/build/Release/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/Debug/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/out/Release/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/Release/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/build/default/better_sqlite3.node
 → /home/minasan/node_modules/better-sqlite3/compiled/8.10.0/linux/x64/better_sqlite3.node
    at bindings (/home/minasan/node_modules/bindings/bindings.js:93:9)
    at Object.<anonymous> (/home/minasan/node_modules/better-sqlite3/lib/database.js:4:40)
    at Module._compile (module.js:652:30)
    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> (/home/minasan/node_modules/better-sqlite3/index.js:2:18)```
Anyone knows a fix for this?
unreal smelt
#

no

earnest phoenix
#

it cant locate the file

shadow barn
#

Hm ok

earnest phoenix
unreal smelt
#

download it first

shadow barn
#

i did

#

npm i better-sqlite-pool

unreal smelt
shadow barn
#

You're going to get denied for random words

unreal smelt
#

no is beacuse is brazilian...

quartz kindle
#

spaces are not counted

#

write information about your commands

#

escreva informações sobre os seus comandos

keen drift
#

is dat

#

google translate

empty owl
#

HOW DO U USE mongo.db

#

to store order numbers

west raptor
#

huh?

empty owl
#

mongo.db

#

how do i use mongo.db to store values in discord.js

topaz fjord
#

mongodb

#

not mongo.db

#

and

empty owl
#

o

keen drift
#

you insert it

#

👏

empty owl
#

?????

keen drift
#

read the doc

empty owl
#

I made a cluster idk now

keen drift
#

noice

topaz fjord
empty owl
#

mongoose

#

?

keen drift
#

mongoose also works

empty owl
#

ok

quartz kindle
#

@keen drift nope, i speak portuguese

keen drift
#

o noice

earnest phoenix
#

Mongorito is the best node.js ODM, if youre wondering

#

Schemaless, an api that is stupid simple

#

Anyone know any bot hosting

zenith moss
#

Does anyone know how to use weed.moe File and Image hosting?

#

@earnest phoenix, I seen you use weed.moe, how do I use it?

#

Sorry about the ping

earnest phoenix
#

i have no idea how i did it, but i made an account on the website itself and made an account. since i use sharex there was a popup or something that made a config for me that posts to weed.moe

#

I dont recall what i did honestly

zenith moss
#

Oh okay

earnest phoenix
#

but you could probably find a documentation online

#

deorc you know a bot hosting

west raptor
#

DO is ok

#

uh

#

vultr ive hard it good

#

gg is good ive heard

earnest phoenix
#

bot hosting is a vps so yeah

zenith moss
#

Look at the pinned messages in this channel

#

Has hosting information

earnest phoenix
#

i dont recommend glitch, but if you are just trying to learn how to code then ig you can use it

#

but if you have money to use

#

use an actaul vps

#

like do or something

zenith moss
#

I use glitch atm till I need to switch

earnest phoenix
#

i heard galaxygates is good

topaz fjord
#

GalaxyGate is amazing

earnest phoenix
#

only using do since i have student pack

topaz fjord
#

GG is cheap

#

well in my terms

earnest phoenix
#

cheap is bad

#

and dangerous

topaz fjord
#

cheap isnt bad

earnest phoenix
#

switching to galaxygates when i run out of free funding

#

if you're smart

#

it is

topaz fjord
#

it isnt

earnest phoenix
#

each to their own

topaz fjord
#

they dont lie to people

#

and they aren't bad

earnest phoenix
#

how do you know

topaz fjord
#

because I use them

earnest phoenix
#

mhm

topaz fjord
earnest phoenix
#

using a product does not mean you know everything about the company

topaz fjord
#

I do use them

#

and you get to talk to the owner directly

earnest phoenix
#

since I know it's owned by someone in discord called Gadget

#

I even refrain myself from opening the link

topaz fjord
#

¯_(ツ)_/¯

#

whatever you want to think

earnest phoenix
#

but hey--that's just me

#

2-3 months then we switch to GG

topaz fjord
#

I can't wait till they peer with Cloudflare

#

will get <1ms latency with them

keen drift
#

yeah their lower end is pretty good

topaz fjord
#

I can upgrade to their Lightning for no extra cost

#

since the prices are the same

keen drift
#

but the price gets pretty high with the the high specs, I think dedis are cheaper to rent by that point

topaz fjord
#

they have dedis

#

they just aren't displayed on the site yet

#

new site coming soon

#

🔜

keen drift
#

hopefully it's soon enough

#

right now I'm using Hetzner CLI to mass deploy nodes

#

it's handy

topaz fjord
#

last I saw it was $60 for some good shit

#

but that was only one tier

keen drift
#

hcloud server create --name 'server01' --type 'cx21' --location 'nbg1' --image 'ubuntu-16.04'

topaz fjord
#

I want them to peer with discord

keen drift
#

latency isn't even a concern for me

topaz fjord
#

Cloudflare peering = better connection to voice nodes

keen drift
#

i just want good price

#

right now for 40 euros I'm getting 64gb ECC ddr3 ram, Intel Xeon E5-1650V2, 120 GB SSD, 2x2TB Enterprise HDD, and 1 Gigabit NIC

#

At this rate, I can deploy cheap nodes with k8s

topaz fjord
#

they go overkill

keen drift
#

yeah it's out of my budget range

opaque eagle
#

Hey JS folks, is there a good sequelize tutorial that u guys know of... the official docs uses all this lingo that I don't understand :P
I'm only used to sqlite, but I'm switching to heroku, and by extension, heroku's postgres service.

keen drift
#

lingo

#

uh

opaque eagle
#

And is the code all the same regardless of what storage method you're using?

keen drift
#

fundamentally yes

opaque eagle
#

Like, it'd be great if I could learn sequelize using sqlite as the database, then change it to my pg database

#

ok

keen drift
#

there's also enmap, never used it, but I think many people do

opaque eagle
#

yeah tried it before

#

It's just like a javascript Map() but it stores the contents in a sqlite file

#

But it doesn't work with heroku cuz yk, sqlite

keen drift
#

most part of the guide is the same, but you'll have to do different when it comes to the storage i suppose

opaque eagle
#

ok

brittle nova
#

I was splitting my dashboard and bot into 2 processes and communicating with ipc but node stringifies the messages so I don't get the intended response. Any alternatives to doing this (splitting processes and ipc)?

bright spear
#

@opaque eagle ^

opaque eagle
#

WHAT

keen drift
#

lmao

opaque eagle
#

Would it still store contents in memory?

#

I still think I should learn Sequelize tho, since it has relations n what not

brittle nova
#

can anyone who has a dashboard and uses nodejs tell me how they communicate with the bot and dashboard? 👀

topaz fjord
#

db

#

or websocket

bright spear
#

you could run both as the same program

topaz fjord
#

I'm personally gonna use a websocket since im gonna send music data every second

brittle nova
#

@bright spear even if you're planning on making it large?

bright spear
#

oh yeah sharding might become an issue

topaz fjord
#

I wouldnt run them as the same

bright spear
#

if u use external sharding

#

yeah it might not be the best option but it works

#

@brittle nova whats your use case?

#

anything that couldn't be resolved by just making both use the same db?

brittle nova
#

hmm

#

I might continue using ipc

#

and use the same db

#

and use ipc only for the small things

#

since db is the main thing

#

using mongo

#

<MongoClient>.connect on the main and child process?

#

the thing is though

#

bot.commands gets turned into [] due to node stringifying messages with ipc

#

so I'm looking for an alternative to that

#

anyone got any for different processes?

keen drift
#

oh dashboard and bot

#

I just run an API server for the dashboard

#

then store to db

brittle nova
#

what sort of api?

keen drift
#

REST Thonkang

#

I might try graphql tbh

#

actually nvm that won't fit with my env

opaque eagle
slim heart
#
    client.q_censored = (mem) => {
        let guild = mem.guild
        try {
            JSON.parse(fs.readFileSync('./data/server_data/' + guild.id + '.json'))
        } catch (e) {
            console.log(guild.id)
            fs.writeFile('./data/server_data/' + guild.id + '.json', '{"censor":"1","role":"none","log":"none","filter":[]}')
           return;
        }
        let serverdat = JSON.parse(fs.readFileSync('./data/server_data/' + guild.id + '.json'))
        if(!serverdat) {
            fs.writeFile('./data/server_data/' + guild.id + '.json', '{"censor":"1","role":"none","log":"none","filter":[]}')
            serverdat = '{"censor":"1","role":"none","log":"none","filter":[]}'
        }
        let serverdata = JSON.parse(fs.readFileSync('./data/server_data/' + guild.id + '.json'))
        let c = true
        if(serverdata['censor'] === 0) c = false
        let roleobject = guild.roles.get(serverdata['role'])
        if(roleobject) {
            if(mem.roles.has(serverdata['role'])) c = false
        }
        return c;
    }```
I use this to test if a server has a specific setting and it works perfectly, I just recently added the try{}catch{} in and it works great because sometimes for whatever reason the server doesn't already have a file. So when they send a message without the file it'll make one. And it works perfectly AFTER that, is there a way I could maybe like rerun the function if that error happens? Because I still want it to work on that one time it has to make the file?
sick cloud
#

omg

#

stop using json

slim heart
#

I find it easier sh

sick cloud
#

say that when your data corrupts

slim heart
#

I take backups every hour so

#

And what's to say that an actual database can't corrupt either?

#

It's besides the point

opaque eagle
#

oh nvm

keen drift
#

if you like json so much, use nosql

#

wtf

opaque eagle
#

Lol, at first I thought NoSQL was a "meme", kinda like Common Sense Anti-virus...

keen drift
sick cloud
#

whats this mean?
7|kyri | { Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: discordapp.com. is not in the cert's altnames: DNS:*.domain.com, DNS:domain.com

keen drift
#

that's interesting, first time seeing that

sick cloud
#

its happening on eris

#

really odd

keen drift
#

have you tried turning it off and on

sick cloud
#

yes

keen drift
#

O dam

#

Maybe update the CAs

earnest phoenix
#

My footer is weird on all pages of my site
https://amidiscord.me/
It worked fine before, but now it's just so messed up and I have no clue what the cause is
I wanna have the footer be like https://amidiscord.me/commands/moderation but the copyright is centered

#

I tried to find the cause but I couldn't find it

lament meteor
#

the location of the footer css might be the issue

#

¯_(ツ)_/¯

earnest phoenix
#

So overridden CSS?

#

Haven't thought of that

lament meteor
#

might be

#

cause if u see it

earnest phoenix
#

Thing is, I didn't change anything except two rules

lament meteor
#

the page length(how long u hv to scroll) is differnt

earnest phoenix
#

That's the weird part

#

prob is the reason bc it works on second.css and third.css but not first.css

haughty jewel
#

what why dont u have a common css for the footer

#

o-or do u

earnest phoenix
#

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

#

uh is that suppose to mean anything

#

got that off my pyshell

amber junco
#

How do you make your bot create a channel

mossy vine
#

read the librarys docs

amber junco
#

I couldn't find it there

slender thistle
#

What is your lib

earnest phoenix
#

if(!premiums.includes(message.author.id)) return;
(node:9943) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined

inner jewel
#

premiums is undefined

earnest phoenix
#

is yes, in the full code

#

let premiums = config.premium

soft plaza
#

🤔

earnest phoenix
inner jewel
#

theme-color

earnest phoenix
#

so like <meta property="og:theme-color" content="the color hex"> ?

inner jewel
#

no

#

just theme-color

earnest phoenix
#

<meta property="theme-color" content="the color hex">

#

oki

#

thanks

granite hedge
#

How would I make timeouts for commands/user?

opaque eagle
#

Is a “model” in Sequelize the same thing as a table?

wide ruin
#

(1 has been fixed)

earnest phoenix
#

guys
who knows how i can make a text a clickable link
so "here" would take me to discord.com
who knows how i can make my bot do that
on python

wide ruin
slender thistle
earnest phoenix
#

oh

#

in embed alright

#

ill try

#

does it work in speech marks or without @slender thistle

slender thistle
#

Speech mark wot

#

The "?

earnest phoenix
#

"

slender thistle
#

It's inside a string

#

so take a guess :^)

earnest phoenix
#

"

#

worked

#

ty

slender thistle
#

👌

wide ruin
#

what can i use instead of enmaps on js?

#

(easy to change as well)

sick cloud
#

enmap is js

wide ruin
#

yeah, but i need a better point system

sick cloud
#

use a database

wide ruin
#

how?

#

where do i look?

sick cloud
#

google?

#

nobody will spoonfeed you

wide ruin
#

i dont need the code

#

i just meant where can i look how to learn it

sick cloud
#

google

#

and choose a db

wide ruin
#

ive found database-js

#

looks pretty good

sick cloud
#

the fuck

#

no

wide ruin
#

why

sick cloud
#

use a real one

#

mongo and rethink are good ones

wide ruin
#

@sick cloud rethink or rethinkdb

sick cloud
#

wdym

wide ruin
#

which package?

sick cloud
#

rethinkdbdash

#

the official driver sucks

opaque eagle
#

Use Sequelize... I was on a similar situation as you (I had worked with SQLite earlier, which is what Enmap uses), and I'd learned Sequelize. Worth the time.
Check it out here: https://discordjs.guide/#/sequelize/ @wide ruin

sick cloud
#

not a db

opaque eagle
#

And as for finding a database, just use Heroku's free Postgres service. If you don't want to use Heroku for hosting though, create an empty app, add the postgres addon, and just put the app in maintainance mode.

sick cloud
#

it sucks anyways

opaque eagle
#

What sucks, sequelize, heroku, or postgres?

sick cloud
#

first 2 suck

#

postgres is ok

opaque eagle
#

eh I feel like sequelize is fine

ancient pendant
#

they're

#

checking

#

my

#

bot

#

im waiting

#

lol

opaque eagle
#

There's nothing stylistically wrong with having import statements in your node app instead of require statements?

earnest phoenix
#

can someone help me with error handeling

#

so

        elif isinstance(error, commands.CommandNotFound):
            return await ctx.send('Command does not exist.')

doesnt work

west raptor
#

Returning unknown command messages is bad practice, dont do it, just pass it

ruby dust
#

maybe it's commands.NotFound?

#

I haven't really read the commands ext docs

earnest phoenix
#

i cant find anything on this in docs

#

can someone send me a link

#

could someone just dm me a bunch of error handling code for most common errors ❤

slender thistle
#

commands.CommandNotFound is correct

earnest phoenix
#

but it doesnt work

#

well i dont rlly need that but how do i do no perms

#

user has no perms

#

and bot has no perms

slender thistle
#

You are using the built-in checks, right?

earnest phoenix
#

@client.event
async def on_command_error(error, ctx):

#

if this is what you mean

#

yes

slender thistle
#

I mean, in commands

earnest phoenix
#
@client.event
async def on_command_error(error, ctx):
    if isinstance(error, commands.BadArgument):
        await client.send_message(ctx.message.channel, "I could not find that member. Please try again.")

    if isinstance(error, commands.MissingRequiredArgument):
        await client.send_message(ctx.message.channel, "**Missing Required Argument**")

    if isinstance(error, commands.InvalidArgument):
        await client.send_message(ctx.message.channel, "**An error occured, Please contact @Hamza#5938 for support**")

    if isinstance(error, commands.CommandNotFound):
        await client.send_message(ctx.message.channel, "**Command not found**")
       
    else:
        await client.say("**Error, Please report this error to @Hamza#5938")

#

this is my code

slender thistle
#

Your commands

earnest phoenix
#

but most of it doesnt work

#

actually i just need Bot doesnt have enough perms

slender thistle
#

Uhh

earnest phoenix
#

cos i can just do the if and else for user no perms

slender thistle
#

Are you using async d.py?

earnest phoenix
#

yes

#

yes

slender thistle
#

say only works in commands

earnest phoenix
#

so it works in even

#

t

#

oh

#

i get you

slender thistle
#

It won't work in events

#

Do you have an on_ready event in your code?

earnest phoenix
#

yes

#
@client.event
async def on_command_error(error, ctx):
    if isinstance(error, commands.BadArgument):
        await client.send_message(ctx.message.channel, "I could not find that member. Please try again.")

    if isinstance(error, commands.MissingRequiredArgument):
        await client.send_message(ctx.message.channel, "**Missing Required Argument**")

    if isinstance(error, commands.InvalidArgument):
        await client.send_message(ctx.message.channel, "**An error occured, Please contact @Hamza#5938 for support**")

    if isinstance(error, commands.CommandNotFound):
        await client.send_message(ctx.message.channel, "**Command not found**")
       
    else:
        await client.send_message(ctx.message.channel, "**Error, Please report this error to @Hamza#5938")
slender thistle
#

Can you do print(discord.__version__) in your on_ready event

earnest phoenix
#

0.16.12

slender thistle
#

Aight

#

In your commands, what do you use for permissions checks

#

The @bot.has_permissions(...) stuff?

earnest phoenix
#

i use If

#

if ctx.message.author.server_permissions.manage_messages:

#

thats not what i meant

#

i wanna make it say something if the bot doesnt have permissions

slender thistle
#

Well, that's not going to be compatible with your global error handler

#

Remove the ifs and use decorators

#

Actually, does async have those...

earnest phoenix
#

yeah

#

it does

slender thistle
#

Aight, use those then

earnest phoenix
#

dwait

#

lemme get a suitable permission for all of them

slender thistle
#

The exceptions being raised will be commands.BotMissingPermissions for bot perms and commands.MissingPermissions for user ones

earnest phoenix
#

alright thanks

#

😃

slender thistle
#

👌

unreal smelt
#

i will uploaded now i need to wait

earnest phoenix
#

@slender thistle

#
if isinstance(error, commands.BotMissingPermissions):
AttributeError: module 'discord.ext.commands' has no attribute 'BotMissingPermissions'
slender thistle
#

Apparently async branch doesn't have that stuff

#

Yeah

earnest phoenix
#

ffs

slender thistle
#

You'll have to use ifs in commands

earnest phoenix
#

i just changed all my things 🤦

slender thistle
#

Ctrl + Z all the way ftw

earnest phoenix
#

okay so now how do i do it

slender thistle
#

ifs in your commands

earnest phoenix
#

yeah

slender thistle
#

Or probably a custom check with custom exceptions thonkpeek

earnest phoenix
#

alrdy done the ifs

#

so how do i check if the bot has perms

#

and make it say No Perms or something

slender thistle
#

<Server>.me returns Member version of the bot

#

<Server> being instance of server

earnest phoenix
#

?

#

i dont get it

slender thistle
#

For example, if the bot doesn't have permissions to kick members, you would add an if ctx.message.server.me.server_permissions.kick_members:

earnest phoenix
#

can i add it to @client.event

#

or under every command

#

!botinfo

slender thistle
#

Nope, under every command

unreal smelt
#

use the eris

earnest phoenix
#
@client.command(pass_context=True)
async def purge(ctx, amount=101):
    if ctx.message.author.server_permissions.manage_messages:
        channel = ctx.message.channel
        messages = []
        async for message in client.logs_from(channel, limit=int(amount) + 1):
            messages.append(message)
            await client.delete_messages(messages)
            await client.say('Messages deleted.')

    else:
        embed=discord.Embed(title="Permission Denied.", description="You don't have permission to use this command.", color = discord.Color.gold())
        await client.say(embed=embed)
    
slender thistle
#

If they want to use discord.py, why not just let them use it

earnest phoenix
#

so where do i add it

slender thistle
#

Your purge command checks are fine

earnest phoenix
#

no

#

they arent

#

how do i show if the bot doesnt have perms to delete messages

mossy vine
#

"use the eris" tickYes whitename tickYes

earnest phoenix
#

whats eris

mossy vine
#

discord lib

slender thistle
#

A Discord library for JavaScript, iirc

#

But let's keep that away for now

earnest phoenix
#

idk nothing about that

#

so

#

no

slender thistle
#

Oh wait, a try-except maybe because delete_messages raises discord.Forbidden

#

aka

earnest phoenix
#

idk what you mean by that(im kinda new at this)

slender thistle
#
try:
    await client.delete_messages(messages)
except discord.Forbidden:
    await client.say("I NEEED PERMS")
#

(Kinda spoonfeed but w/e)

earnest phoenix
#

lemme try

opaque eagle
#
client.once("ready", async () => {
    await client.user.setActivity(`@${client.user.username} help`);
    console.log(`Logged in as ${client.user.tag}!`);
});``````bash
Logged in as Wave#3050!
(node:23234) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
user_id: Value "TOKEN" is not snowflake.```
earnest phoenix
#

what u using to code

#
@client.command(pass_context=True)
async def purge(ctx, amount=101):
    if ctx.message.author.server_permissions.manage_messages:
        channel = ctx.message.channel
        messages = []
        async for message in client.logs_from(channel, limit=int(amount) + 1):
            messages.append(message)
            try:
                await client.delete_messages(messages)
                await client.say('Messages deleted.')
            except discord.Forbidden:
                await client.say("I NEEED PERMS")

    else:
        embed=discord.Embed(title="Permission Denied.", description="You don't have permission to use this command.", color = discord.Color.gold())
        await client.say(embed=embed)
#

not working

prime cliff
#

Seems like your token is invalid

earnest phoenix
#

@slender thistle

slender thistle
#

Oh uh

#

Please don't put it under an async for

brittle nova
#

not working best error stack

prime cliff
#

Same

earnest phoenix
#

wait

#

lemme try again

prime cliff
#

throw new Exception("This thingy broke plz contact dev");

earnest phoenix
#
@client.command(pass_context=True)
async def purge(ctx, amount=101):
    if ctx.message.author.server_permissions.manage_messages:
        channel = ctx.message.channel
        messages = []
        try:
            await client.delete_messages(messages)
            await client.say('Messages deleted.')
        except discord.Forbidden:
            await client.say("I NEEED PERMS")
#

still not working

#

and it doesnt give a error

slender thistle
#

No, wait

#

I didn't say remove the async for thing

#

Just put it on the same column as async for

earnest phoenix
#

what program u using @earnest phoenix

#

k

#

python

#

okay

#

it works

#

thanks 😃

#

rep @slender thistle

brittle nova
#

lol

earnest phoenix
#

lol

#

i once did !help in

#

aTmG do you wanna try that

ruby dust
#
  1. you are not the first, nor the thousandth to say that
  2. this is getting off-topic
earnest phoenix
#

i wanna try @earnest phoenix

#

try it

#

😃

ruby dust
#

I do not recommend recommending someone to abuse bots, especially to a whitename

#

they are too predictable to be more abusive

earnest phoenix
#

oh sorry

#

any vps cheap with 2 cpu cores?

slender thistle
#

Check pins in this channel, might help

earnest phoenix
#

yea i just dud

#

did*

#

is this good ?

#

even tho the network is unmetered

#

?

marsh lark
#

unmetered just means no limit on usage

earnest phoenix
#

ooo

#

so it good right?

marsh lark
#

well seems fine

#

better than any free one for sure

earnest phoenix
#

i was about to get the 5$ digital ocean atm

#

should i go back and do that one

marsh lark
#

Your choice, I use ovh anyways

earnest phoenix
#

um

marsh lark
#

You can get started on digital ocean with like 100 dollars free credit so

earnest phoenix
#

you use the 4.49$ a month for ovh?

marsh lark
#

nah something like 8 or something

earnest phoenix
#

o

marsh lark
#

Euro that is

earnest phoenix
#

@slender thistle

#

i have a error

slender thistle
#

Which is?

earnest phoenix
#

i get the error for permission denied even when the command works

slender thistle
#

What is your code?

west raptor
#

It seems like you ban them then check if they have perms

earnest phoenix
#

it does it for all the commands

#
@client.command(pass_context = True)
async def ban(ctx, member: discord.Member):
    if ctx.message.author.server_permissions.ban_members or ctx.message.author.id == '494565029841207327':
        role = discord.utils.get(member.server.roles, name='Banned')
    try:
        await client.add_roles(member, role)
        embed=discord.Embed(title="User Banned!", description="**{0}** was banned by **{1}**!".format(member, ctx.message.author), color = discord.Color.gold())
        await client.say(embed=embed)
    except discord.Forbidden:
            embed=discord.Embed(title="No Perms....", description="Please make sure i have the permissions required to run this command.", color = discord.Color.gold())
            await client.say(embed=embed)
        
    else:
        embed=discord.Embed(title="Permission Denied.", description="You don't have permission to use this command.", color = discord.Color.gold())
        await client.say(embed=embed)
#

oh

#

ik

#

cos the if and try are in same line

#

i think

slender thistle
#

Yep

#

You got it right

earnest phoenix
#

ty anyways 😃

slender thistle
#

Just move the try-except things

earnest phoenix
#

yeah

#

thats what im doing

#

btw

#

do you know how to make a suggestion command?

slender thistle
#

Depending on what you want it to do

earnest phoenix
#

so ppl can suggest things for me to look at

slender thistle
#

DM you or post in another channel?

earnest phoenix
#

dm me

#

is spoonfeeding like not allowed or what

#

why is everyone like "STOP SPOON FEEDING"

slender thistle
#

Yeah

earnest phoenix
#

on this server too?

slender thistle
#

Yep

earnest phoenix
#

what if you dm me and help

slender thistle
#

Well, I can suggest you what to do but I won't post a ready code :p

earnest phoenix
#

alright

#

so what shold i do

#

should*

slender thistle
#

Check for what

#

This is a suggestion command ThinkButUpsideDown

#

ban command was fixed

marsh lark
#

All you need for a suggestion command is to take in all the arguments and send it into a channel

slender thistle
#

Aight, so:

  1. I suggest you to do async def suggest(ctx, *, suggestion):, * meaning "consume the rest" aka all things after !suggest (assuming your prefix is !) will be stored in suggestion
  2. Use discord.utils.get to get your profile
  3. Send suggestion to yourself
#

A bit detailed RenShrugGif

earnest phoenix
#

alright

#

thanks 😃

#

ill do dm

#

i think ik how

#

if i need help ill tag you

slender thistle
#

Trial and error is the best way to learn :^)

#

Mhm

earnest phoenix
#

how do i define myself?

slender thistle
#

Use discord.utils.get to get your profile

#

One sec

earnest phoenix
#

doesnt that mean i have to be in the server

slender thistle
#

You can iterate through client.users

earnest phoenix
#

so
owner = member = discord.utils.get(client.users.members, name='Hamza#5938')
or
owner = member = discord.utils.get(client.users, name='Hamza#5938')

#

i mean member = discord.utils.get(client.users.members, name='Hamza#5938')

#

how

#

oh

#

would that work?

slender thistle
#

Nooooooooooo

#

Remove the .members

#

You got me wrong, mate

#

client.users is a list of User objects

#

and they are doing .members on a list

#

Which doesn't make sense

earnest phoenix
#

owner = discord.utils.get(client.users, name='Hamza#5938')

#

so this?

slender thistle
#

Nope, wrong

#

You can't do send_message(id, stuff)

#

first arg has to be a object thonkpeek

#

Well, yeah

#

@earnest phoenix

#

Better to check ID instead though

earnest phoenix
#

im confused

#

@slender thistle so
owner = discord.utils.get(client.users, name='Hamza#5938')

slender thistle
#

You are close

#

Just check the ID instead with an id argument

#

No.

#

members are server members

earnest phoenix
slender thistle
#

client doesn't have that

earnest phoenix
#

that?

slender thistle
#

Almost

earnest phoenix
slender thistle
#

client.users tho

earnest phoenix
slender thistle
#

Without .id

earnest phoenix
#

owner = discord.utils.get(client.users, id='1634636236')

slender thistle
#

Yep

#

Put your actual ID tho

earnest phoenix
#

ik

slender thistle
#

and you are good

earnest phoenix
#

he isnt i dont think

#

@slender thistle <class 'discord.ext.commands.bot.Bot'>' object has no attribute 'users'

#
@client.command(pass_context=True)
async def suggest(ctx, *, msg):
    author = ctx.message.author
    owner = discord.utils.get(client.users, id='494565029841207327')
    await client.send_message(owner, "**NEW SUGGESTIONS**\n" + author + msg)
slender thistle
#

Uhh

#

client.get_all_members() then

earnest phoenix
#

lemme try

#

still nope

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: must be str, not Member

#

@slender thistle

#

😦

slender thistle
#

+ str(author) + '\n' + msg.content

earnest phoenix
#

im abit stupid

#

Command raised an exception: AttributeError: 'str' object has no attribute 'content'

#

got it

#

removed the .contect from msg.content

#

😃

unreal smelt
#

<@&265158261945270273> Accept My Bot Plz

languid dragon
#

No

unreal smelt
#

yes im waiting 1 hour

languid dragon
#

Your bot will instantly get declined now

queen sentinel
#

@unreal smelt don't ping that role and don't ask for your bot to be reviewed

unreal smelt
#

ok

languid dragon
#

Read the faq

earnest phoenix
#

@slender thistle

#

do you know how i can make a human verification system

slender thistle
#

@earnest phoenix What is the verification system even supposed to look like

earnest phoenix
#

so if someone spams they have to say some random letters

#

to be unmuted

#

or they get muted

#

nope

#

i dont

slender thistle
#

uhhh

#

No idea

earnest phoenix
#

or do you know how to do anti spam system

slender thistle
#

Create a list, append user ID, remove later (await asyncio.sleep), on every message check if the user ID is in that list X times, if yes, punish, else skip

earnest phoenix
#

confusing

#

can you make that a bit less confusing

opaque eagle
#

Hello node.js peeps, Sequelize noob here...```js
// ./Assets/sequelize.js
const Sequelize = require("sequelize");
module.exports = new Sequelize("testdb", "hello", "goodbye", {
dialect: "sqlite",
logging: false,
storage: "testdb.sqlite3"
});

// ./Models/tags.js
const Sequelize = require("sequelize");
module.exports = require("../Assets/sequelize").define("tags", {
name: { type: Sequelize.STRING, unique: true },
content: Sequelize.TEXT,
guildID: Sequelize.INTEGER,
userID: Sequelize.INTEGER
});

// ./Commands/tags/add.js
const Tags = require("../../Models/tags");

const tag = await Tags.findOne({ where: { name, guildId: message.guild.id } });
if (tag) return this.client.commands.get("edit").run(message, { name, content });

await Tags.create({
name, content,
guildID: message.guild.id,
userID: message.author.id
});``````bash
SequelizeDatabaseError: SQLITE_ERROR: no such table: tags```

tight heath
#

// why would you

earnest phoenix
#

help moi

slender thistle
#

Create a list upon bot start
Upon every message, add user ID into that list
Use asyncio.sleep (refer to Google for better explanation) to delay removing from the list
Now, upon every message, you check if user ID is in that list X times (iterate and custom variable with counting) - if yes, punish, if user is not in the list X times, just skip

tight heath
#

@earnest phoenix we're not here to write your bot for you

earnest phoenix
#

rave i didnt ask you stop getting involved

tight heath
#

don't get rude.

queen sentinel
#

um

#

calm it down, children

tight heath
#

We're not spoonfeeding.

#

end.

earnest phoenix
#

IM NOT ASKING YOU RAVE

queen sentinel
#

no need to go breaking rule 1

slender thistle
#

Hello Jonny mmLol

queen sentinel
#

Hey there doggowave

opaque eagle
#

@earnest phoenix either learn to code yourself

earnest phoenix
#

thats what rave is doing

tight heath
#

oh hi Papa John

opaque eagle
#

*coughs* use DBM

earnest phoenix
#

OMD JUST STOP GETTING INVOLVED

queen sentinel
#

calm the fuck down, dude

tight heath
#

okay Jonny please

earnest phoenix
#

I didnt ask you to spoon feed did i rave?

queen sentinel
#

Rave you called me "John" sadd

tight heath
#

I made a pizza joke

queen sentinel
#

ahh

tight heath
#

that's a compliment!!

#

I love Pizza

queen sentinel
#

thank

tight heath
#

:)

opaque eagle
queen sentinel
#

better be no more heckin fights when I look back here

opaque eagle
#

Use TheSourceCode

#

lmao

#

best tutorials 100%

#

would recommend

tight heath
#

use Raven™

#

best source code

#

100%

#

would recommend

slender thistle
#

Fuck off.

queen sentinel
#

oh no

tight heath
#

el mao

slender thistle
#

Seriously, this tutorial is already bad enough

queen sentinel
#

as an absolute novice in coding I can tell that's the best practice

tight heath
#

I mean

#

it's python

opaque eagle
#

Don't mean to be intrusive but i kinda need help on that question

tight heath
#

that's not best practice anyways

slender thistle
#

Why do you have Client and client defined

#

both being different things

earnest phoenix
#

@tight heath thats not a anti spam

tight heath
#

oh you were the sqlize guy @opaque eagle

earnest phoenix
#

thats to block swear words 🤦

#

or words

opaque eagle
#

Yeah

tight heath
#

I'll have a look

opaque eagle
#

Thx

tight heath
#

:)

slender thistle
#

Oh seriously

tight heath
#

I mean I just use mongo

#

but lmao

queen sentinel
#

Wabster, no memes here kthanks

#

just a heads up 👌

topaz fjord
#

Mongodb is nice

#

But I also like sql

slender thistle
#

@earnest phoenix Create list, add all swear words you know, iterate and check if element.lower() is in message.content.lower()

opaque eagle
#

I like sql cuz someone already made a discord.js commando settingsprovider for it lol

slender thistle
#

true - punish
false - skip

earnest phoenix
#

ik how to do that

#

i wanna make like anti spam

topaz fjord
#

Ew commando

slender thistle
#

I thought you were doing an antispam NotLikeMiya

#

like antispam wat

earnest phoenix
#

so people dont spam

opaque eagle
#

I strip commando of all its features and custom-build every aspect of it but it's commando at its core

earnest phoenix
#

so if someone the same message or sends lots of messages together

tight heath
#

lmao what

earnest phoenix
#

it locks the chat

tight heath
#

just write a command handler

earnest phoenix
#

or mutes them

opaque eagle
#
Someone.on("sendsRandomMessages", person => person.mute(eternity));```
slender thistle
#

@earnest phoenix That is an antispam, though

opaque eagle
#

oh

earnest phoenix
#

it is

#

stops spam

slender thistle
earnest phoenix
#
@client.event
async def on_message(message):
    contents = message.content.split(" ") #contents is a list type
    for word in contents:
        if word.upper() in chat_filter:
            if not message.author.id in bypass_list:
                try:
                    await client.delete_message(message)
                    await client.send_message(message.channel, "**Hey!** You're not allowed to use that word here!")
                except discord.errors.NotFound:
                    return

this isnt

slender thistle
#

Uhhhhh

#

That's just a bit weird

#

plain weird

earnest phoenix
#

this is whats in the vid

slender thistle
#

That video sucks.

earnest phoenix
#

and that isnt a antispam

#

ik

tight heath
#

create a new map called messages (or an array with tuples)

#

map author to last message

#

on message

slender thistle
#

I explained how to do an antispam

tight heath
#

compare message to message in that map

#

if same

#

delete

earnest phoenix
#

but its confusing

tight heath
#

and?

slender thistle
#

What maps are we talking about

tight heath
#

there's arrays in d.py

slender thistle
#

What are maps anyways

#

They are lists, thank you

#

:^)

tight heath
#

they're arrays in literally every language

#

sort by date

#

yeah

slender thistle
#

Don't do an API call on every message.

tight heath
#

but this is faster

#

since exactly

#

no API calls

#

adds +100ms atleast

slender thistle
#

That's just bad and slow

tight heath
#

and is bad for your ratelimits

earnest phoenix
#

still confused

tight heath
#

this

#

author id -> message

earnest phoenix
#

i cba for this its too confusin

#

g

tight heath
#

it's really not

earnest phoenix
#

im not that good at coding

tight heath
#

you map each author

earnest phoenix
#

okay?

tight heath
#

to their last message

#

it's not coding

#

this is logical thinking

#

so

#

you map each author to their last message

#

like

earnest phoenix
#

dk how

tight heath
#

read the link

#

I just sent

#

that's the datatype

#

it's called a dictionary in python

#

method to do that is .update

earnest phoenix
#

anyone know what that errro means

tight heath
#

which one

earnest phoenix
#

[tls @ 000001dd0004d9c0] Error in the pull function.
[matroska,webm @ 000001dd0004a8c0] Read error
[tls @ 000001dd0004d9c0] The specified session has been invalidated for some reason.
Last message repeated 1 times

#

the bot token isnt working

#

maybe

#

i was playing music on my bot and it showed that after like 3 mins

tight heath
#

maybe your connection to youtube

earnest phoenix
tight heath
#

yeah

earnest phoenix
#

i use youtube_dl

tight heath
#

mmmmm

#

youtube threw you out lmao

earnest phoenix
#

rave

#

rip

tight heath
#

just try again

#

?

earnest phoenix
#

ok

tight heath
#

should be

topaz fjord
#

Just try again

earnest phoenix
#

do you know how to make it so users can config the prefix

topaz fjord
#

@earnest phoenix yes

tight heath
#

in python

#

tho

#

owo

earnest phoenix
#

yeah

topaz fjord
#

have a database to store server config

earnest phoenix
#

python is good

topaz fjord
#

golang is good 👌

tight heath
#

mmmmh I prefer languages who call Arrays Arrays and Maps Maps

#

:-)

earnest phoenix
#

lmao

#

idk how databases work

topaz fjord
#

Slices are arrays in golang

earnest phoenix
#

im doing sql in school rn lol

topaz fjord
#

and map[string]string is a map

earnest phoenix
#

we have to make some tables in sql rn

slender thistle
#

has this turned into "x is better" topic now

earnest phoenix
#

some databases

topaz fjord
#

sql is nice

#

but i prefer nosql

slender thistle
#

mongodb > * ofc

tight heath
#

ik golang is bae

earnest phoenix
#

UHHHHHHHHH

#

i been waiting since 10:45 PM to get my bot verified and its been 12 hours and Xiggy said at 11 Will be at your bot in 20-40 mins

tight heath
#

and mongodb > * I agree with

topaz fjord
#

@tight heath yes yes

earnest phoenix
#

why is spoon feeding not allowed

topaz fjord
#

golang is bae

slender thistle
#

Bad for learning @earnest phoenix

topaz fjord
#

because it doesnt teach people shit

tight heath
#

@earnest phoenix I waited for 2 days so chill lmao

topaz fjord
#

I got denied the first time

earnest phoenix
#

same

tight heath
#

^ same

topaz fjord
#

for offline

earnest phoenix
#

same here

tight heath
#

because wiki command

earnest phoenix
#

i waited 2 days too

tight heath
#

could possibly

#

contain nsfw images

#

if

#

you

#

query it that way

topaz fjord
#

I didn't have permanent hosting before

slender thistle
#

@earnest phoenix I waited 2-4 days to get my bot approved, so keep calm and patient, it will be better for you

earnest phoenix
#

i got denied from this host cos they didnt test it propperly

topaz fjord
#

they didn't test it properly

#

debatable

tight heath
#

it has to be

#

so they CAN

#

test it properly

earnest phoenix
#

i got denied first time because my bot "Did nothing"

tight heath
#

not the other way round

earnest phoenix
#

is it possible to do a changing profile pic?

topaz fjord
#

fuck me I hate doing clean uninstalls

#

I'm just trying to uninstall MS SQL

tight heath
#

why did you have that in the first place

topaz fjord
#

idek

earnest phoenix
#

someone made his lights turn off with a cmd in discord how nice

#

thats probs easy

tight heath
#

life goals

earnest phoenix
#

get smart lights

topaz fjord
#

seems easy

earnest phoenix
#

and then its probs easy

tight heath
#

I mean you still need to understand the API

#

but

topaz fjord
#

most smart lights have sdks

tight heath
#

oh and it's harder than a freaking antispam

#

lmao

earnest phoenix
#

i just cba to do it rn

#

im tired

tight heath
#

oof

#

that guy looks like he's 12

earnest phoenix
#

ik

#

he sounds 13

topaz fjord
#

I still don't know how to get audio data from windows

tight heath
#

in what sense

#

also lmao that API is easy as heck

#

sub_process.exec ¯_(ツ)_/¯

earnest phoenix
#

oh he used a raspberry pi connected to his desklamp

tight heath
#

ooof

topaz fjord
#

wdym rave

tight heath
#

it's a terminal command he's executing

topaz fjord
#

oh

tight heath
#

in node you could do that using sub_process.exec

earnest phoenix
topaz fjord
#

The other thing idk how to do is detach a process from its parent process

#

in go

#

trying to make a docker container type thing

earnest phoenix
#

still trying to figure out how to host my bot on my pi

topaz fjord
#

time to play around with datagrip

#

earnest phoenix
#

would i use putty to connect it to win10?

topaz fjord
#

you would use putty if you're running the rpi in headless mode

earnest phoenix
#

reeee

#

ok imma goto my pi and get its ip

tight heath
#

127.0.0.1

earnest phoenix
#

why wont this wokr?!

const Discord = require('discord.js')
const footer = require('../settings/config.json')

exports.run = async(client, message, args) => {
    client.on('guildCreate', () => {

    async (client, guild) => {
        const invite = await guild.channels.find(c => c.type !== "category" && c.position === 0).createInvite({
            maxAge: 0
        });
        let joinEmbed = new Discord.RichEmbed()
        .setTitle("Bot joined server!")
        .setThumbnail(guild.iconURL)
        .addField("Server Name:"+ guild.name)
        .addField("Server ID:" + guild.id)
        .addField("Server Owner:" + guild.owner)
        .setFooter(client.config.botname)
        .setTimestamp()
    client.channel.get(footer).send(joinEmbed);
    }
      })
};
              
              
topaz fjord
#

idk give us an error

earnest phoenix
#

no error

topaz fjord
#

also

#

that wont work all the time

west raptor
#

did you invite the bot

#

to a guild

earnest phoenix
#

ye

topaz fjord
#

that will error some times

earnest phoenix
#

i knw

topaz fjord
#

if the bot doesn't have the perms to create an invite

earnest phoenix
#

i know, im going to make it return if it does not have invite perms

topaz fjord
#

what part of it isnt working

earnest phoenix
#

it doesnt send the message, i dont know if it does the above, but no error anyway

#

and the id is correct

topaz fjord
#

what is footer

#

when you require the config.json file

#

it gets the whole file