#development

1 messages · Page 510 of 1

earnest phoenix
slender thistle
#

Blame Discord for this

#

Also probably because you need to await it, no?

earnest phoenix
#

I don’t know why you would need to

#

If I did it would complain it needs to be async

#

And idk how to put that into an eval operation

topaz fjord
#

just put it in a function thats async and call that function

#

so like

await shit
}

ejhsgbhuj()
quartz kindle
#

i mean... does bulkDelete even return anything?

#

or does it need a callback/promise?

topaz fjord
#

a promise

#

it returns a collection the messages deleted

slender thistle
#

Welp, here are the js fellas

quartz kindle
#

then even if you async/await it, it will still show as [object map]

topaz fjord
#

yes

quartz kindle
#

he needs to actually return something usable

earnest phoenix
#

I don’t understand object maps

sonic glade
#

Can anyone help me ?

quartz kindle
#

@sonic glade you need to specify which channel

#

the channel is not being found

#

guildMemberAdd does not give you a "message" to work with

topaz fjord
#

message isnt valid in guildMemberAdd

earnest phoenix
#

also sending the message every time a user joins the server

sonic glade
#

Yes, but I need you to send the message with the image in the channel that the user is watching

bright spear
#

thats not possible

quartz kindle
#

@earnest phoenix objects and maps are mostly the same thing, just with different capabilities. but you need to give discord a string

bright spear
#

you cant know what channel they're looking at

topaz fjord
#

you can filter throughout the channels to find one you can speak in and send one

bright spear
#

^ but pls dont do that

topaz fjord
#

^

sonic glade
#

or in some channel, but that is when someone enters the discord server

earnest phoenix
#

yes

#

for all discord servers

bright spear
#

make welcome messages off by default and let server admins set a welcome channel if they want @sonic glade

earnest phoenix
#

^

quartz kindle
#

you need to specify a channel, so let the guild owner chose which channel they want to receive those types of messages

sonic glade
#

ok

#

thanks

earnest phoenix
#

Why when I do result.size/length does it always say undefined even when I define it?

bright spear
#

what if you console.log(result)

earnest phoenix
#

I use pm2

#

Nothing logs

#

Not even startup messages

#

just use length

#

do not try size

#

It says undefined

#

On both

#

unrelated question

#

?

#

why do you have an unused variable called length

#

I was trying to define it

#

But it didn’t work

#

define what

#

length

#

i mean

#

all you would need to do is result.length

#

yes

#

result is none existant

#

what is you code for args

#

How do I fix it

#

didn't answer my question

#

let args = msg.content.split(' ').slice(2)

#

@earnest phoenix

#

hmm

#

It’s 2 because of the space in the prefix

#

So Alexa eval

#

slicing arrays uwu

#

well

#

try removing the await from the eval

#

no

#

its not that

#

yes

#

just check if its undefined

#

if it is, send undefined instead of checking length

#

await eval is not the problem

#

oh wait

#

Having fun showing the same thing?

#

thank you tom

#

👍

#

now i feel stupid

#

you don’t need eval

#

It’s an eval command

#

eval command

#

this guy read a comment on stackoverflow saying "never use eval" from some grumpy old cunt

#

and took it too literally joyemote

#

eval commands makes you look even cooler when you release your bot token

#

.replacing bot token awesmart

#

replacing multiple substrings too awesmart ^ awesmart

shadow barn
#

.setTitle

topaz fjord
#

if (output instanceof Promise || (Boolean(output) && typeof output.then === 'function' && typeof output.catch === 'function')) output = await output; amazing

earnest phoenix
#

What

#

wait

#

How can I check if something is a number?

#

typeof

topaz fjord
#

you can use typeof

earnest phoenix
#

type of what

#

google js typeof

#

🎉

#

I crashed my browser looking for it

topaz fjord
earnest phoenix
#

if(args typeof 'number')

#

?

topaz fjord
#

typeof args returns a value

earnest phoenix
#

typeof args === 'number'

topaz fjord
#

yes

earnest phoenix
#

How do I put that in a command just put it under

#

The args

#

Bit

topaz fjord
#

wut

earnest phoenix
#

Idk

#

Where is defined args

#

Idk

topaz fjord
#

why are you asking me, its you code you should know where args is defined

earnest phoenix
#

Ik

#

But do I just put that under

#

Or would it not work

topaz fjord
#

under what

#

you need to be more specific

earnest phoenix
#

Can I do

