#development

1 messages · Page 729 of 1

static nexus
#

now all i need to do is find a host

knotty steeple
#

selfhost usually works

#

for like a small bot

#

or a pi

#

the raspberry ones

static nexus
#

good idea

valid frigate
#

k well once you can afford it

#

there are a lot of vps options out there

#

id definitely consider moving off of rpi especially if you anticipate a lot of guilds

static nexus
#

i am only expecting a small amount of users at first

#

it's legit just a moderation fun and delivery bot

vital lark
#

@valid frigate uhm

unique nimbus
#

If you can afford 5 euros a month

#

Contabo is good

vital lark
#

in kotlin is there a substantial difference between contains and containsKey when using both methods on a HashMap?

contains is finding if the value of the key exists
containsKey is finding if the key exists in the HashMap

#

iirc

valid frigate
#

ohhhh

#

yeah ig

#

so contains iterates over the values

vital lark
#

yea

vivid vapor
#

Help plz i am program my sofware but my h2 dont work every time its chrashing the program

unique nimbus
#

Send Code which is crashing it

#

Hide Token if its there

vivid vapor
#

Oki

#

O w8 i got it

#

I put _ this thing wrong

modest schooner
#

could anyone help me with having my bot add reactions with discord.py? ive tried await message.add_reaction(pensive)
but got the error

#
    await message.add_reaction(pensive)
NameError: name 'pensive' is not defined        ```
slender mountain
#

What's the follow of pensive

#

*value

modest schooner
#

😔 i dont know im looking to add this emoji

amber fractal
#

it's plain english

#

you didn't tell it what "pensive" means

summer torrent
#

what is pensive?

modest schooner
#

im guessing i need its id or something? where can i find the emoji ids

#

😔

summer torrent
#

\:emojiname:

amber fractal
#

Default ones dont have them

summer torrent
#

\:smile: --> \😄

blissful scaffold
#

Copy nmw his emote into your code

slender mountain
#

Unless you have a variable with the name 'pensive' that would never work

vital lark
#

@summer torrent default emojis need the unicode counterpart

#

for py it's \u{code} iirc

#

or u'{code}'

modest schooner
#

thanks for the help! i ended up doing pensive = '\U0001F614' await message.add_reaction(pensive)

slender thistle
#

Couldn't you really just slap 😔 in it

unique nimbus
#

Don't slap, its not nice

#

but yes that would work

cunning oxide
#

anyone know anything about writing bots in multiple languages? not like code languages. We're trying to do something because our french users have requested a version of the bot in french. We don't really wanna have two separate bots.

low wasp
#

Have an object with each language with responses

lang['en'].ping = 'ping'
lang['fr'].ping = 'ping in French'

Then the response just call that object with the language the user choose in a settings

#

@cunning oxide

earnest phoenix
#

Here's Johnny?

low wasp
earnest phoenix
#

🐷

low wasp
earnest phoenix
#

Ok

#

🐸

cunning oxide
#

@low wasp so even with embeds, I can just use that as a response?

#

sry for ping

low wasp
#

Yeah

#

Anywhere where you would normally have 'response' you can replace it with lang[serversettings.lang].response

#

@cunning oxide

gilded finch
#

....

earnest phoenix
#
if(command === "clyde") {
    let url = "https://nekobot.xyz/imagegen/940ec9ee-97e1-4ccc-8d55-367af08123c4.png"
    let settings = { method: "GET" }
    
    fetch(url, settings)
    .then(res => res.json())
    .then((json) => {
      message.channel.send(new Discord.RichEmbed()
                          .setTitle("Clyde")
                          .setImage(json.text)
                          .setColor(client.embedcolor)
                          );
    })
}```
vital lark
#

what about it

west raptor
#

?

vital lark
#

@earnest phoenix also the url is a image url

#

just add the url to setImage

west raptor
#

I was about to say-

#

Like wut

vital lark
#

urls are buffers, not JSON

earnest phoenix
vital lark
#

@earnest phoenix it's because the URL is a Buffer, not a JSON value

#

just do .setImage('https://nekobot.xyz/imagegen/940ec9ee-97e1-4ccc-8d55-367af08123c4.png')

wet forge
#

just a quick question since i'm uneducated with discord.js; does it support TypeScript files

vital lark
#

@wet forge yes

wet forge
#

epic this is going to make my life so much easier

earnest phoenix
#

Bonjour je vien de crée mon dasbord et je ne trouve pas command le connecter a mon domaine un personne pourait me venir en aide

digital sparrow
#

How to use shard? discord.js pls help me

slender mountain
earnest phoenix
#

if (message.member.hasPermission("BAN_MEMBERS")) permlvl = 2;

vivid vapor
#

What is bot luca

iron gale
#

ı dont know to write this which channel but

#

in here

vivid vapor
#

You need to go to bot list and then login to onorher site

sterile minnow
orchid solstice
#

Hey o have a question for a glitch project can i tell my questiom in this channel?

#

hey is it possible to do that with glitch to see if a bot is online and if not the glitch project goes offline? and if the bot is again attached, will the project go on again?

digital sparrow
#

so how i block bot if bot not have permision in channel to send message discord.js

earnest phoenix
#

How can I look at the use of memory of 5 shards individually

#

e.g
Shard 1 : 550 \ 12288MB
Shard 2 : 420 \ 12288MB
Shard 3 : 400 \ 12288MB
Shard 4 : 350 \ 12288MB
Shard 5 : 223 \ 12288MB

alpine grotto
#

Bruh

earnest phoenix
#

@earnest phoenix discord.js?

#

@earnest phoenix yes

quartz kindle
#

use broadcastEval + process.memoryUsage()

earnest phoenix
#

broadcastEval process.memoryUsage()

#

I want to see them all at once

quartz kindle
#

is your bot approved?

#

yes

#

all bots are manually reviewed by the staff to make sure they work etc

alpine grotto
#

True facts

quartz kindle
#

sometimes there are hundreds of bots waiting

alpine grotto
#

Yup so gay

quartz kindle
#

@earnest phoenix broadcastEval does that

earnest phoenix
#

bot.shard.broadcastEval((process.memoryUsage([3]).heapUsed / 1024 / 1024).toFixed(2))
I want to see the use of 3.shard memory by doing so but it does not work @quartz kindle