let args = thing here
typeof args === 'number'```
Or 
```js
let args = thing here
if(args === typeof 'number' return *must be num message*```
#

I don’t understand how it works

topaz fjord
#

if(typeof args === 'number') return *must be num message*

earnest phoenix
#

I was on that

quartz kindle
#

typeof (typeof 1) lmao

topaz fjord
#

mdn is pretty informative

#

they even give examples

#

@quartz kindle it makes sense

#

¯_(ツ)_/¯

earnest phoenix
#

if(typeof args === 'number') return msg.channel.send("Hm... the 2nd value you gave is invalid... Problem:\nmust be a number")

quartz kindle
#

yeah but why would anyone ever need that

topaz fjord
#

example purposes

earnest phoenix
#

It doesn’t work

#

Oof

#

because you "args" is an array

#

pls ignore my message above as of natan is smarter than me

inner jewel
#

what

#

i suggest you learn js

earnest phoenix
#

yes i do

#

but

inner jewel
#

i'm pretty sure your args is a string array

#

coming from splitting the content

#

which means typeof args[N] for any N will be either string or undefined

lost scarab
#

anyone knows how to make coin and shop system?

earnest phoenix
#

maybe

#

why you ask

#

@lost scarab We're not going to tell you how to make a complete system, but we can give your resources to do so.

#

You'll need a database, for sure

lost scarab
#

i mean i tried to make one with an yt video

#

but it didnt work

earnest phoenix
#

this is not a development question

#

its a problem solving question

#

and u figure it out on ur own

earnest phoenix
#
var ttttturl = "";
fetch(url)
.then(res => res.json())
.then(json => {
    var z = 0;
        while (json.items[z].id.videoId == null) { z++; }
   ttttturl += trueurl.concat(json.items[z].id.videoId) //"https://www.youtube.com/watch?v="
})

i know this seems like a pretty basic question but why is this not concentrating to the string?

#

is it because its in a function

#

or is it because im an idiot

inner jewel
#

promises are async

#

it is concatenating

#

but code below that will have already executed when concatenation happens

earnest phoenix
#

oh

#

no wonder why

#

do i async it?

#

or

#

You put your code inside of the callback

#

the promise is already asynchronous.

#

wait

#

you mean the .then(json => {})?

#

wait nvm

#

you did mean that

#

thanks

earnest phoenix
#

i need opinions on a database for saving things to a queuek thx

#

Can someone please send a script in here that can turn on a bot please?

#
<script>
console.log('Bot is On!')
</script>```
knotty steeple
#

turn --on bot

earnest phoenix
#

But wouldn't you need the token?

mossy vine
#

What language are you using?

earnest phoenix
#

Python

#

--token TOKEN

#

(Don't mind these, these are memes)

mossy vine
#

Cant help theb

#

Theb*

#

Fhen*

#

T H E N

earnest phoenix
#

Who knows python?

#

If you simple come here asking for a complete script, don't expect to get anything other than memes

#

I'm only asking for a bot online script I have the other stuff.

#

"If you simple come here asking for a complete script, don't expect to get anything other than memes"

#

You didn't provide any details at all..

#

Ok

#

So

#

I am making a Music Bot and I keep running into errors if I can't get it online in Python language and I keep running into errors on making it go online can someone please help?

#

You need to provide details.

#

I'm not a mind reader.

#
import discord

TOKEN = 'XXXXXXXXXX'

client = discord.Client()

@client.event
async def on_message(message):
    # we do not want the bot to reply to itself
    if message.author == client.user:
        return

    if message.content.startswith('!hello'):
        msg = 'Hello {0.author.mention}'.format(message)
        await client.send_message(message.channel, msg)

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

client.run(TOKEN)```
#

You may want to provide the errros youre getting.

#

Here

#

Well that explains a lot: import aiohttp

#

also are you trying to code on your pone @earnest phoenix

#

Yeah.

#

It's so hard.

#

yeah

#

But I'm not giving up.

#

bbecause your coding on phone

#

why don't you code on a laptop

#

No internet

#

what

mossy vine
#

I dont know much about Python, but just importing the aiohttp module should work

earnest phoenix
#

I use Data

#

Mobile data lol

#

doesn't your data have a mobile hotspot

#

It so damn laggy

#

i mean

#

you could use the mobile hotspot to download a text editor like vsc and code from there

#

Coding on your phone is one of the biggest developer memes.

#

yes

#

I still like to try.

#

ok

#

I will not give up.

#

If you try, you are a meme

#

...

#

So your saying people who try making a bot are a meme

#

.

#

is it enmap good database for making a queue system

#

Who try making a bot on their phone

#

Many people

#

how many

#

I watched it on YT.

#

thats gross

#

don't even get me started on the people who run their bots on their phone

#

but still

#

Now that's even more of a meme

knotty steeple
#

you dont import aiohttp

#

you install it

native folio
#

.

#

how do i make a ping command with ms

topaz fjord
#

what lib

native folio
#

python

topaz fjord
#

each lib should have a thing that gets ping

native folio
#

python async 3.6.5

#

im trying this

#
@client.command()
async def ping(ctx):
        ': Check your connection '
        t1 = ctx.message.created_at
        m = await ctx.send('**Pong!**')
        time = (m.created_at - t1).total_seconds() * 1000
        await m.edit(content='**Pong! Took: {}ms**'.format(int(time)))
        await ctx.message.delete()```
#

but then im getting this error

#
Ignoring exception in command ping
Traceback (most recent call last):
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 367, in invoke
    yield from self.prepare(ctx)
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 345, in prepare
    yield from self._parse_arguments(ctx)
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 304, in _parse_arguments
    transformed = yield from self.transform(ctx, param)
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 212, in transform
    raise MissingRequiredArgument('{0.name} is a required argument that is missing.'.format(param))
discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing.```
dim owl
#

Hello Developers. I got lil question. Is it possible to create Discord BOT, wchich will be able to reading, gathering and processing information of this website https://proclubshead.com/ ?
for ex. This https://proclubshead.com/19/club/pc-13982/ for whole team, and this https://proclubshead.com/19/club/pc-13982/player/6iJBOqa1-MGbOg1mQHua3g!!:51uin9bSSzfoXMzrY9EaQg!!/ as an ex. for each player of a team. cheers

#

Its all about FIFA19 official Esport Virtual Pro Teams

quartz kindle
#

thats called "scraping" a website

#

and yes, its possible

topaz fjord
#

I think cheerio is a good one for scraping

dim owl
#

who?

#

Will be here any nice person who would help us with it and make first beta please?

#

pm me

quartz kindle
#

if there is money involved, sure

pale marsh
#

Do bots get access to a user's connections?

sick cloud
#

@pale marsh only oauth2 does

pale marsh
#

Gotcha

sick cloud
#

you need the connections scope iirc also

pale marsh
#

Docs confused me a bit

#

However I remember a bot once that used your steam connection to get stats to a game before Thonk

#

It was the bot on the payday 2 server

sick cloud
#

probably had oauth2 implemented

#

theres no way you can get connections other than that or unreliable external websites

pale marsh
#

I don't think so honestly. It never asked me for oauth or anything

sick cloud
#

weird

keen drift
#

Ay, anyone here has a bot in golang Thonkang

keen drift
#

@sick cloud Looks like you'll have to wait a little longer for dashboard

#

I'm planning to ship it with the rewrite (v2)

sick cloud
#

oof ok, waiting fun. also happy birthday

keen drift
#

thanks

#

I hope v2 is going to be mostly backward compatible

earnest phoenix
#

Making bots with phones is the best way to idk why you’re questioning making bots on mobile I mean the spelling mistakes your auto correct gives you is always the best when making a command that would break your bot if you messed it up

#

@earnest phoenix

#

I only edited that message 5 times

earnest phoenix
#

How can I fix my bot every like 30 minutes on the same VPS my bot errors and says Error: Socket something like disconnected how can I add an auto restart thing because even if I use PM2 it still crashes and I want to be able to certify my bot >:c

raven torrent
#

Try another free VPS to test if it's the VPS or the bot

#

If it makes that message again it means it's the bot the issue

#

It not, you have to talk to the VPS customer service

#

@earnest phoenix

earnest phoenix
#

@earnest phoenix are you memeing?

#

Auto correct vs. an actual JavaScript linter on a desktop

#

Yeah come back and tell me which one is better

topaz fjord
#

@keen drift yagpdb is in golang

#

I'm thinking of rewriting as well

#

I'm in the middle of rewriting but I can't figure out how to make a command handler

junior bobcat
#

nodejs
What must I do to my bot msg.react("1⃣") ?

#

I dont find how to copy the 1⃣ emoji, or find its id

late hill
#

uhhh

#

itsss

#

you need the unicode

#

1\u20e3

#

msg.react("1\u20e3")

#

should do

spring wharf
#

does anyone know how I can create a pingable role in Discord.NET using c#?

#

btw ping me in the response just in case more people talk here before I come back from school since I am leaving right now

junior bobcat
#

@late hill 👌

late hill
#

yes

#
{embed: { fields: [
{name: "name1", value: "value1", inline: true},
{name: "name2", value: "value2", inline: true},
{name: "name3", value: "value3", inline: false},
{name: "name4", value: "value4", inline: true}
]}}```
#

does this

#

Setting them all to true does this

#

🤷

#

😩 😩

wheat marten
#

Is it against tos for a bot to send an invite to a server that is not owned by the bot owner?

spring wharf
#

I have a similar question which is in relation to ToS aswell

#

I am making a bot that will handle announcements by making an announcement role so people can opt in or out of announcements, it also DMs said people who opt in. Of course I wrote for the opt in command that by doing so they agree to DM announcements but I still wonder if it would be against ToS

amber junco
#

I have an issue

#

My change able prefix isnt working

#

it says in command prompt that I spelt JSON Worng and I typed JASON

spring wharf
#

Lmfao

amber junco
#

whats funny?

slender thistle
#

Uhm

#

The error is self-explanatory, though ThinkCorn

jolly rampart
#

i hve ask can i?

#

I want to use Python to make my mp3 player run.

#

i can make mp3 file but i can't play it

slender thistle
#

youtube-dl, ffmpeg, or lavalink

jolly rampart
#

i know ffmpeg

#

but why use the youtube-dl?

#

just use it?

slender thistle
#

Feel free to use either

jolly rampart
#

okok thx

amber junco
#

Shivaco WDYM?

slender thistle
#

Baka

#

Are you requireing json under JASON variable

raven torrent
#

@jolly rampart maybe add you bot here

#

to test it

jolly rampart
#

i can test my bot

#

in my server

#

thx

amber junco
#

Yes shivaco

warm marsh
#

@late hill you get your embed fixed?

late hill
#

Yeh

warm marsh
#

Ah ok

late hill
#

I put in a thumbnail

#

Which makes it so only 2 fields fit

#

per line

warm marsh
#

Ah ok

#

You could of just done JavaScript embed: {fields: [{ Name:"",value:"",inline;false },{ Name:"",value:"",inline;true }{ Name:"",value:"",inline;false }{ Name:"",value:"",inline;true }]}

earnest phoenix
#

lower case n for name

lavish sundial
#

Do I need normal OAuth2 rather than Bot OAuth to POST text Meassages?
I can't see this in doc ,any link or answer is appreciated,thx.

#

btw,I 'm sure I granted SEND_MESSAGE Permission already.

late hill
#

That just puts them under eachother..

earnest phoenix
#

if you want them side by side make them all inline.. facepunch

late hill
#

yeh that's what i did

#

But with a thumbnail

#

Because I wanted 2 each line

#

It goes up to 3

#

If theres no thumbnail

#

Facepalming about something thats already taken care of 🤦

ruby dust
#

Use a transparent image

earnest phoenix
#

bo

#

use a 3rd inline

#

with 0 width char title and text

late hill
#

How even

lost scarab
#

imagine i want when a person with Member role types !ping it would say something but if person with Owner role typed !ping it would say other thing

#

like check what role the user has

slender thistle
#

What lib

lost scarab
#

wdym lib?

earnest phoenix
#

Just asking but if anybody knows:
How does Luca's starboard function work? I'm working on a starboard for my bot @halcyon bear and was wandering how to make it edit the starboard message if it has already been star'd. Like this:

slender thistle
#

Library for Discord

earnest phoenix
lost scarab
#

oh js

#

oh

#

🤔

#

im so confused

#

is that for me or for him

slender thistle
#

Both is good anyways

lost scarab
#

js xd

earnest phoenix
#

idk

slender thistle
#

And since I know jack shit about js, can't help ya out, sorry

lost scarab
#

GWfroggyPepoThumb np

slender thistle
waxen quest
#

Could someone redirect me to a guide on how to send my bot's server count to a website?

slender thistle
#

Depending on your lib

waxen quest
#

Discord Js

slender thistle
waxen quest
#

Thanks mmLol

#

I'll take a look in a sec

midnight widget
lost scarab
#

anyone in here knows how to remove points when certain command is typed

#

using better-sqlite3 btw

earnest phoenix
#

Please give detail.

#

Specifically a code example of what you tried

lost scarab
#

u know better-sqlite3?

#

points system

waxen quest
#

I meant to my own website

hushed berry
#

That's a DB lib lmao

waxen quest
#

Nice mmLol

cursive dagger
slender thistle
#

Any errors?

earnest phoenix
#

yo, can someone join my server then leave, I'm trying to test join and leave

slender thistle
#

KInda wrong channel but... sure, DM me the link

earnest phoenix
#

ok

wheat marten
#

Should I host my bot with Azure?

earnest phoenix
#

no

waxen quest
#

So I basically copied the code snippet from #312614469819826177 for the server count but I can't seem to figure out what to do with it, would someone mind helping me?

earnest phoenix
#

those are outdated iirc

wheat marten
#

They are?

earnest phoenix
#

refer to the api docs on the site

topaz fjord
#

Azure 👀

earnest phoenix
#

yes the latest msg literally says

wheat marten
#

what's a good service to host a bot with, I am wondering because I am not getting a server until Christmas.

earnest phoenix
#

ovh

wheat marten
#

I am looking for a free service to temporarily use.

waxen quest
earnest phoenix
#

free and temporary? host on ur own pc

#

or heroku or glitch

wheat marten
#

Am I able to make it so my PC runs node . 24/7 even when it is off?

waxen quest
#

No I don't think so

zenith moss
#

N

#

O

wheat marten
#

Ima leave my pc on at night when it is getting approved

zenith moss
#

Just use glitch with up timer robot

#

Simple

wheat marten
#

I can't wait to get a server for Christmas

zenith moss
#

I’m using glitch until I need to get a vps

wheat marten
#

I'd rather use a physical server not a virtual one

zenith moss
#

Why?

wheat marten
#

Mainly because I am a business owner

zenith moss
#

Ohhh

#

Makes since

wheat marten
#

My company is about to be incorporated

zenith moss
#

I’d rather use a vps, all the maintenance is done by the company.

#

Nice

wheat marten
#

servers remind me of mainframes

zenith moss
#

Yes, just the feeling of owning one would be cool

wheat marten
#

yeah

#

They're also very large

zenith moss
#

Yeah

#

I watch Linus Tech Tips it think it would get annoying if they failed

#

Always need to keep a backup of a backup

wheat marten
#

Back in the 50s those were very common

gilded elm
#

just wondering, what's the real difference between

#

<@id> and <@!id>

#

it says on the wiki "user" and "user (nickname)"

#

but why does it matter

mossy vine
#

Not really, probably depends on your lib

gilded elm
#

there's no "nickname" if it's an id it makes no sense 🤔

#

idk whatever

#

i'll parse both

bright spear
#

It renders the nickname either way

bitter sundial
#

it probably got changed but the format stays idk why

topaz fjord
#

oh

#

@topaz fjord

#

👀

bitter sundial
#

it used to be like it

quartz kindle
#

if the user has a nickname in the server, its mention shows up as <@!id> (in discord.js)

#

so you need to take that into consideration if you're matching/working on mentions

hushed berry
#

@gilded elm It's used for more internal things

#

but yes, you should obviously handle both

wheat marten
#

would ```javascript
.setFooter(author)

topaz fjord
#

what is author

earnest phoenix
#

for 500

#

what is an .setAuthor()

#

also you can use set footer

wheat marten
#

What can I do to make my commando bot look more professional in the commands dm

bright spear
#

make your own help command

#

dont use the default

frail terrace
#

anyone know c#

agile lodge
#

how are people editing their bot page to have different attributes than the default one. Like having your status be a purple online status rather than a green one?

earnest phoenix
#

you mean on discord

#

or on the dbl bot page

agile lodge
#

dbl page

earnest phoenix
#

have a picture?

agile lodge
earnest phoenix
#

css

agile lodge
#

how are they using it tho?

earnest phoenix
#

i told you

#

css

#

in the long desc

agile lodge
#

oh, i see

#

thanks

earnest phoenix
#

np

keen drift
#

What are some approaches to sharding across machines Thonkang

hushed berry
#

@keen drift redis redis redis

keen drift
#

@hushed berry elaborate pl s

hushed berry
#

What lang are you coding in?

keen drift
#

Golang

hushed berry
#

I dunno how mature the redis lib is in go

#

but

earnest phoenix
#

Schildkröten sind Gott

keen drift
#

What purpose does redis serve in a shard system

hushed berry
#

Redis has support for distributed objects

#

specifcally

#

locks

keen drift
#

Oh, but I'm mainly looking for like

#

spawning shards

#

properly across machines

hushed berry
#

Oh

#

for that i use k8s

restive silo
#

thats kinda easy tho

keen drift
#

what's k8s

hushed berry
#

kubernetes?

keen drift
#

oh

#

Will Discord gateway report back proper shard count on second machine?

#

like totalShardNeed - Machine1Shards

hushed berry
#

no

keen drift
#

or do I need like a master server

hushed berry
#

Personally

#

I have my system setup to have a predecided shard count

keen drift
#

oh

kind nexus
#

nvm

hushed berry
#

You will have to work that way later, anyways

keen drift
#

hm?

hushed berry
#

since large bots have to have a static shard count

keen drift
#

really

#

large bots gateway won't report back a shard count?

hushed berry
#

I mean

#

they do

#

but its not one you can log in with

keen drift
#

h u h

restive silo
#

what is your shardCount multiple number nik?

#

im curiosed

keen drift
#

n i k

hushed berry
#

I use 128 rn

keen drift
#

how many guilds Thonkang

hushed berry
#

180k

keen drift
#

makes sense

hushed berry
#

I'll probably bump it up later

#

so that I can run for a couple months without changing it

kind nexus
#

Yo guys, how would I delete a certain role?
I tried so many different things around .deleteasync

#

I code in C#

kind nexus
#

Nevermind

earnest phoenix
#

``if (MessageChannel.substring(0, 1)) == '?' {
var args = MessageChannel.substring(1).split('');
car cmd = args[0];

args = args.splice(1);
switch(cmd) {
    // ?verify
    case 'verify':
    bot.SendMessage({
        to: userID
        message: 'Reply with you are now verifyed'
    })
}

}``

#

It gives me errors what did I do wrong (JS)

prime cliff
#
  1. if (MessageChannel.substring(0, 1)) == '?' isnt it suppose to be inside the if ( )
  2. You forgot to add a var to cmd
  3. message: is apparently invalid
  4. can you not see the red underlines you silly goose xD
earnest phoenix
#

oops I said car not var

#

missing comma after the userID in sendmessage

#

oh thanks

earnest phoenix
#

can anyone help me with How can I see on what servers my bot was invited and I want also to appear on the website discordbots.org

#

?

rain kindle
#

Hey guys, this is the api I use to make my bot "https://discordapp.com/api/v6/guilds/439880012183896075/messages/search?" which return some chats from person. The problem is, There's an offset in searchbar, which only let me get the first page of the search result. While the rest of result can't be taken. is there any ways to take all the data from the search result?

lament meteor
#

why are u using the v6 gateway

rain kindle
#

is there something else?

jagged plume
#

wdym why are you using v6

#

v7 exists?

sick cloud
#

anyone know a translation api

earnest phoenix
#

use yandex translation api

sick cloud
#

link?

earnest phoenix
sick cloud
#

ok

#

lol it doesn't work well @earnest phoenix

#

know any others?

earnest phoenix
#

I dont know any others

sick cloud
#

ok

#

@earnest phoenix in the end i just called the google api directly, cheers tho

earnest phoenix
#

can anyone help me with How can I see on what servers my bot was invited and I want also to appear on the website discordbots.org
?

#

i need help guys

#

i get error 31

#

a device attached to the system is no functioning

earnest phoenix
#
import json
import aiohttp
uri = 'https://discordbots.org/api'

class dblapi:
    def __init__(self, bot):
        self.bot = bot
        self.session = aiohttp.ClientSession()

    def __unload(self):
        self.bot.loop.create_task(self.session.close())

    async def send(self):
        dump = json.dumps({
            'server_count': len(self.bot.servers)
        })
        head = {
            'authorization': 'BOT_TOKEN',
            'content-type' : 'application/json'
        }

        url = '{0}/bots/BOT_ID/stats'.format(uri)

        async with self.session.post(url, data=dump, headers=head) as resp:
            print('DBL: returned {0.status} for {1}'.format(resp, dump))

    async def on_server_join(self, server):
        await self.send()

    async def on_server_remove(self, server):
        await self.send()

    async def on_ready(self):
        await self.send()


def setup(bot):
    bot.add_cog(dblapi(bot))```
#

Shoundn't this work?

#

Ping me if you guys have a solution

bitter sundial
#

do you have an error with that? @earnest phoenix

earnest phoenix
#

'authorization': 'BOT_TOKEN',

#

use dbl token not bot token

earnest phoenix
#

@bitter sundial Ugh I just get a 401 Error.

#

Its the place I'm posting it I'm pretty sure.

topaz fjord
#

What token are you putting

earnest phoenix
#

My bot token

#

I just didnt post it here

#

read my previous message @earnest phoenix

earnest phoenix
#

haha yes

#

@earnest phoenix

#

As i stated

#

I didnt paste it here because its a priv token

#

but you put "BOT_TOKEN" which makes me think you are using your discord bot token

#

discord bot list has a differnt token

#

just making sure you are using the right one

#

I know

#

👌

#

I mena like I already said it

#

But

#

whats the Api link?

sweet flax
#

Hi, anyone knows how to set up greeting-on-join with JDA?

gloomy fog
#

Api Key Will be Found Website
Go your bot> edit> Get Api Token > Copy
paste in 'authorization': 'BOT_TOKEN',

frail harness
#

@sick cloud Google changed how tokens for Google Translate are formatted, check google-translate-api's PRs, you might find a version that supports the new token formatting

manic badger
#

yes

#

new eval command working

#

DM me for source'

#

btw it is free

earnest phoenix
#

anyone here know how to post documents to hasteb.in?

gloomy fog
#

copy and Paste 🤷

marble elm
#

npm is a good site to use

earnest phoenix
#

can anyone help me with a discord.js problem with a rock papper scissors command. Please @ me so i can get the notification.

topaz fjord
#

We can't know what you need help with if you don't tell us what's wrong

earnest phoenix
#

for some reason the bot isnt sending the embed.

topaz fjord
#

show code

earnest phoenix
#

can i post a paste bin link

#

🔥 👉 AngryEyes

#

many problems in this code...

#

this one is funny ```js
if (message.toLowerCase() === ('rock' || 'papper' || 'scissors')) {

quartz kindle
#

papper lmao

earnest phoenix
#

its comparing if message.tolowercade is equal to true

#

im dying

#

do [x,y,z].includes(message or some shit here)

#

for proper syntax

quartz kindle
#

i took a look at the code and im having a hard time figuring out which one is the proper one, it seems like you have a lot of test commands within the same command

earnest phoenix
#

also google the diff between var const and let

#

yea i was trying to figure out where the problem was occuring

#

also image is empty in embed? so just remove that

#

ok

#

u should remake this command

#

i got headache reading code

#

lol

quartz kindle
#

also, instead of send({ mrps }) try send({embed: mrps })

earnest phoenix
#

ok

#

yes rhat will make the embed send

#

but u should make the rest of the code not a clusterfuck before spoonfeed answer tim angeryBOI

#

y u do dis

#

lol ok thanks

quartz kindle
#

lmao

earnest phoenix
#

i mean

#

u can do anything after the command

#

it dont jave to be rock paper or scissors

#

it will still work

#

so yikers

#

oh

#

ok thanks

#

also no need to check if they pick rock paper or scissors

#

nd then check each individually

#

ur checking twice

#

do what i said before with an array and use .includes

#

ok thanks 😃

#

👌

long geode
queen sentinel
#

@long geode Don't spam emotes here

long geode
#

k

sick cloud
#

@frail harness i saw that, the recent issue made just said to change it to gtx from t and that worked

earnest phoenix
#

could someone help me understand a little bit better what @earnest phoenix meant by [x,y,z].includes in discord.js

sick cloud
#

@earnest phoenix its javascript

#

google array.includes javascript

earnest phoenix
#

ok

sick cloud
#

it basically sees if one or more provided values includes a provided one

#

ie.

['foo', 'bar'].includes('foo') // returns true
['foo', 'bar'].includes('kek') // returns false
earnest phoenix
#

tickNo

if (input === 'rock' || input == 'scissors' || input == 'paper') {}

tickYes

if (['rock','paper','scissors'].includes(input)) {}
#

oooh ok thanks 👍

hushed berry
#

doesnt that create a new array every time though

#

im not too familiar with JS

earnest phoenix
#

no

#

thats not how it works nik

#

no because they will declare it at the top as const

#

it doesnt change

#

but otherwise probably yeah

inner jewel
#

[...].includes(...) will create a new array

sick cloud
#

anyone here own an api for bot devs that might have some stuff thats useful for fun-related bots? trying to see what i can add to my bot

earnest phoenix
#

Ive heard of this one called cleverbot.io its for ai messaging.

#

I dont know completly how it works but still.

sick cloud
#

i don't really like cleverbot, its so weird

earnest phoenix
#

yea i dont know much about it lol

earnest phoenix
#

i use cleverbot and just makes people hate your bot for slow responses/trying to make out

zenith moss
#

How would I setup a server for webhooks?

#

I’ve never used webhooks

earnest phoenix
#

Me too, I've triyed to put a event when someone vote for the bot but it's don't work

sick cloud
#

what lang

fossil oxide
#

If you're using javascript you can check out our lib for easy use

earnest phoenix
#

ads

#

i'll get the owner of this server to ban you oliy

inner jewel
last ferry
#

I usually store my database stuff in it’s own column

#

But that’s kinda the lazy way

quartz kindle
#

either store the list as json string or create a table for lists indexed by some sort of id

keen drift
#

I think postgre would work good with that

#

i'm a nosql guy

sick cloud
#

theres no way theres over 25 users with such a random discrim in 180~ users

zenith moss
#

It’s possible I think

earnest phoenix
#

statistically very improbable, i think

sick cloud
#

i tried loads of discrims tbh

zenith moss
#

I’m to dumb I think

sick cloud
#

ok its defs broken

earnest phoenix
#

whats your code

sick cloud
#
        let discrim = 0000;
        let users = [];

        if (!args.length) discrim = msg.author.discriminator;
        else {
            if (isNaN(args[0]) || args[0].length != 4) return msg.channel.send(`That isn't a valid discrim.`);
            discrim = args[0];
        }

        client.users.map(u => users.push(`${u.username}**#${u.discriminator}**`));

        if (users.length > 25) return msg.channel.send(`There's over 25 users with that discrim, and I can't display the full list.`);

        const embed = new client.util.embed()
        .setTitle(`Users with the discrim #${discrim}`)
        .setColor('#36393F')
        .setDescription(users.map(u => u).join('\n'));

        return msg.channel.send({ embed: embed });
earnest phoenix
#

ok so

#

let me get this straight

#

youre taking every single user that your bot knows

#

and adding it to an array

#

then if that array's length is more than 25 (the bot knows more than 25 people) it says that message

sick cloud
#

yeah

earnest phoenix
#

are you seeing the flaw yet

sick cloud
#

arrays dont allow duplicates though right?

#

thats what i thought

earnest phoenix
#

no

#

only sets

sick cloud
#

oh

#

oh

#

ok

earnest phoenix
#

and even so the .users property of client

#

won't have duplicates

#

the problem is that a) i doubt you intended to show the list for that discrim for everybody that the bot knows and b) it doesn't filter the discrim at all