alpine grotto
#

I'm bored what are u guys using the group chat for anyways

quartz kindle
alpine grotto
#

No one is texting on there

quartz kindle
#

@earnest phoenix you need to check which shard it is from inside the broadcastEval

#
broadcastEval("bot.shard.id === 3 ? process.memoryUsage() : null")```
#

but its much easier to just get the memory usage from all shards, then filter it

#

since the returned array is indexed by shard id

earnest phoenix
#

@quartz kindle

#

client typed instead of bot gives client is not defined error

#

I also want the memory use of 5 shards at the same time

#

(will be in the shardinfo command)

alpine grotto
#

How do u leave these group chat thingys

digital sparrow
#

so how i block bot if bot not have permision in channel to send message discord.js

sudden geyser
#

Erensi, bot was probably just an example. Replace it for this

#

Zentai, get the permissions for your bot in the channel and see if it has SEND_MESSAGES. There's a permissionsFor method on the TextChannel instance

earnest phoenix
#

I use bot @sudden geyser

sudden geyser
#

in broadcastEval, this is your instance of Client/bot

spice trail
#

Right... I've got a question

#

Autosharding with python

#

What am I doing wrong

knotty steeple
#

what are you doing

#

xd

digital sparrow
#

And what is shard? discord.js

spice trail
#

Client = autoshardedbot(nessesary peramiters)

#

@client.event

aysnc def on_ready():
"Print statement here and prints fine"

#

However

#

The test bot does not come online

#

Yes I've told it to run token

#
TOKEN = "YuP"
client = AutoShardedBot(command_prefix=("~"), case_insensitive=False, shard_count=2, shard_ids=(1,2))

@client.event
async def on_ready():
    print(f"[OK] - {client.user.name} ({client.user.id}) - (Status - Online)")

client.run(TOKEN)
earnest phoenix
#

How can i edit bot's embed description with fetchMessage?

spice trail
#

Read the docs and I imagine use string formatting

earnest phoenix
#

Can u send link @spice trail?

spice trail
#

go to the documentation site for your programming language

#

and string formatting is well string formatting

earnest phoenix
#

OoF

knotty steeple
#

@earnest phoenix so just edit a message?

earnest phoenix
#

No embed message

knotty steeple
#

same thing

#

what library

earnest phoenix
#

js

knotty steeple
#

library

#

not lang

earnest phoenix
#

discord.js

#

:D?

knotty steeple
#

do u want to edit after you send the message

languid dragon
#
knotty steeple
#

<Message>.edit()

earnest phoenix
#

I want to change the message description

#

not SİMPLE MESSAGE

#

embed description you mean

spice trail
#

THE SAME EDIT COMMAND APPLIES

knotty steeple
#

<Message>.edit({embed: {}})

spice trail
#

just assign the embed to a var

earnest phoenix
#

OOOOF

knotty steeple
#

pretty sure that works

#

so dont scream at me apply logic

#

idk i use eris mmLol

earnest phoenix
#

you can't edit specific embed fields, you have to edit the whole embed

#

but yeah

#

it does

spice trail
#

^^

earnest phoenix
#

also try not to spoonfeed and instead link to docs

long cliff
#

How can I check the connection to the discord servers?

#

Sometimes my bot's connection would silently fail without error

#

Then client ready is called again after timeout period

earnest phoenix
#

it doesn't silently fail, you're just not handling your errors properly

long cliff
#

client.on('error', console.error);

#

I have this but I don't really see anything on the console

earnest phoenix
#

ready is called whenever the bot establishes an entirely new connection to the gateway (aka when it can't resume or on startup)

static nexus
#

How do we log a messages text and post it to another channel discord pizza style

long cliff
#

is there a way to actively ping the server for connectivity check?

earnest phoenix
#

don't do that

static nexus
#

With the permission ovs

earnest phoenix
#

listen for message created/received event -> check if the channel id of the message is the one you want -> get the channel to which you want to post the message -> send the received message's content @static nexus

static nexus
#

kthnx

earnest phoenix
#

New bot me

static nexus
#

i'm gonna have to boot up DBM and use it to research

long cliff
#

idk why but my bot had been offline for like 12 hours without an error

patent prism
#

Did you start it?

static nexus
#

If laptop off, bot ofdf

long cliff
#

I only see client ready called after 12 hours

earnest phoenix
#

there are tons of factors which could've caused a disconnect

#

api outage, internet outage, if using a free host something happened there probably, bad code, cpu overhead

spice trail
#

'silent error' just arnt a thing

#

could just be ur bot getting stuck in a loop

long cliff
#

shouldn't it throw client error anyway?

spice trail
#

and not responding to commands anymore

#

not unless u tell it too

long cliff
#

I already set client error to call console error

#

I've seen it working before - but not this time

spice trail
#

well if it isnt doing anying its probably not crashing

earnest phoenix
#

listen for the disconnect event too

spice trail
#

its more likley just getting stuck in a loop

earnest phoenix
#

and print out the code

spice trail
#

^

long cliff
#

yeah

#

I'll check that out

earnest phoenix
#

it could've just been cloudflare doing a swoop

static nexus
#

3

static nexus
#

python thinks my thing doesnt exist

#

pls help

spice trail
#

code

cedar brook
#

What is normal problem, when they are declining bots?

static nexus
#

They should give a reason

spice trail
#

long description filled with junk

cedar brook
#

Oh

spice trail
cedar brook
#

Ty

spice trail
#

anyway whats the code sobble

cedar brook
#

🙏 Please, don't decline my bot.

static nexus
#

lemme go get it

#
import discord
import random
from discord.ext import commands

client=commands.Bot(command_prefix='sb!')
@client.event
async def on_ready():
    print('Bot is ready!')
@client.event
async def on_message():
    channel = message.channel
    if message.content.startswith('sb!ping'):
        await client.sendmessage(channel, 'You expected your ping but it was me, DIO! https://media.discordapp.net/attachments/645025686414819332/645251910806405132/tumblr_pmsciyLJ7X1v7ql19_1280.png?width=452&height=451')

    if message.content.startswith('sb!echo'):
        msg = message.content.split()
        output = ''
        for word in msg[1:]:
            output += word
            output += ' '
            await client.send_message(channel, output)
    if message.content.startswith('sb!server'):
        await client.sendmessage(channel, "I heard you wanted to join the Sobble Squad. Well, here's the link.CSsj7Hy")
    if message.content.startswith('sb!order'):
         await client.sendmessage(channel, "There's nothing in here to order!")
client.run('bitch you thought')```
#