sick cloud
#

its meant to show it for everyone, not per guild or whatever

#

and okay

wheat marten
#

How would a config.js file work?

#

Would I put a const call token in it?

#

And make a const called token in index?

sick cloud
#

no

#

just use json

wheat marten
#

Why json? Is it because of the format?

bright spear
#

json is for data

#

js is for code

wheat marten
#

Good point

#

I forgot that

#

Gotta remember using JSON in roblox

earnest phoenix
#

Ey I have a question.
I’m pretty new to discord bots but not that new to programming, I’ve seen some bots be able to play games on discord servers and I was wondering if there’s any custom way you can make your game that is not embeds or texts?

#

Was planning on doing it with js

rapid citrus
#

ah, did you mean like 2d or 3d game?

#

with graphics inside discord?

earnest phoenix
#

Not really

#

It’s a game only consisting of drawn blocks

#

So 2d

#

But it is drawn with the help of a library (p5)

rapid citrus
#

then its impossible. maybe if you are jimmy neutron you can do it.

#

it may be possible with gifs, and realtime edits. but its api abuse.

earnest phoenix
#

Oh is it?

rapid citrus
#

oh you can't edit files on discord.

#

you can only edit text.

#

so yeah still impossible.

earnest phoenix
#

Well rip

rapid citrus
earnest phoenix
#

Lol

#

It was the game of life

#

i need help

#

Please enter at least 300 characters excluding special characters in your detailed description. Add your commands. Spaces or empty spaces are not counted.

#

I was thinking you input your animals or humans or whatever

#

And you just see as the world interacts with each other

#

I’ve already made it, was interested if I could pop it into discord chat

#

Guess not

#

@earnest phoenix what’s the problem?

#

i want add my bot to discord bots

#

but its want 300

#

Please enter at least 300 characters excluding special characters in your detailed description. Add your commands. Spaces or empty spaces are not counted.

#

And....?

#

It means write a 300 lettered bot description

earnest phoenix
#

Does anyone know how to get the online members and total member count through the API?

#

I'm using a PHP curl request

reef rapids
#

is blob down?

earnest phoenix
#
    $authToken = $core->api->bot_token;
    $url="https://discordapp.com/api/v6/guilds/402882533592662017/members";

    $ch = curl_init();
    curl_setopt_array($ch, array(
        CURLOPT_URL            => $url,
        CURLOPT_HTTPHEADER     => array('Authorization: Bot '.$authToken),
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_FOLLOWLOCATION => 1,
        CURLOPT_VERBOSE        => 1,
        CURLOPT_SSL_VERIFYPEER => 0,
    ));
    $response = curl_exec($ch);