ignore the does

#

ik to fix that

#

the only error i get it

#

File "C:\Users\mouga\Documents\Document1.py", line 1, in <module>
import discord
ModuleNotFoundError: No module named 'discord'

spice trail
#

you actually installed discord to path?

static nexus
#

to paaaaath

#

thats the problem

#

tysm

#

i did

#

ok that's not the problem

slender thistle
#

Are you sure you are using the same env vars

static nexus
#

yes

#

i redid it

#

let me try now

static nexus
#

My bot is weir

#

d

#

Moderation commands work

#

but talking commands don't

jovial idol
#

Aaaa

earnest phoenix
#

i need help thinking of a better var name for "value_value" and suit_value

#

what do the variables do

blissful scaffold
#

if it's the value and suit of a card then you could just call it value and suit?

#

no need to add value at the end of it

#

or maybe change the suit_value to suit_id if you identify the suit with it

earnest phoenix
#

i use the _value to sort the cards

dusky marsh
#

Is it smart to create a table for each Guild, to make the leaderboard for points easier?

earnest phoenix
#

because even though "ace" represent 1, it doesnt have the "value" of one and being less than "two"

valid frigate
#

large ass bots like mee6 do that all the time

#

so making seperate tables for each guild is fine, since iirc hundreds of thousands of tables can work fine

dusky marsh
#

Nice, thanks.

valid frigate
#

np

iron gale
#

hey guys i edited page but other peoples see page old form

#

why?

unique nimbus
#

Cache

iron gale
#

when the others see the page new form

blissful scaffold
#

eventually

#

depends how long it takes for the cache to reset

wooden moss
#

Why does my bot on the top.gg website have no Server Counter?

lament meteor
#

have u posted the amount of servers your bot has?

sly cave
#

I have tried to get my bot verified now twice and got declined. No reason why? First time ok, Description I spammed. but second time I did everything I should?

compact oriole
blissful scaffold
#

@sly cave the reason why it's declined is in #mod-logs

wooden moss
#

@lament meteor Command or on the site

lament meteor
#

on the site

wooden moss
#

no.

blissful scaffold
sly cave
#

@blissful scaffold Thank you very much!

#

Your bot doesn't have a (working) help command or obvious point of entry. Please make sure your bot has a help command or has an explanation in the bot description.

#

that means I just need to code a !help command? and then it should be good?

compact oriole
#

If theres no otehr problems, yes, all is good

#

Im garbo at typing fast

blissful scaffold
#

Im also really slow when im using my phone

wooden moss
#

why you send me link to top.gg API?

earnest phoenix
blissful scaffold
#

because you need that to get the number of servers your bot is in on the top.gg list

#

your bot needs to tell the DBL bot list how many server it is in

#

You do that with the top.gg api

wooden moss
#

ok

#

thx

random lodge
#

I am looking for a bot in discord to manage players looking for a division or team. Can anyone help me?

barren moss
#

how many days takes to approve your bot?

spice trail
#

Week+

night gate
#

How I setup dns setting of a domain for vps

barren moss
#

oh heck

blissful scaffold
#

aproximately a week

barren moss
#

I submitted like 2 weeks before

#

Nobody talked about it

blissful scaffold
#

Luca will DM you when your bot is approved or declined

barren moss
#

Oh ok

blissful scaffold
#

Did you get a DM?

barren moss
#

Never

#

:P

blissful scaffold
#

You can also check #mod-logs to see why your bot is declined

night gate
#

Any one here who can help me

barren moss
#

Ik

compact oriole
#

@celest spear tf I was gonna bid but I dont have that much money lol

silver coyote
#

Whos can help me?

barren moss
#

I only get pinged in this server when I edit my bot's desc

#

:/

compact oriole
#

Ok now youre just killing me xd

silver coyote
#

how can join server discord?

night gate
#

xD

compact oriole
blissful scaffold
#

@barren moss in #mod-logs only the bot is mentioned when its declined, you will have to search for your bot name or id

barren moss
#

Ik

#

But Luca didn't DM me

earnest phoenix
#

@barren moss #faplease

barren moss
#

faplease

#

ok

compact oriole
#

Its NNN now, cant do that

#

jkjk

earnest phoenix
#

Lucas can't dm à people with close dm

blissful scaffold
#

yeah, luca should also have DM'd you when you added your bot to the list
If you didn't receive that DM then you probably also wont get a DM when you bot is checked

static nexus
#

Discord.py
How to use .send() for more than 6 arguements?

unique nimbus
#

what

#

what are you trying to do

static nexus
#

im trying to make order command

#

i cracked most of it

#

just that specific bit

unique nimbus
#

show the command which you are getting an error from