#

Does anyone know how to get more than one result?

earnest phoenix
#

No one knows??

sick cloud
#

@earnest phoenix its right in front of you

earnest phoenix
#

Limit?

sick cloud
#

yes

#

set as 1000

earnest phoenix
#

But that will still only give me 1000

#

I need all members in a guild

sick cloud
#

if the server is over 1000 members

#

just run it a few times i guess

#

or go ask dapi

spring ember
#

It is not possible

zenith oriole
#

is there an api that converts a b64 image to a url (need it for embed)

spring ember
#

Due to spamming

#

And big data and stuff

#

@zenith oriole for url?

#

You just need to host it somewhere

zenith oriole
#

like a data:image/png;base64

#

it's generated randomly, so I can't really host it

bitter sundial
#

I dont think discord accepts data urls for embeds

zenith oriole
#

i know

bitter sundial
#

what are you using it for then

zenith oriole
#

minecraft server pings

#

they use a b64 image for the favicon

sick cloud
#

what api are you even using

#

pretty sure most apis have a png url with them

zenith oriole
#

ping packets send favicons in b64

bitter sundial
#

so you need to turn a base64 image to a link for an embed
You're gonna have to upload it somewhere

zenith oriole
#

imgur? idk

bitter sundial
#

possibly

zenith oriole
#

bootleg php script to the rescue

bitter sundial
#

you code in php?

zenith oriole
#

nah

#

it's just the language im used to server side

#

quick and dirty

#

but does the job well

earnest phoenix
#

What

#

Why would it

rapid citrus
#

ok another question, is this safe?

  public static OnReady() {
    return new Promise((resolve, reject) => {
      setInterval(() => {
        if (this.Initializing === false) {
          resolve();
        }
      }, 1);
    });
  }

I'm curious about the resolve method there. that might be called multiple times because the interval is too low.

earnest phoenix
#

Wtf is this question

#

Wdym by Safe

#

Lmao

rapid citrus
#

do you even understand what is setInterval?

#

and that number 1 there?

#

do you even code and thinking about thread safe or something like that?

#

and do you know what promise is?

raven torrent
#

Hey

rapid citrus
#

hey, what's up?

raven torrent
#

My bot died

#

xD

rapid citrus
#

revive it?

raven torrent
#

Yea, working on it

rapid citrus
#

do you have respawn method?

raven torrent
#

Like the hoster fucked me up

rapid citrus
#

you must make one

raven torrent
#

Nah I don't

#

Have it

rapid citrus
#

make a respawn method. it will respawn your bot when it died.

raven torrent
#

Yea, why not

rapid citrus
#