static nexus
#
 if message.content.startswith("sborder"):
        channel = client.get_channel(645025686414819332)
        await channel.send("We've got an order! Here's the info!", "Order 
        information", message.content, "Orderer", message.author)```
compact oriole
#

You need to make a rich embed

unique nimbus
#

yes

static nexus
#

how do we do that

#

wait no

#

i'll get the docs

unique nimbus
#

yes

patent prism
#

Don’t use on_message for commands

#

Use the ext.commands handler

unique nimbus
#

Use cogs

#

and bot.command()

#

client.command()

#

idfk what you defined for the bot

patent prism
#

Better to name it bot

compact oriole
#

I name it client

#

Its a bit misleading though

patent prism
#

commands.Bot

unique nimbus
#

I mean you can call it a_gay so it would be a_gay.command()

patent prism
#

discord.Client

compact oriole
#

As its not a "client"

unique nimbus
#

yeet

patent prism
#

It makes sense if you name .Client client and commands.Bot bot

unique nimbus
#

However why do you name things sensibly

#

that is so wrong

#

smh

static nexus
#

How do we get another server's invite

unique nimbus
#

That is against TOS if I remember correctly

patent prism
#

TextChannel.create_invite / VoiceChannel.create_invite to make one, or Guild.invites

static nexus
#

peter i mean i will add a disclaimer

patent prism
#

Yeah it could be considered backdooring into servers

static nexus
#

Lemme explain

#

Someone adds bot
Thanks for adding me! For your information, every time the command sborder is done, a server invite which is one use is given to the Sobble Cafe server.
Someone does sborder
i got their name and the order's information
but not the invite

#
        invite = await bot.create_invite
        channel = client.get_channel(645025686414819332)
        embed = discord.Embed(title="New Order:", description=message.info, color=0x00ff00)
        embed.add_field(name="Orderer:", value=message.author, inline=False)
        embed.add_field(name="Server ordered in:", value=invite, inline=False)
        await send.channel(embed=embed)```
#

my attempt

patent prism
#

Still should use ext.commands

static nexus
#

this is rewrite

unique nimbus
#

yes

static nexus
#

can i get assistance

patent prism
#

rewrite doesnt exist technically

unique nimbus
static nexus
#

JUST TELL ME WHAT'S WRONG

restive furnace
#

on what

loud salmon
#

@static nexus Please go easy on the caps. I would read all the pins in this channel and see all of the etiquette and other links about how to ask the right questions.

restive furnace
#

bot.create_invite() ?

#

ctx.channel.create_event with autosharded bot and commands.Bot

earnest phoenix
#

is it me or their question genuinely doesn't make sense

static nexus
#

lemme try

loud salmon
#

@earnest phoenix it could go either way honestly

unique nimbus
#

Can we not spoonfeed code also

restive furnace
#

kk

static nexus
#

I mean how do we get one server's invite and post it onto another

loud salmon
#

-xy

#

frick

#

-xyproblem

gilded plankBOT
#

The XY problem is asking about your attempted solution rather than your actual problem. This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

User wants to do X.
User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
User doesn't know how to do Y either.
User asks for help with Y.
Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable solution for X.

unique nimbus
#

So you want you to get the servers invite when someone does the command?

static nexus
#

Yes

loud salmon
#

Also if you are making a food bot, I highly recommend to generate an invite when you order the food. Not when you join the server @static nexus

static nexus
#

you cracked it

#

That's the idea

loud salmon
#

you would need to get the guild object

#

or controller or whatever

#

idk how it works in py

#

but then generate an invite

restive furnace
#

py

#

or idk

#

wait

#

which it is

loud salmon
#

or ask for one to be provided when the command is run

restive furnace
#

im stupid if its js

loud salmon
#

no its py

restive furnace
#

ye its py

patent prism
#

@restive furnace create_event?

restive furnace
#

Idk

#

I am not good at py

#

just in js

patent prism
#

Yeah create_event doesnt exist

static nexus
#

i got the fetch invite

late hill
#

I have a global economy bot (your balance is the same on all servers)
I want to list the top users (highest balance) within 1 specific server
The database links user id's to balance

How to tackle this?
The main issue with all solutions I can think of is that I would need to know all id's of the members in the server which requires fetching all those members..?

earnest phoenix
#

i dont understand where is the issue

spice trail
#

Make a DB

#

store DB

late hill
#

Servers with 100k members for example

spice trail
#

make a dictionary

late hill
#

I don't think I should just fetch all those?

spice trail
#

have the key be the userID

earnest phoenix
#

what about it

spice trail
#

have the dict key be userID and balance be the value

late hill
#

From what I saw on eris docs I can only fetch 1k at a time

#

So that alone would be 100 api calls

#

Unless I'm retarded

earnest phoenix
#

not all 100k members are going to be in your database

late hill
#

Yeh

earnest phoenix
#

and why

spice trail
#

just only start logging the members if they use the bot

late hill
#

ok look

earnest phoenix
#

do you want to mention the member?

late hill
#

take member x

#

I can't know if member x uses the bot without checking their data

#

which means i need the id of member x

spice trail
#

yhh....

#

what about it

late hill
#

so

#

That means I need the id of every member in the server

#

Right?

earnest phoenix
#

what

spice trail
#

no

earnest phoenix
#

just query your database

spice trail
#

only get the ID of user if the bot is mentioned

late hill
#

Just query the database so like

#

You mean go through all entries in there and check if they are in that server?

static nexus
#

Discord.PY is there a way to check if a message's content has a specific item in it like discord.gg? also can you answer this question: How do you get a server's invite and post the invite into another server?

late hill
#

There's nearly 100k users in the database

earnest phoenix
#

why

spice trail
#

@static nexus hes

late hill
#

👀

patent prism
#

Basic in operator

spice trail
#

yes*

static nexus
#

i have reasons

#

how

spice trail
#

its called the in text

static nexus
#

i tried notin

earnest phoenix
#

are you putting every single member despite them not using your bot in the dn

patent prism
#

also create_invite returns an Invite object

late hill
#

No

earnest phoenix
#

db*

static nexus
#

thansk

late hill
#

My bot grows fast

spice trail
#

if you dont know how to use basic python like using in why try make a bot

earnest phoenix
#

also databases are made to withstand heavy queries

#

otherwise people wouldn't move from json ""databases""

static nexus
#

i do

spice trail
#

also whos joining the discord server your bot logs the invite for anyway?

static nexus
#

i got t

#

Its for my food bot

spice trail
#

but why log the invite

static nexus
#

when someone orders the food

earnest phoenix
#

i remember tackling that issue by first downloading all members in the guild, which might be an issue with d.js because the lib is shit @late hill

static nexus
#

so the staff can enter the server and deliver the food

spice trail
#

that is quite dangerous m8 ngl

late hill
#

oh

static nexus
#

well discord pizza discord fastfood and discord donuts(rip) did it

#

so why can't i

loud salmon
#

i never see the value in food order bots but people dont seem to mind so idfk @spice trail

spice trail
#

yh ig

#

idk why u cant just have the bot do it

earnest phoenix
late hill
#

would downloading all members make a big difference resource wise

static nexus
#

That's what I want to do

loud salmon
#

because """reasons"""

earnest phoenix
#

big guild? yes

static nexus
#

I want the bot to get the invite

#

so that the user doesn't

earnest phoenix
#

if you have a good machine and use a good library it won't be a problem though

spice trail
#

so you want the bot, to create an invite

#

send it to your staff

#

so ur staff can join the server?

static nexus
#

yes

#

exactly

earnest phoenix
#

i had a 2.5k guild bot on a 1gb ram vps which withstood downloading all members on huge guilds like DBL, DAPI and Dbots

static nexus
#

@spice trail

spice trail
static nexus
#

your explination explained it

late hill
#

my server is still overkill so it'll probably be fine too

#

unless eris sucks

spice trail
#

that is quite alot of effort for a bot which i take is your first time doing anything d.py related? <-- Sobble

earnest phoenix
#

try it and see 🤷‍♂️

static nexus
#

yes

#

i want my first time to be the best time

spice trail
#

that isnt gonna be a food bot dou xD no offence, find a original idea that ur passionate about which you can do well and within reason

static nexus
#

i'm passionate about racing

spice trail
#

if you want to learn programming use things that will push your knowledge and teacher better programming

static nexus
#

It's not just a food bot tho

#

food bot is an aspect

#

its a multiple aspect bot

spice trail
#

keep the bot simple at start though

static nexus
#

Food,Moderation,Fun .

spice trail
#

how many large bots do you know that do a little bit of everything?

static nexus
#

None

#

that's the idea

#

wait no i do

earnest phoenix
#

monolithic design is bad

#

avoid packing everything into one

spice trail
#

exactly thats cuz its ALOT of work not only to make it useful and workable

static nexus
#

I just want my meth(od)

earnest phoenix
#

communism is a great example how monolithic design never works

spice trail
#

do one thing well instead of serveral bad

static nexus
#

FFS,just give me my help

#

it only does 3 things

#

moderation, fun and food

loud salmon
#

@earnest phoenix oops my bot is monolithic zoomeyes

spice trail
#

oopa

earnest phoenix
#

ree

spice trail
#

okay sobble what is your issue then?

static nexus
#

i just want a way to get, when the command is run, a server invite to be sent to another server

supple saffron
#

when will my bot be approved?

loud salmon
#

like we told you before. use your discordpy docs to generate an invite, then send that invite to a specific channel

#

-checkmybot @supple saffron

gilded plankBOT
#

@supple saffron

Bots added to the site are ordered by a queue based on the time they submitted their bot. Website Moderators check bots according to the queue and cannot check your bot just because you requested it. In addition, queue length is confidential and we cannot tell you your position in queue, either.

As the FAQ: How long is Approval? states, your bot may take up to a week or more until it is checked. There is no set time how long bot approval will take; there is a queue and you're not the first nor are you the last.

Please be patient.

supple saffron
#

thx

spice trail
chrome verge
#

How to get votes?

static nexus
#

i just don't know the exact bit. is it guild_invite?

earnest phoenix
#

cry

chrome verge
#

I mean api request votes

earnest phoenix
#

hard

static nexus
#

that's the only question i have

earnest phoenix
#

oh

patent prism
spice trail
chrome verge
#

Ok ty

spice trail
#

well @static nexus its a class

#

now

static nexus
#

so do we do this

spice trail
#

how do we specifiy what parts of classes we use

static nexus
#
          guild_invite
#

i'm beginner but i want my first bot to be impactful

spice trail
#

no

#

right

#

so i have a class yh

static nexus
#

yes

spice trail
#

lets call it MyClass

patent prism
#

If you dont know basic python, you really shouldnt make a bot

static nexus
#

I do

#

just forgot a bit

spice trail
#

class MyClass():
    my stuff here```
static nexus
#

oh yeah

spice trail
#

now

static nexus
#

so

spice trail
#

how would we specify to the program to look in that class

#

and to get a specific part

static nexus
#
MyClass(specific part):
spice trail
#

no

#

thats a subrutine

#

thats saying

#

this subrutine

#

passes stuff

#

think of it like a file path yh

static nexus
#

oooh

spice trail
#

MyClass/Mysubrutine/stuff

#

how would you do that in python

#

hint its not /

static nexus
#

def function():
MyClass
return(mysubroutine, stuff)

patent prism
#

what the hell is this

spice trail
#

no

#

teaching basic python

loud salmon
#

@patent prism pls be nice smh

spice trail
patent prism
#

Ight

#

Sorry

loud salmon
#

read the etiquette rules ;n; in the pins

spice trail
#

notice anything about this in the docs?

static nexus
#

IK NOW

patent prism
#

Too used to dpy help

loud salmon
#

sobble easy on the caps please

static nexus
#

guild.fetch_invite()

patent prism
#

We just turn people away instantly if they dont know basic stuff

loud salmon
#

thats understandable

spice trail
#

there we go

static nexus
#

🙂

spice trail
#

when you specify stuff in python

#

u use .

#

like you would /

#

for directories

static nexus
#

also was my guild.fetch_invite() thing correct

spice trail
#

possibly

#

youre along the right lines

#

its just testing now to see what it returns when you call it

static nexus
#

yeah

#

im using test server

#

ok guild not defined

#

how do we fetch invites again

spice trail
#

u actually told it what guild is?

unique nimbus
#

oop

static nexus
#

an i oop

spice trail
#

qui

static nexus
#

SWEET GOD I DID IT

#

JUST BY DEFINING A FUNCTION

spice trail
#

caps

#

and hmm?

static nexus
#

I have a right

#

it's surpise

spice trail
#

u huh

static nexus
#

I just need to find how to make the invite into an actual invite

#

it's just showing<function invite at 0x000002719CD3EE18>

spice trail
static nexus
#

but

#

can i have the bit of code i was supposed to put in there

#

also channel is a defined channel

loud salmon
#

@static nexus Yo! This is your last warning about excessive caps.

#

Please don't abuse it anymore or there will be consequences

static nexus
#

yes sir

#

It keeps on saying function invite, even after I use create_invit

spice trail
#

bruh

#

i legit sent u a ss of the docs

#

did you not read it

#

there is a VERY clear part of it that says the corutine of invite()

heavy marsh
mossy vine
#

you cant

heavy marsh
#

U can i have seen some bots like that

spice trail
#

no its just the profile pic

mossy vine
#

no its not lol

spice trail
#

shhh

#

some bots use the PP with the phone

#

gets most people

static nexus
#

i added .url

#

still being dumb

#
import discord
import asyncio
from discord.ext import commands
client = discord.Client()
channel = client.get_channel(645259977304571935)
bot = commands.Bot(command_prefix='sb')
async def invite():
        invite = create_invite.url(reason=None)


    if message.content.startswith('sborder'):
        channel = client.get_channel(645259977304571935)
        embed = discord.Embed(title="New Order!", description=message.content, color=0x00ff00)
        embed.add_field(name="Order Maker", value=message.author, inline=False)
        embed.add_field(name="Invite", value=invite, inline=False)
        await channel.send(embed=embed)```
#

this is not full code

earnest phoenix
#

discord doesn't do any checks for setting presence type

static nexus
#

just a part of it

earnest phoenix
#

so yes bots can have mobile indicators

heavy marsh
#

^^^

mossy vine
#

huh

heavy marsh
#

But how?

mossy vine
#

so it exists but is completely undocumented

earnest phoenix
#

your lib probably doesn't support setting it though

heavy marsh
#

Discord.js

mossy vine
#

yea d.js doesnt

earnest phoenix
#

its a presence update like any other

mossy vine
#

just looked through the docs

spice trail
#

have you tried putting the Url within the subrutine

heavy marsh
static nexus
#

it's not a specific url

#

i want the url of the server the command is used in to be generated

spice trail
#
# Invite management

    def create_invite(self, channel_id, **options):
        r = Route('POST', '/channels/{channel_id}/invites', channel_id=channel_id)
        payload = {
            'max_age': options.get('max_age', 0),
            'max_uses': options.get('max_uses', 0),
            'temporary': options.get('temporary', False),
            'unique': options.get('unique', True)
        }

        return self.request(r, json=payload)```
static nexus
#

okay

spice trail
#

just gonna leave the code from the discord module here

#
def get_invite(self, invite_id):
        return self.request(Route('GET', '/invite/{invite_id}', invite_id=invite_id))

    def invites_from(self, guild_id):
        return self.request(Route('GET', '/guilds/{guild_id}/invites', guild_id=guild_id))

    def invites_from_channel(self, channel_id):
        return self.request(Route('GET', '/channels/{channel_id}/invites', channel_id=channel_id))

    def accept_invite(self, invite_id):
        return self.request(Route('POST', '/invite/{invite_id}', invite_id=invite_id))

    def delete_invite(self, invite_id):
        return self.request(Route('DELETE', '/invite/{invite_id}', invite_id=invite_id))```
static nexus
#

should it be a function or just a line of code

spice trail
#

rest of the other subrutines

static nexus
#

Should it be a function or line of code

spice trail
#

well im not saying copy the code

static nexus
#

i know

spice trail
#

im saying

#

look at the code

#

so you know

static nexus
#

just answer my bloody question

spice trail
#

doing Class.XYZ() specifies the subroutine or class to use

#

also

#

im not gonna spoon feed you

static nexus
#

it's not spoon feeding

#

it

spice trail
#

you want to learn how to make a bot you gotta know how class, subrtuines and docs work

#

right sobble

#

gonna give u another hint, have you told it where to send the linK?

static nexus
#

yes

#

to a channel called orders

#

in a server called sobble cafe

spice trail
#

show me the code

static nexus
spice trail
#

invite = create_invite

#

you havent told it:

#

where to link to

#

how many times it can be used

#

any other options

#

etc..

#

create_invite(self, channel_id, **options)

#

its a subroutine, you gotta pass stuff into it mate

#

create_invite(self, channel_id, **options)

static nexus
#

every time i do

#

it says create_invite not defined

spice trail
#

what is before the invite part

#

your not just calling in a subrutine remember

#

its a coroutine within a class

#

so what we gotta do to tell it where to look?

static nexus
#

discord.Invite.create_invite

#

or invite.create_invite

spice trail
#

2nd option

#

but remember

#

subrutine

#

what you gotta do

static nexus
#

thanks @spice trail thanks @spice trail

spice trail
#

bruh

#

im trying to teach you the basics of python here

static nexus
#

i did it

#

my dumb ass just caused a name overlap

#

now let's try

#
        server = invite.create_invite(self, channel_id, **options)
        channel = client.get_channel(645259977304571935)
        embed = discord.Embed(title="New Order!", description=message.content, color=0x00ff00)
        embed.add_field(name="Order Maker", value=message.author, inline=False)
        embed.add_field(name="Invite", value=server, inline=False)
        await channel.send(embed=embed)```
#

it is all correct

#

but

#
NameError: name 'invite' is not defined```
spice trail
#

you dont need self or options

#

just btw

static nexus
#

ik

#

i just felt like it

spice trail
#

self means include it within its self

#

and **options will crash it

static nexus
#

wait name error is fixable

#

brb

spice trail
#

also u missed the point of the whole discord.create_invite

#

or maybe client.create_invite

static nexus
#

oh it's discord.create_invite

spice trail
#

nu cuz u have changed what discord is

#

whats the first thing u specify

static nexus
#

invite.discord.create_invite

spice trail
#

hint: bot = commands.Bot(command_prefix='sb')

static nexus
#

oh

spice trail
#

hint 2: client = discord.Client()

static nexus
#

@bot.command

spice trail
#

why do you have bot and client as a thing

#

just as a side not

#

note*

static nexus
#

because there are moderation commands too

wooden lance
#

I'm running node and am using guild.id in client.on("guildMemberAdd", async (member, guild) => { but id is returning as undefined. Any ideas?

spice trail
#

they both can do the same thing just fyi sobble

#

and use client

#

cuz youve said client is the main class for discord.py yh?

static nexus
#

yes

spice trail
#

so client.create_invite(Parse parameters)

static nexus
#

i would pay u if i had money

spice trail
#

@wooden lance has it got a guild? might need to see more code

#

and dw about it sobble

#

we will teach you slowly

static nexus
#
AttributeError: 'Client' object has no attribute 'create_invite'```
late hill
#

What library @wooden lance

summer torrent
#

@wooden lance try member.guild.id in your code

late hill
#

^^

#

discord.js doesn't have a guild param

#

in guildMemberAdd

summer torrent
#

yes

wooden lance
#

o

spice trail
#

InviteLink = await client.create_invite(Maybe a channel id and options go here)

static nexus
#

wait imma try discord.create

wooden lance
#

I'm gonna try that

summer torrent
spice trail
#

and yes

#

discord might actually be right tbh

late hill
#

Also means you interpreted the error wrong

#

as it should be guild that's undefined

spice trail
#

he says reading the docs again

static nexus
#

im using pycharm and it says only discord. exists

spice trail
#

thats cuz its the main class for the module

#

whats the code u got rn?

#

for the invite?

static nexus
#

so imma do discord.invite.create_invite

spice trail
#

NO

#

no .invite.

#

not needed

#

thats saying

#

using the class discord

#

look in the subroutine invite

#

do the subrutine create_invite

static nexus
#
        server = await discord.client..create_invite(self, channel_id, **options)
        channel = discord.get_channel(645259977304571935)
        embed = discord.Embed(title="New Order!", description=message.content, color=0x00ff00)
        embed.add_field(name="Order Maker", value=message.author, inline=False)
        embed.add_field(name="Invite", value=server, inline=False)
        await channel.send(embed=embed)```
#

that's my code

wooden lance
#

Now I just need to wait for someone to join a server.

spice trail
#

right sobble

#

remove the following

#

the double ..

wooden lance
#

^

spice trail
#

,client.

static nexus
#

done

spice trail
#

the self part

#

the channel id part

static nexus
#

done

spice trail
#

the options part

#

cuz it does nothing

#

cuz u not told it anything valif

#

valid*

static nexus
#

done

spice trail
#

Channel ID legit means give it the ID

static nexus
#

oh

spice trail
#

so give it a Var which has a valid Guild ID

#

btw

#

GuildID*

static nexus
#

ok

#

is that all to remove

wooden lance
#

Aye it worked. Thank you!

spice trail
#

InviteLink = await client.create_invite(destination = <GuildID>, xkcd = True)

#

try somthing like that

#

but u gotta give it the ID

static nexus
#

does channel id work too

#

cos it's sending to a specific channel

spice trail
#

now that might involve using the .get_guild() function

#

no

#

well actually yes

#

channel = client.get_channel(645259977304571935)

static nexus
#

well no,but actually yes

spice trail
#

i read the message wrong

#

the channelID and telling it to send the message to the selected channel is fine

static nexus
#

so in theory it should work once i've fixed all that

spice trail
#

maybe

#

wont know till you try

static nexus
#
AttributeError: module 'discord' has no attribute 'create_invite'```
spice trail
#

no

#

do client

#

instead of discord

#

also

#

not channel

#

channel bad

#

u need the guildID

#

channel is just for sending the embed

static nexus
#

when do client

#

when i do client

#

it gives same error

spice trail
#

re try it

#

just change discord to client

static nexus
#

annnd

#

it has no attribute called create_invite

#

maybe i should change the create_invite to another knd

spice trail
#

try put it in a subrutine called invite

static nexus
#

ok

spice trail
#

async def invite(GuildID)

#

it might be cuz it wants it in invite subrutine

static nexus
#

wait guild id of the guild the invites from or my guild

spice trail
#

for the server guild

#

for the server u want to join

static nexus
#

so im gonna have to do get.guildid()

spice trail
#

give me one min cuz i gotta test it on my test bot

tired nimbus
#

anyone know how exactly to play a mp3 file?

spice trail
#

no use me helping u if i dont have an example piece to double check

tired nimbus
#

post your server?

static nexus
#

@spice trail i did it

#

thanks for helping me so much

spice trail
#

did it work

static nexus
#

im trying now

#

fetch_invite works

spice trail
#

hmmm

earnest phoenix
#

how do i get Rbxodia V2

static nexus
#

so hmm

earnest phoenix
#

hot do i get Rbxodia V2

spice trail
#

idk

loud salmon
#

-wrongserver @earnest phoenix

gilded plankBOT
#

@earnest phoenix

This server is NOT the support server for ANY bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of DBL.

static nexus
#

do mod applications exist or something

quartz kindle
#

every now and then they open them

static nexus
#

oh cool

loud salmon
#

@static nexus to be a mod on this server you have to be active, mature, helpful, and preferably 18 years old or older

mossy vine
#

@loud salmon arent most mods under 18

loud salmon
#

@mossy vine like maybe 3 of them are under 18

mossy vine
#

huh

earnest phoenix
#

Anyone know if you can make qsort start from a specific index? or specifically ignore index 0

quartz kindle
#

remove it from the array/selection?

frozen cedar
loud salmon
#

-auctions @frozen cedar

gilded plankBOT
digital sparrow
#

How to block if bot cant send message it will make bot crash discord.js

sudden geyser
#

Check the channel permissions for your bot (ex: <Channel>.permissionsFor) and see if it has send messages. If it doesn't, do nothing

tacit stag
#

is there a way to have an embed detect if a reaction is clicked forever (i know you can do it on a timeout, but i dont want it to be on a time out)

#

once i get this working, my bot should be pretty much done

blissful scaffold
#

I don't know what library you use, with my Java lib I can listen for reaction events and then check if the reaction is done to a message that the bot follows

valid frigate
#

probably not for long since your cache would have to be massive

#

also hes not using java

blissful scaffold
#

you dont need to cache messages to receive reaction events

tacit stag
#

djs

blissful scaffold
#
Discord.js v11 does not have the ability to emit events if the respective structures it needs to emit with are incomplete and does not auto-fetch the missing information. This behaviour has been changed in version 12 of the library. It introduces partial structures which enable us to emit incomplete structures and complete them with a single fetch call. This feature is not available on version 11.x if you want to listen for reactions on old messages please use version 12 of the library

https://discordjs.guide/popular-topics/reactions.html#listening-for-reactions-on-old-messages

#

looks like it isnt possible with discord.js v11

tacit stag
#

oof. okay

blissful scaffold
#

if you really need it then you can switch to v12, but i think that version isn't stable yet

valid frigate
#

wdym v12 is epice

blissful scaffold
#

I just go from what the discord.js documentation says
Personally I have never used it and I dont know much about JS in general

#

the documentation says v11.5 is stable and v12 is master

unreal oxide
#

For some reason the website link for one of my bots links to a top.gg 404 page

#

In the editor its fine

#

Public it's borked

#

not sure why this is the case

wooden lance
#

Does anyone know how to fetch a user's highest role? (js)

west raptor
#

Member#highestRole I believe?

#

Lemme check

#

@wooden lance

wooden lance
#

Thanks! I keep on getting lost in the docs. They are too large.

west raptor
#

There is the search feature

blissful scaffold
#

@unreal oxide Other people can only see your bot on top.gg after it is approved

wooden lance
#

waiiit...wot

west raptor
#

@blissful scaffold it's approved

unreal oxide
#

wait it was approved ages ago

tired nimbus
wooden lance
#

oh, there is

#

lol

blissful scaffold
#

ah wait, i hadnt tried the link, it works 😄

west raptor
#

I'll login in a few and double check @unreal oxide

unreal oxide
#

Started getting reports about the website link not working and im not sure why

wooden lance
#

thats gonna make my life easier

unreal oxide
#

@west raptor thanks

blissful scaffold
#

Edit the bot page and check if the website url starts with http(s)://

west raptor
#

oh!

#

you have https:/

#

not https://

#

@unreal oxide

unreal oxide
#

ohhh

west raptor
#

i change it for you

#

if you want

unreal oxide
#

Sure that would be appreciated

#

Not sure how that happened

west raptor
#

it should redirect fine now

unreal oxide
#

Thanks Dream

west raptor
#

np

blissful scaffold
#

now the site works

earnest phoenix
#
const songInfo = await ytdl.getInfo(`${url}`);
    const song = {
        title: songInfo.title,
        url: songInfo.video_url,
    author: songInfo.author
    };
  console.log(songInfo)
    var connection = await voiceChannel.join();
const dispatcher = connection.playStream(ytdl(song.url))
  message.channel.send(new Discord.RichEmbed()
                      .setTitle("Now Playing")
                      .setDescription(`${song.title}\n By: ${song.author}`)
                      .setColor(client.embedcolor)
                      )
}```
west raptor
#

What's the result of song.author when printed

earnest phoenix
#

[object Object]

blissful scaffold
#

what is in the object?

west raptor
#

printed to the console

earnest phoenix
#

yeah

#

im trynna find

#

its long

blissful scaffold
#

My guess would be it's something like song.author.name but to be sure you have to print it to the console

earnest phoenix
#

works ty

blissful scaffold
#

you just used my guess without checking? xD

earnest phoenix
#

i did check but its long

#

i cant explain but yeah kinda

wooden lance
#

I'm having issues with this bit of code:

  let authorRole = message.member.highestRole;
  let targetRole = bUser.highestRole;

  let roleprotection = new Discord.RichEmbed()
  .setTitle(`Role protection`)
  .setColor(`#ff1900`)
  .setDescription(`That user has a higher role or the same role as you so I can't let you do that.`)
  .setFooter(`Replying to ${message.author.tag}`);
  if(authorRole.position < targetRole.position) return message.channel.send(roleprotection); //Line 75 by the way.
  if(authorRole.id === targetRole.id) return message.channel.send(roleprotection);

...and I'm getting this error:

(node:2429) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'position' of undefined
    at finish (/root/DiscordBotApp/commands/ban.js:75:39)
    at Object.module.exports.run (/root/DiscordBotApp/commands/ban.js:35:7)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2429) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2429) [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.

Any ideas? (JS)

#

holy shit that's long

vital lark
#

@wooden lance maybe targetRole is undefined

wooden lance
#

hmmm, bUser.member.highestRole or am I just being dumb?

#

i really need to sleep lol

west raptor
#

Is it a user or a guild member

wooden lance
#

a guild member

west raptor
#

Oh

#

Hmm

#

In your code it's just bUser.highestRole

wooden lance
#

but I use let bUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); to get bUser

west raptor
#

then bUser is undefined?

wooden lance
#

shouldn't be

west raptor
#

proper way to do it is message.guild.member(/*first check*/) || message.guild.member(/* second check*/)

#

Does Guild#member even exist

vital lark
#

it doesn't

#

only thing related to that is Guild#members

wooden lance
#

it worked before I changed some stuff

west raptor
#

Actually

#

It does

#

Just looked

#

Guessing it's new

wooden lance
#

okay, bUser.member doesn't work. I don't know why I thought it would.

west raptor
#

This is why I hate Javascript

#

Needs typings