what hosting?

#

don't tell me its glitch.

raven torrent
#

Hell no

#

It's a VPS

worldly steeple
#

@rapid citrus calling resolve multiple times is fine, it will ignore all subsequent calls.... but that interval is going to run every second forever and ever

rapid citrus
#

hmm. thanks can I stop the interval?

worldly steeple
#

yeah but i think there is a better way of doing this. lemme write it

rapid citrus
#

yeah show it to me.

#

@raven torrent use heroku.

raven torrent
#

Hell no

earnest phoenix
#

use a lib with autoreconnect kek

raven torrent
#

I hate free shit

worldly steeple
#

well actually id have to assume a bunch of stuff to write an actual example
but basically, create a promise and save it as a field on the object.
then in your OnReady() function, return that promise
when the thing is ready, fulfill the promise

#

after the promise is fulfilled, anything that awaits OnReady will immediately resolve

#

but to answer your question about stopping the interval anyway, you do something like

const timer = setInterval(() => code, 1);

to start it

and then

clearTimeout(timer);

to stop it

earnest phoenix
#

So there's literally NO way to figure out a guilds membercount

#

lol

#

What

rapid citrus
#

what lib are you using?

#

@earnest phoenix

earnest phoenix
#

Restcord

worldly steeple
#

clearInterval actually, not clearTimeout

earnest phoenix
#

I can also just use CURL requests

rapid citrus
#

@worldly steeple I'm reading the docs right now.

#

php
2018

earnest phoenix
#

🙄

#

It's not the only language i write

#

And PHP is one of the best langs out there

rapid citrus
#

then use other lang.

earnest phoenix
#

No lol

#

It's for a website, not for a bot

rapid citrus
#

.man you can make websites with different langs. nodejs is the best option.

earnest phoenix
#

Yeah ok i didnt ask for your looks on things

#

I asked how to get the membercount of a guild using discord's api

#

if you cant answer me that then why are you speaking to me

rapid citrus
#

yeah use discordjs thats nodejs its a comlpete package you can fetch everything

earnest phoenix
#

I work professionally as a backend web application developer and infrastructure designer at europe's leading erotic toy distribution company

#

Do you really think i dont know what i'm doing

#

I didn't ask for your personal preferences

rapid citrus
#

I didn't ask where do you work.

waxen quest
fossil oxide
#

Can you guys be nice lol

#

It's not hard

rapid citrus
#

what do you mean not hard?

sinful lotus
#

If they use php, let them use it. Its him who is coding not you

#

¯_(ツ)_/¯

rapid citrus
#

@sinful lotus that's for his own good. who uses php btw?

sinful lotus
#

you cant force your own programming ideals onto others

#

thats your ideal, not his

topaz fjord
#

free hosting

#

ew

earnest phoenix
#

@rapid citrus sorry my phone battery ran out

#

ya i do know what they are

rapid citrus
#

then why did you asked?

earnest phoenix
#

just seemed like a weird question to me

#

it can handle multiple calls

rapid citrus
#

yeah that's what I'm asking for. I'm not too expert with promises so I asked.

earnest phoenix
#

ya :DDD

#

@fossil oxide Can you tell me how you are fetching online membercounts?

#

Or membercounts in general

fossil oxide
#

For Discord servers?

topaz fjord
#

online or all

#

And it depends on your lib

earnest phoenix
#

@fossil oxide Yeah

#

I'm trying to get it done without widgets through a bot token

topaz fjord
#

what lib are u using

earnest phoenix
#

Restcord

inner jewel
#

to get member count you need a gateway connection

#

they're sent with GUILD_CREATE payloads

#

you could iterate the fetch members endpoint

#

but that's incredibly slow for large guilds

earnest phoenix
#

Hmm

#

@fossil oxide Can you let me know how you did it?

#

ew php

#
    $total_members = [];

    $at_time = 1000;
    $max = 30;
    $last_id = isset($last_id) ? $last_id : 0;

    for($i = 0; $i < $max; $i++) {

        $new_loop = $core->rc->bot->guild->listGuildMembers(['guild.id' => 402882533592662017, 'limit' => $at_time, 'after' => $last_id]);

        foreach($new_loop as $loop) {

            array_push($total_members, $loop->user->id);

        }

        $last_id = $total_members[count($total_members) - 1];

        if (count($new_loop) < $at_time) {

            $i = $max;

        }

    }

    dump(count($total_members));
#

Incase anyone needs it

bitter sundial
#

@earnest phoenix We're just getting them from the gateway like Natan described

earnest phoenix
#

@bitter sundial I see, thank you @inner jewel

earnest phoenix
#

What are some of the most important commands for a bot owner must have? Apart from eval and reload.

#

I don't understand what is the password for webhooks.

Can someone help me plz?

i'm using Javascript with library discord.js

#

Are you trying to connect DBL Vote or something?

#

@earnest phoenix

#

yep

#

I want to use it, but I don't know what is the webhooks password

#

So it don't work

#

I believe the webhook password is what you entered in the Authorization option of the DBL Bot Editing Page

#

uuhh?

#

Wait

#

You mean the webhookAuth and not the password?

#

Yeah, its what you put in the Authorization box on the bot edit page

#

Me?

#

Yeah

#

I never put something

#

Just put something random but secure

#

It doesnt have to be somthing specific, just spam your keyboard or something

#

Make it secure

#

Ok

#

And for the URL?

#

What is it?

#

What are you hosting your bot on?

#

on my computer for reworking

#

I'm not sure how to actually do this on a computer, I use Glitch.com for the Vote Announcements and use Skysilk VPS Services for my actual bot

#

So, im stuck here also 😂

#

bruh

#

But the first part I said is correct.

#

Just not sure bout the URL part

#

Yep the first part is correct, it's me i'm just dumb

#

If I put my ip address it's will work no?

#

I also believe you would need to Port Forward your IP and I think its what is meant to be put in the box

#

oof I can't port forward my ip

#

mhh

#

I dont know how to port forward tbf, so I use glitch to get the vote updates and use skysilk to run my actual bot xD

#

I will test it

#

I think your know heroku

#

If I host my bot on heroku, it's will work?

#

I dont know, I never used Heroku, sorry.

#

bruh

#

I don't like it 😂

#

Just use Skysilk, they give you $10 free to use on their services.

#

oh

#

I think they already have IP's that are Forwarded, not too sure though

#

I never heard about this host

earnest phoenix
#

@earnest phoenix have you completed the survey?

#

Plz help

warm marsh
#

Ez

earnest phoenix
#

@earnest phoenix are you here?

ruby dust
#

with python, is there a way I can force 2 numbers to be visible, even if it's just 00

late hill
#

Make it a string?

#

Add a 0 infront if the value is under 10

#

?

ruby dust
#

that sounds like a workaround, but I'm wondering if python even has a built-in way, like when you can do with decimal numbers you can just format the int with .2f, but this time with whole numbers

late hill
#

Doubt that exists

#

But I guess u could google it :):)

ruby dust
#

been googling that for 3 days is the reason why I'm asking

late hill
#

oh

#

oof

earnest phoenix
#

why wont this work

const discord = require('discord.js')
const {prefix, PREFIX, footer, owner, ownerID} = require('../../settings/config.json')

exports.run = async (message, args) => {
  const client = new discord.Client({disableEveryone: false});
  if (message.author.id !== ownerID) {
    message.channel.send("You are not authorized to use this command.");   
    message.delete();
  } return;
  message.delete();

  let announce = new discord.RichEmbed()
      .setAuthor("Announcement From ")
      .setTitle("Callumok2004")
      .setDescription(args.join(" "))
      .setFooter(footer)
  client.channels.get("501467078172082176").send("@everyone", { embed: announce })

  message.delete();
client.login(process.env.TOKEN)


}

Language = JavaScript

#

........ Not helpful ........

smoky spire
#

Because right after you check for owner id, you return out of the command. You probably wanted the return to be inside the if statement

late hill
#

Or

else return;
#

probably

#

wait no

#

NVM

earnest phoenix
#

So I tried to make a bot but when I used the terminal and typed node . it didnt work

lament meteor
#

@earnest phoenix cause u have a client and u made a new client in a client and a client. i presume u understand what i mean

#

@earnest phoenix show code or u dont have any code

earnest phoenix
#

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

bot.login('token');

lament meteor
#

reset the token

earnest phoenix
#

i did

lament meteor
#

try to do it do the path

#

cd path -> node file.js

earnest phoenix
#

the path?

lament meteor
#

well

#

iirc u can drag and drop the folder

#

u know how to use node or u are new?

earnest phoenix
#

where would i drop the folder exactly?

lament meteor
#

so open a new terminal

#

ugh

earnest phoenix
#

oh ok

#

thx for the help

lament meteor
#

u on mac or windows or linux

earnest phoenix
#

windows 10