valid frigate
#

typescript also exists

west raptor
#

I'm aware

wooden lance
#

i don't know why i learnt javascript

valid frigate
#

if you were about to say that

vital lark
#

types in JavaScript

valid frigate
#

pog championship

vital lark
#

bro, only thing that does that is flow made by Facebook

wooden lance
#

o finish(client, message, args, bReason, bUser); on async function finish(client, message, args, bUser, bReason){ aaaaaaaaa

#

i hate javascript

west raptor
#

Don't we all hate Javascript

wooden lance
#

i wish i learnt python first

west raptor
#

That's why we grow up and use rust /s

wooden lance
#

or anything

#

literally anything

unreal cliff
#

you know how when you link a yt video it has like that embed

#

how would i go about making one of those for my site

west raptor
#

meta tags

unreal cliff
#

Which ones?

west raptor
wooden lance
#

//ping

#

aaaaaaa wrong guild

unreal cliff
#

Thanks

#

The most i could do that worked was this:

earnest phoenix
#

UnhandledPromiseRejectionWarning: #<Object>

#

it was working a while ago

copper cradle
#

that's not the error

#

smh

restive furnace
#

it is

#

Its Unhandled error

wheat jolt
#

He didn't said it's an error

earnest phoenix
#

hoi noob danish here again

client.getScore = client.sql.prepare("SELECT * FROM scores WHERE user = ? AND guild = ?");
client.setScore = client.sql.prepare("INSERT OR REPLACE INTO scores (id, user, guild, points, level) VALUES (@id, @user, @guild, @points, @level);");```

How do I make both of these statement accesible to all others files?
torpid river
#

Can someone help me? Every time I type something my bot responds :(