#development

1 messages ยท Page 542 of 1

sick cloud
#

i'm a bit stupid, but will this work?

    constructor(token, options = {}) {
        !token || token == '' ? {
            throw: new Error('No token was provided') } :
        { return: this.connect() }
    }
#

apparently it says it's the right syntax but idk

keen drift
#

uh no?

sick cloud
amber fractal
#

Wait

earnest phoenix
#

kind of on the same topic but also not, is there any way to use statements with the ternary/conditional operator in javascript? like, an equivalent to ```js
if (conditionWhichHappensToBeTrue) return "I'm dumb"; else {
var a = coolJavaScript();
}

sick cloud
#

not 100% sure tbh

earnest phoenix
#

alright well if anybody comes up with anything ping me, i need to go to sleep

#

and also IIFEs dont work since they aren't in the right scope/return doesn't return from the function that the conditional operator is in/etc

sick cloud
#

anyone with eris knowledge know why this isn't working? this.on(event.name, event.bind(null, this));

#

events don't work

fast fjord
#

Is anyone aware of a way for a bot to delete the oldest message posted by a user in a channel so that, in theory, they only ever have 1 message posted at a time (unless it exceeds the 14-day limit)?

In practice, I'm using a channel as a means to update players status' and many forget to delete their previous update, so I've been doing it manually for a long time. It would be awesome if a bot could do the majority of that work: @ User_X updates status #1, then @ User_X soon afterwards, updates status #2, ideally #1 could then be deleted automatically.

lament meteor
#

whats a good lib for requesting websites in py?

cursive dagger
#

Requests? It is blocking for bots so if you want it async use aiohttp

lament meteor
#

blocking?

sick cloud
#

scraping or general api requests

uneven depot
#

requests lib is fine for most things

lunar knot
#

@fast fjord You could just store the message id of your player status and the author.
you can delete messages by id then and you can check on new messages by the same user

fast fjord
#

Ahh @lunar knot they aren't editing the same message, but creating a new one - so it would have a different id to my understanding, correct?

mossy vine
#

@fast fjord new message is new id, yes

fast fjord
#

I'm just surprised there isn't (or I haven't found) a bot that does, essentially, reverse-purging ๐Ÿค”

lunar knot
#

you could do it yourself easily so yea why having a function for it

fast fjord
#

Seems like something that would be possible and have a lot of uses

lunar knot
#

hm idk

fast fjord
#

more than nice servers i mean

#

I would bet that a lot of servers have a channel where they wan't to store just the most recent update/message by their users

#

it could even be used as like a status update

mossy vine
#

Of yknow, you could just take an entirely different approach to this problem which doesnt require working around api limits

fast fjord
#

yes?

mossy vine
#

Yes

fast fjord
#

how? i maen

#

or you just mean in general: think of another way

mossy vine
#

Yes, just think of another way

fast fjord
#

I'm not a dev, or a veery good one at least, so it's beyond my capabilities

mossy vine
#

Anything is possible with some creativity and a little bit of coding

fast fjord
#

Yeah, I've been working on a bot for months now and can't even set up the hosting

#

I get clusterfucked by the command-line terminal jargin

#

the coding i understand mostly

mossy vine
#

Learning how to properly use a terminal is very useful

fast fjord
#

i see that

uneven depot
#

@fast fjord if you don't mind posting sample code, can try to help.

fast fjord
#

what do you mean, @uneven depot ?

#

not sure what you mean by sample code

lament meteor
#

like what you hv done so far

uneven depot
#

you said you were working on a bot for this so if you need help with some bug, maybe can post code on pastebin or something and post a link here so we can help

fast fjord
#

no no. not for this

#

for something else

uneven depot
#

oh ok

fast fjord
#

a database-type bot that stores what users input and outputs it in various helpful ways

#

for a game

mossy vine
#

Okay, just putting this out here

Im having troubles with setting up a subdomain. I use namecheap, host with github pages. The main website is working perfectly. I have configured a subdomain with freedns, but github says the dns isnt set up correctly, when its literally configured the same way as the main website
If anyone can help, please dm me

fast fjord
#

specifically tailored to a certain game

uneven depot
#

do you mean in a way where it integrates with the game itself?

fast fjord
#

nope. manually input. users update various aspects and the bot, in theory, tracks and keeps it to spit out at a later time in different ways when needed

#

It's a mobile game: CATS. They don't make any APIs or anything public. Even their art assets are locked behind hard-to-reach containers.

#

which is more my area. I'm a Graphic Designer

#

But I'm the leader of a prominent gang with a large discord (for the game - 200+ ppl), and I'm always looking for ways to improve the user experience for my members.

vocal meteor
#

Hey anyone know how to loop a song 1 time in discord.js

mossy vine
#

just modify this a bit

#

and there you go

coral trellis
mossy vine
#

(please be aware that the code was NEVER tested lmaooo)

vocal meteor
#

LOL

mossy vine
#

tbh xig its not spoonfeeding its literally just template

coral trellis
#

Shh don't ruin my moment sad

earnest phoenix
#

@carmine warren ty adsdsada

vast lantern
#

Just wanted to make sure theres no way to make a RichPresence like a game could have for a bot right?

inner jewel
#

no

#

bots can't have rich presence

vast lantern
#

okey thx

mossy vine
#

my code:

import {prompt, ui} from 'inquirer';

prompt({
    name: 'name',
    type: 'input',
    message: 'Whats ur name'
}).then(ans => {
    console.log(`Hello ${ans.nev}`)
})```

error:
```(function (exports, require, module, __filename, __dirname) { import {prompt,
ui} from 'inquirer'; 

SyntaxError: Unexpected token {```
#

the error is on the { after import

#

can anyone help?

inner jewel
#

common js doesn't have import

#

you'll either need mjs or another language

mossy vine
#

it worked perfectly in the example i copied, and works perfectly if i import only prompt or ui, but not if i import both

topaz fjord
#

or babel

earnest phoenix
#

@mossy vine fucc i finally got toLowerCase() to work

mossy vine
#

only took you a day

#

at least you got it now, thats what matters

keen drift
#

lmao

prime cliff
#

You only just got that to work oof

earnest phoenix
#

I need help with my bot

#

uwot

mossy vine
#

please be more specific

earnest phoenix
#

I have to tag the rol @OWNER but in all servers id is diferent, some one knows how to tag the rol with bot?

mossy vine
#

@earnest phoenix what lib?

earnest phoenix
#

@mossy vine

mossy vine
#

discord.js, ok

#

message.channel.send('<@' + message.guild.ownerID + '>')

#

@earnest phoenix

earnest phoenix
#

Yes

#

but I need to put @owner?

mossy vine
#

no

earnest phoenix
#

Like message.channel.send ('<@' + OWNER + '>')

mossy vine
#

the code i sent will tag the owner of the server

earnest phoenix
#

but how a rol?

mossy vine
#

most servers dont even have an owner role

#

this will tag the owner of the server

#

if you run the code here it will mention oliy

#

since he owns the guild

#

(btw dont tag oliy he will be mad)

#

((and youll probably get muted))

earnest phoenix
#

My bot is for configurate another bot and I need to tag a rol

#

@mossy vine

mossy vine
#

i dont understand what you want

#

i cant help

buoyant void
#

@earnest phoenix

var ownerRole = message.guild.roles.find(role => role.name === ("Owner"));```
amber fractal
#

("name", "Owner") would work aswell, wouldnt it?

buoyant void
#

It doesn't work anymore, I don't think

#

I tried using it

amber fractal
#

I use it

buoyant void
#

Ah, well

#

Probably

amber fractal
#

Someone told me it was deprecated...

#

It doesnt say that on the docs anyways

inner jewel
#

it does

buoyant void
#

Ahh, alright

keen drift
#

it only works on stable

#

master changed to filter fn

buoyant void
#

ahh

smoky spire
#

Find isn't deprecated, not using a function in find is

amber fractal
#

I mean it's been working just fine for me for the entire time I've been making bots.

smoky spire
#

Deprecated doesn't mean doesn't work

amber fractal
#

I know

#

But if it works, and its less work...

earnest phoenix
#

what do I put?

amber fractal
#

The non-deprecated way

#

It will continue to be supported

#

so ...role => role.name...

keen drift
#

idk about deprecated, it's more like dropped completely

amber fractal
#

But it works ยฏ_(ใƒ„)_/ยฏ

#

And is an example

#

I dont even get a warning...

earnest phoenix
#

This message.guild.roles.find(role => role.name === ("OWNER"));

#

?

keen drift
#

@amber fractal Are you looking at the stable or master doc

#

Which d.js is he even using

amber fractal
#

Stable, why would I look at a version I dont use mmLol

earnest phoenix
#

@amber fractal

#

This ``message.guild.roles.find(role => role.name === ("OWNER"));

#

?

amber fractal
#

It should work

earnest phoenix
#

It doesnt

#

do I have to put a variable?

amber fractal
#

Its case sensitive

#

Is the owner in all caps in the role?

earnest phoenix
#

no

#

Itss in some roles

amber fractal
#

You have to put it in exact, also you dont need the extra ()'s around the "OWNER"

earnest phoenix
#

It doesnt

amber fractal
#

Whats the error

earnest phoenix
#

Nothing appears

#

@amber fractal

amber fractal
#

What is it you're trying to do?

earnest phoenix
#

I need to @ the owner rol

amber fractal
#

Oh

#

Lol

earnest phoenix
#

Is that possible?

loud salmon
amber fractal
#

Yes its possible

#

Sorry, c = cutie told you a way to do it right, did you try that?

buoyant void
#

@earnest phoenix

var owner = message.guild.roles.find(role => role.name === "Owner");
message.channel.send(`<@${owner}>`);```
#

Try that bad boy

mossy vine
#

@amber fractal my name is Cyber

loud salmon
buoyant void
#

oh

#

i forgot

earnest phoenix
#

how do i make my bot look like its playing a game

buoyant void
#

wtf the frick

#

there we go

loud salmon
amber fractal
#

Alright Cyber lol

#

Ill forget

mossy vine
#

@earnest phoenix read ๐Ÿ‘ the ๐Ÿ‘ docs ๐Ÿ‘

#

you need to spend a minute in the docs to find the answer

loud salmon
#

you can send a playing status through discord

buoyant void
#

spooder i'm sorry for the spoon feed

loud salmon
#

its a method

earnest phoenix
#

๐Ÿ‘ docs ๐Ÿ‘ the ๐Ÿ‘ read ๐Ÿ‘

loud salmon
#

its fine :p @buoyant void

mossy vine
#

im actually telling you where to look

#

and you actually meme my helpful message smfh

buoyant void
#

doc boys

#

about halfway down

loud salmon
#

docs = the bibbl

mossy vine
#

yes

buoyant void
#

pretty much

earnest phoenix
#

bot.on('ready', () => { bot.user.setGame('GAME HERE') })?

#

would that work

buoyant void
#

yep

#

should

#

actually

amber fractal
#

setGame deprecated

buoyant void
#

it should be setPlayingGame

amber fractal
mossy vine
#

@buoyant void no

buoyant void
#

?

#

oh darn

#

you right

mossy vine
#

setPlayingGame? where did you get that from lmao

buoyant void
#

space

earnest phoenix
buoyant void
#

oh juicy, full screenshots

earnest phoenix
#

something wrong?

loud salmon
inner jewel
#

yes

loud salmon
#

did you read the error

inner jewel
#

you need to learn javascript

loud salmon
#

^^^^^^^^^^

earnest phoenix
#

I need to learn a bit more, my first bot

mossy vine
#

this kid doesnt even know what javascript is, he is just copypasting code

amber fractal
#

It's outside message's scope

loud salmon
#

everyone starts somewhere :<

buoyant void
#

^

inner jewel
#

learn the language first, then make a bot

mossy vine
#

^ yes natan

inner jewel
#

start with the basics

buoyant void
#

I learned the basics of JS, then used bots to learn more

#

It's what I always go to for to learn new language capabilities, is build a bot usually

amber fractal
#

I'm just in a computer science class. Then I read the docs or ask questions on here or stackoverflow mmLol

#

The computer science class taught me nothing

#

Its a waste of time

buoyant void
#

I'm self taught (by stack overflow)

earnest phoenix
#

i got it (thank you)

dreamy breach
#

Someone how to catch player guilds from o2auth with a $response (i can have name, id, discrim, etc but not guild).

keen drift
#

understandable, very descriptive, come again

#

@loud salmon can def help with this

loud salmon
earnest phoenix
#

why do people act worse than a 9 year old, you have internet, do research for yourself

mossy vine
#

ikr

#

we have docs, no need to be spoonfed

keen drift
#

I demand to be spoonfed

buoyant void
#

Is there any method to tell how many cases are in a switch statement?

mossy vine
#

uhm, i dont think so

buoyant void
#

s a d

earnest phoenix
#

does discord support base 64 in embed thumbnail?

mossy vine
#

@earnest phoenix what do you mean by that?

keen drift
#

I don't believe so

earnest phoenix
#

just a question

mossy vine
#

What do you mean by base64 in embex thimbndiland

keen drift
#

base64 data image in thumbnail

mossy vine
#

Oh

#

Probably not

inner jewel
#

no

#

but you can upload the image as an attachment

#

and use attachment://FILENAME.EXT

#

as the url

slate kayak
bright spear
#

ThinkEyes that doesnt really have any info

slate kayak
#

the gyp is the error ๐Ÿ˜ฆ

#

@bright spear

keen drift
#

need the whole error mate

buoyant void
#

still doesn't give any info @slate kayak

sinful python
#

can someone help me, how do i change the background of my bot

#

in the website

keen drift
#

css mate

sick cloud
#

@keen drift are you aussie now mate mmspin

prime cliff
#

For anyone wanting to do a css background

Normal version

body {
  background-repeat: no-repeat;   
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("https://linkhere.png") !important;
}```

Dark overlay over background (Better for bright wallpapers)
```css
body {
  background-repeat: no-repeat;   
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("https://linkhere.png"),linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0.5)) !important;
 background-blend-mode: overlay !important;
}```
sick cloud
warm marsh
#

@sick cloud What do you mean improved?

sick cloud
#

maybe look nicer?

warm marsh
#

Nicer?

sick cloud
#

i added spacing

warm marsh
#

ok

sick cloud
#

like easier on the eyes? idk

warm marsh
#

meh, thats the terminal for you.

#

Could make it a multiline thing like

client.on('ready', async () => {
    console.log(`Connected To Discord as ${client.user.tag},\nID: ${client.user.id},\nGuilds: ${client.guilds.size}`); // And so on
});
#

but changing how it looks really depends on what terminal you use.

sick cloud
#

i don't really need to know the guild count, but alright

red venture
#

Hey guys, I'm using JDA and I'm unable to find a method to send a dm to a user and would like some help or advice

sick cloud
#

this is my logger rn

const { grey, white, red } = require('chalk');

module.exports = async (message, error) => {
    if (!error) {
        return console.log(`${grey(`${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`)} \n${white(message)}\n`);
    } else {
        return console.log(`${red(`${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`)} \n${white(message)}\n`);
    }
}
warm marsh
#

And this works?

sick cloud
#

sure does

warm marsh
#

@solar belfry i am not the best with JDA but isnt it something like event.getAuthor().sendMessage("Message").queue();

#

thats if you want to do it on a command

red venture
#

I'm looking into it^^ thanks for now

warm marsh
#

ah ok

#

i gave up on jda as i wasn't much of a fan using itellij

red venture
#

Itellij?

warm marsh
#

A ide

#

code editor

sick cloud
#

Jetbrains IntelliJ

warm marsh
#

Yeah

red venture
#

A okay... Why not Eclipse?

sick cloud
#

ew mmLol

warm marsh
#

Because that shit aids, personal pref

sick cloud
#

i dont even do java and eclipse is ew

warm marsh
#

Yeah

#

java is ok...

red venture
#

Well I found c# is not so good for development thus I changed to java

warm marsh
#

@sick cloud can i ask: javascript return console.log(`${grey(`${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`)} \n${white(message)}\n`); Why need date?

#

Yeah c# is meh

sick cloud
#

date is useful

#

also specifically for looking at times between things

#

i can see it took 6 seconds to connect

warm marsh
#

What os are you using?

#

Because most os terminals show time something happened at

sick cloud
#

windows

#

obviously it doesnt lul

warm marsh
#

ah thats why then...

#

Windows is meh only really good for gaming

#

linux alot better for code

#

and mac bin that shit

sick cloud
#

i cant install linux

#

so ยฏ_(ใƒ„)_/ยฏ

keen drift
#

what my output looks like

#

hue hue hue

warm marsh
#

Very nice

#

@sick cloud How so?

sick cloud
#

my parents wont let me install it on any good PCs

keen drift
#

clean output ๐Ÿ™†๐Ÿพ

sick cloud
#

the best i have is an old xubuntu copy on my old dead laptop

#

also i have windows 10 pro, which is okay

warm marsh
#

meh

sick cloud
#

i'd try install ubuntu to an EXT drive

#

but i cant

#

partitioning is annoying as hell

#

and it might modify my boot thing

warm marsh
#

Its annoying as hell if doing on the same drive

#

Yeah it'll modify boot, but doesn't mean can't get into windows

sick cloud
#

if i modify boot at all my parents will take my pc off me

#

which is a pain

keen drift
#

wew

warm marsh
#

lmao, its not like you are breaking it

keen drift
#

some parents

warm marsh
#

Yeah...

sick cloud
#

they dont care

earnest phoenix
#

this is an interesting chat

keen drift
#

very

#

i n te r es tik n g

warm marsh
#

is your dad bill gates, not wanting anything other than windows?

next scaffold
#

Hi

sick cloud
#

my dad knows shit about PCs and my mum thinks linux is a virus and mac is the future

#

mac of all things

next scaffold
#

may I ask why mot bot doesn't have perms here

warm marsh
#

ooft

#

need shot personally

sick cloud
#

@next scaffold bots only work in testing channels

keen drift
#

linux is a virus and mac is the future

#

wew

earnest phoenix
#

Mac is the opposite of the future

keen drift
#

just install mac then

sick cloud
#

lol

next scaffold
#

ik

keen drift
#

mac is not that bad

next scaffold
#

it doesn't work in testing

#

lmfao

sick cloud
#

muted

warm marsh
#

mac is kinda terrible

sick cloud
keen drift
#

i'd love to switch to macos if I don't have to go thru this hacktosh thing

sick cloud
#

macos has a nice UI

warm marsh
#

Thats all it has

keen drift
#

?

#

It has an unix backend

#

It's essential linux

warm marsh
#

Yeah true

#

but doesn't mean its good

earnest phoenix
#

I remembered when i used linux

keen drift
#

I love to hop on macos, it'll make my development so much easier

earnest phoenix
#

i had too much power and fucked it up

keen drift
#

than this windows crap

warm marsh
#

Yeah windows is shit

keen drift
#

but then i lose a lot of my games

warm marsh
#

use linux intead

#

dual boot with windows and linux

sick cloud
#

love

#

its awesome

keen drift
#

looks like macos

earnest phoenix
#

Looks like mac a lil

keen drift
#

except it's not

earnest phoenix
#

Ye

warm marsh
#

looks like malware

keen drift
#

ok

earnest phoenix
#

Use Debian or Arch

#

they arent too bad

warm marsh
#

its like buying a Chinese phone that says ios when its clearly just android with a skin

keen drift
#

hue

warm marsh
#

?

sick cloud
#

Elementary is Ubuntu

#

its based off the latest ubuntu

#

and its real nice

#

Juno has dark theme

warm marsh
#

meh

#

id rather use ubuntu

earnest phoenix
#

^

sick cloud
#

which is nice

earnest phoenix
#

i rather use debian with kde instead of a bunch of unneeded shit installed on ubuntu

warm marsh
#

meh

#

I need a little help actually, i lack the creativity and was wonder if you had any ideas of what commands i could code for my bot.

keen drift
#

kek

#

wrong place to ask that

warm marsh
#

I know

#

but there was a convo sort of so meh

sick cloud
#

no it is

#

"channel for chatting about (bot) development"

keen drift
#

creativity

#

whoosh

warm marsh
#

Lmao

next scaffold
#

I need help

#

So my bot was muted for responding to all three-letter prefixes

#

but now I fixed it, so can my bot be unmuted please?

#

@normal bramble

prime cliff
#

Depends

#

Have you been a good boy this christmas?

next scaffold
#

yes

#

ofc

#

please

#

YESS thx

warm marsh
#

A hex one

sick cloud
#

#36393F

carmine echo
#

Quick stupid question. How do you put a small image in an embed's title? GWczeWhat

frozen tiger
#

which language

carmine echo
#

None?

#

Like a json

mossy vine
#

use an emoji

frozen tiger
#

lol

carmine echo
#

Makes sense

mossy vine
#

add the emoji to a private server, add the bot to said private server, make bot use the emojis id

carmine echo
#

I've seen people put people's pfps in titles / footers

frozen tiger
#

no need

mossy vine
#

oh, that

frozen tiger
#

Discord handle avatar in embed author

mossy vine
#

thats the embed author

carmine echo
#

Makes sense. Thanks

mossy vine
#

idk what language youre using but in d.js its .setAuthor()

carmine echo
#

Assuming people use embed builders

mossy vine
#

smfh

frozen tiger
#

that's why I asked which language he use x)

carmine echo
#

now I know more about embeds

mossy vine
#

idk i personally use this really handy script i stole from someone else but modified it

exports.createEmbed = (title, description = '', fields = [], options = {}) => {
    let url = options.url || '';
    let color = options.color || '3498db';

    if (options.inline) {
        if (fields.length % 3 === 2) {
            fields.push({ name: '\u200b', value: '\u200b' });
        }
        fields.forEach(obj => {
            obj.inline = true;
        });
    }

    return new RichEmbed({ fields, video: options.video || url })
        .setTitle(title)
        .setColor(color)
        .setDescription(description)
        .setURL(url)
        .setImage(options.image)
        .setFooter(options.footer ? options.footer : randomFooter())
        .setAuthor(options.author === undefined ? '' : options.author)
        .setThumbnail(options.thumbnail);
};```
frozen tiger
#

Everything is explained

carmine echo
#

epic thing. Bookmarked

mossy vine
#

basically, yeah

carmine echo
#

Thank

frozen tiger
#

ur welcome

inner jewel
#

you can't set video btw

sick cloud
#

that's a gross embed builder

earnest phoenix
#

.

earnest phoenix
#

Oh

#

I'm py

#

Not what ever that is

#

Lol

#

IMA do one example py code

knotty steeple
#

we dont need it

earnest phoenix
#
import discord 
from discord.ext import commands

TOKEN = 'Your bots token' #You can find it here https://discordapp.com/developer/applications/

client = commands.Bot(command_prefix = 'Your prefix')

@client.event
async def on_ready(): #This function turns on the bot
print('Bot is online') 

client.run(TOKEN)
knotty steeple
earnest phoenix
#

I don't use on_message

#

I use commands

#

Like this

knotty steeple
#

you dont even load the cogs in that example

earnest phoenix
#

@knotty steeple I do know how

#

Lemmie give u my code with cog

#

My code is lost

#

Never mid

#

When I say I can do stuff no one believe

#

So I don't give a fuck about what u wanna say

knotty steeple
earnest phoenix
#

how could i assign role to user when user reacts to message with specific emoji

sick cloud
#

@earnest phoenix what language and library

knotty steeple
#

reaction collector

sick cloud
#

you'd have to listen to a reaction add event

#

@knotty steeple performance heavy

earnest phoenix
#

discordjs

sick cloud
#

ok

knotty steeple
#

addMessageReaction

#

event

#

is that it?

sick cloud
#

that isn't it

knotty steeple
#

oh ok

sick cloud
#

messageReactionAdd

#

afaik

knotty steeple
#

is that eris

sick cloud
#

no discord.js i think

knotty steeple
#

no

#

before

sick cloud
#

oh

earnest phoenix
#

im trying to figure it out

#

I have this error ```#

Fatal error in, line 0

API fatal error

#```

#

Wtf is this?

wanton walrus
#

Then uh

#

Its an api error

knotty steeple
#

discord is being shit

#

again

earnest phoenix
#

Just for me?

#

I uninstall node_modules

#

And i reinstall discord.js

sick cloud
#

that's not a discord.js error

earnest phoenix
#

Why on status.discordapp all status are operational

sick cloud
#

because they are?

earnest phoenix
#

I cant launch discord too

sick cloud
#

your internet is dead or some shit

stable tide
#

anyone here used lavalink with amazon aws?

#

so im hosting lavalink on amazon aws ubuntu 18.04 LTS,

#

i initialise it

#

it does without error

#

but when i try to connect to it i cant

earnest phoenix
#

@earnest phoenix

#

(node:4020) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.

#

What commands you want to make?

#

simple

#

add role

knotty steeple
#

tip

#

show code

earnest phoenix
#

Show your code

#

i tried different code but it didnt work either

#

Role to add

amber fractal
#

That roleatoAdd is a string

earnest phoenix
#

let roleToAdd = message.guild.roles.get('idofrole')

#

@earnest phoenix

#

what the

amber fractal
#

Its not a role or snowflake, like the error said

earnest phoenix
#

h,mmm

#

hmm

#

Wrong channel

#

ima make my app and bot cya yall

amber fractal
#

auf wiedersehen

earnest phoenix
#

Its working? @earnest phoenix

#

sec

knotty steeple
#

or

#

use find()

earnest phoenix
#

No he is want to give a role with a command @knotty steeple

#

the flipping lagggg

#

Just one command for one role

#

it doesnt ffs

#

im off YEET

knotty steeple
#

i know that

earnest phoenix
#

i tried so many things

knotty steeple
earnest phoenix
knotty steeple
#

you can find the role by name and get the id

earnest phoenix
#

how

#

@earnest phoenix you want to make a command exemple !addrole @member <name of role>?

knotty steeple
#

message.guild.roles.find().id

#

in find you have to use a function

#

arrow function

earnest phoenix
#

just, if message is -asd

#

user gets asd role

knotty steeple
#

so like

earnest phoenix
#

message author gets role

knotty steeple
#

role => role.name === "69"

earnest phoenix
#

Ahhhhh

#

Remplace usertomodify to message.author.addRole(roleToAdd)

knotty steeple
earnest phoenix
knotty steeple
#

its the docs

amber fractal
#

:)

earnest phoenix
#

UnhandledPromiseRejectionWarning: TypeError: message.author.addRole is not a function

#

reeeeeeeeee

amber fractal
#

Lol

earnest phoenix
#

what am i doing wrong

knotty steeple
#

message author is a user

#

not guild member

#

the person you are adding the role to must be a guild member

earnest phoenix
#

so, user.addRole?

knotty steeple
#

yes

#

if its a member

earnest phoenix
#

can you give me example

knotty steeple
amber fractal
#

.member works

earnest phoenix
#

user.member

amber fractal
knotty steeple
earnest phoenix
#

message.member

amber fractal
#

That

#

Simplifies it yes

earnest phoenix
#

DeprecationWarning: Collection#find: pass a function instead

knotty steeple
#

refer to my last post

amber fractal
#

Use an arrow function

knotty steeple
#

i linked this did you even read it?

amber fractal
#

Or djs docs collections > find

knotty steeple
#

ok

#

its good to read the mdn docs

amber fractal
#

Youll get more out of mozilla dev page tho

earnest phoenix
#

im reading

#

i get this error

#

DeprecationWarning: Collection#find: pass a function instead

#

but its working ;d

sick cloud
#

don't use 'name', 'name'

#

it's deprecated

amber fractal
#

Deprecation warnings are just warnings, the support for finding without a function is no longer supported

#

It's removed in future versions

earnest phoenix
lament meteor
shadow barn
#

yes

#

if not

#

add !important after the % with a space

#

not outside of the ;

lament meteor
#

what does the important do?

#

i presume overriding stuff

knotty steeple
#

yes

shadow barn
#

overrides any other code

lament meteor
#

ah ok

#

thank u

shadow barn
#

np

lament meteor
#

now i need to make it jump

shadow barn
#

want my float anim?

lament meteor
#

ya

shadow barn
#
.bot-img {
    width: 150px;
    height: 150px;
    box-sizing: border-box;
    border-radius: 50% !important;
    border:2px solid rgba(0,0,0,0.6);
    overflow: hidden;
    box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
    transform: translatey(0px);
    animation: float 6s ease-in-out infinite;
    img { width: 100%; height: auto; }
}
@keyframes float {
    0% {
        box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
        transform: translatey(0px);
    }
    50% {
        box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
        transform: translatey(-20px);
    }
    100% {
        box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
        transform: translatey(0px);
    }
}
#

spoonfeed

#

lol

lament meteor
#

eh...

#

i know how to do it

shadow barn
#

i asked and you said yes shrugs

knotty steeple
#

its css

#

who cares

lament meteor
#

oh i didn't see 'my'

shadow barn
#

xd

lament meteor
#

what is ur bot? i wanna see ur bot page

#

ty

shadow barn
#

removing it now tho

lament meteor
#

looks very nice

shadow barn
#

Thank you

lament meteor
#

tbh... every bot now...

shadow barn
#

floats

#

yeah

lament meteor
#

the bg of the bot page is an anime

shadow barn
#

oh yeah

#

lots of weebs are devs

lament meteor
#

tbh u should hide the donate button

shadow barn
#

cba

#

but maybe

lament meteor
#

ยฏ_(ใƒ„)_/ยฏ

quartz kindle
#

learn css specificity insead of abusing !important lmao

lament meteor
#

lmao

ruby nebula
#

h

flat stratus
#

Can we add our bot log and other shi5?

echo badger
#

How can I award players for voting in my bot?

#

I already have the DBL Api

mossy vine
#

read ๐Ÿ‘ the ๐Ÿ‘ docs ๐Ÿ‘

mossy vine
#

what

knotty steeple
#

wrong channel

vagrant flare
#

i wonder what the context of the roblox picture was

knotty steeple
idle mountain
#

i like how they drew a red circle around the only thing in the image

mossy vine
#

ikr

zinc pawn
#

im trying to set it so if there is no report channel set it will put that string into the embed

west raptor
#

dont use json

#

easy fix

zinc pawn
#

it works if the channel is defined

#

if not then it doesn't

#

i just would like to display that string, im not asking you to tell me to change my storage usage

quartz kindle
#
if(!(rcs[message.guild.id].rc)) {
    let reportsetting = "No report channel defined."
  }```
#

it cant find rc because there is no rcs[guildid]

#

there is an easy hack to fix that

#

(rcs[message.guild.id] || {}).rc

#

basically its a shortcut to checking if rcs[guildid] exists, if not, return an empty object, then check for rc on the result

#

@zinc pawn

zinc pawn
#

thanks

quartz kindle
#

move the reportsetting inside the if

zinc pawn
#

the line 7 bit?

quartz kindle
#

you can set reportsetting as an empty variable, then assign it later depending on the result of the if

#

yeah

zinc pawn
#
    let reportsetting = message.guild.channels.find(c => c.name === rcs[message.guild.id].rc);
    let reportsetting = "No report channel defined."
  }``` that won't work though? reportsetting is defined twice?
quartz kindle
#

dont define it twice

#
let reportsetting;
if(rcexists) {
    reportsetting = rcexists
} else {
    reportsetting = rcdoesntexist
}```
#

or you can simplify it even further

#
let reportsetting = (rcs[message.guild.id] || {}).rc ? valueifrcexists : valueifrcdoesntexist```
#

@zinc pawn

high anchor
#

i've tried following the guilds/[guildID]/members/[memberID] path but that's returning a 404 for put and get

#

oh

#

nevermind

#

i'm an idiot

#

FUCK

knotty steeple
#

@zinc pawn tip

#

dont use json as a database

high anchor
#

tell that to google realtime DB

zinc pawn
#

@knotty steeple I've never heard that one before(!) I'm working on getting it working first then making it neater later

knotty steeple
#

@high anchor waitwhat

earnest phoenix
kind nexus
#

How would I have my bot send a message when someone joins?

#

I'm in C#

bright spear
#

@kind nexus whenever you ask a question always say what lib you're using

#

@earnest phoenix i dont think so but for api help go to #topgg-api (say specifically what the issue is)

high anchor
#

@knotty steeple google cloud realtime DB is a giant json tree

knotty steeple
#

ok

#

rethinkdb results are json

#

is rethinkdb json???

#

oh my god

sick cloud
#

@keen drift see up ^^

#

golib stuff

keen drift
#

@earnest phoenix outdated link

earnest phoenix
#

@keen drift what do you mean?

keen drift
earnest phoenix
#

oh sorry i must have posted the wrong link, i meant the page where you can create tokens, it says i donโ€™t have a bot but i do

keen drift
#

well is it approved

earnest phoenix
#

oh is that why?

#

thanks

knotty steeple
#

what kind of info does the debug event give

#

eris

sick cloud
#

try it

knotty steeple
#

is it like

#

logs events

inner jewel
#

ctrl + f debug

knotty steeple
#

ok thank

high anchor
#

Anyone who uses discord.js online?

#

I'm testing out voice but I'm getting this error:
Error: FFMPEG not found

#

I installed ffmpeg and listed it as a peer dependency but it's still not working

west raptor
#

npm i ffmpeg-binaries

high anchor
#

ah

#

thanks a bunch!

west raptor
#

np

high anchor
west raptor
#

same

high anchor
brittle nova
#

How should I go about in making anti spam? With spam being something like

#

a

#

a

#

aa

#

a

sick cloud
#

on message look for a users last message, ig if its close enough and x+ messages

ember shard
#

How do i make discord bot work?

earnest phoenix
#

You're kidding?

ember shard
#

ahh... no?

earnest phoenix
#

Oh

#

You want to create a bot?

#

And put it online?

ember shard
#

yes

earnest phoenix
#
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('pong');
  }
});

client.login('token');```
#

This is the basic example of discord bot

ember shard
#

?

earnest phoenix
#

Just look videos on youtube or read docs @ember shard

ember shard
#

how do i open JS

earnest phoenix
#

Do you have a text editor? Like atome, visual studio or sublime text?

ember shard
#

will Microsoft word work?

earnest phoenix
#

Hum i dont know i dont try it

ember shard
#

ok

earnest phoenix
#

Just look videos on youtube for creates your first bot and learn a little bit how to make that

ember shard
#

ok

sick cloud
#

lmfao

#

read it

#

it'll teach you how to make a bot

high anchor
#

How do i open js

rocky dagger
#

Has anyone made a contest bot? @dapper cargog or message me.

zinc pawn
#

a contest bot? what do you mean by that @rocky dagger

knotty steeple
#

@ember shard dont start making a bot yet

#

you have to learn the basics of js

#

because you dont even know a text editor to use

bright spear
#

^ to be clear afaik you cannot code in word, try visual studio code or atom

knotty steeple
spring ember
#

@knotty steeple I learned from sololearn but I had experience with programming languages before

#

It's kinda hilarious that the first language I used was php

#

The first I've learned was ASM 16bit

#

I sound old

knotty steeple
#

you should

#

xd

carmine crane
#

how do i get the number of servers my bot is in to show up? domyChu

#

right now it just says N/A

coral trellis
#

@carmine crane What lib did you write it in?

carmine crane
coral trellis
#

Rip I guess I can't help with that one Dabbing

carmine crane
#

rooD how does it work on discord.js? maybe i can work from there

coral trellis
#
const DBL = require('dblapi.js');
const dbl = new DBL(DBLTOKEN);

    dbl.postStats(client.guilds.size)
        .then(() => console.log("Posted Stats"))
        .catch(error => console.log(error))```
carmine crane
coral trellis
#

Indeed

carmine crane
#

thanks for the help! rooAww

coral trellis
#

Didn't do anything No problem rooAww

knotty steeple
#

@carmine crane post to the api yourself

#

with aiohttp

#

pls

#

i think the py library is broken rn

carmine crane
#

oh okay domyChu you've got an example for that maybe?

spring ember
knotty steeple
#

thats depreciated smh

spring ember
#

Yes but he/she wanted an example

bright spear
#

Samurai do u mean deprecated ๐Ÿค”

spring ember
#

angery irrelevant

carmine crane
#

thanks i think i'll be able to manage from there domyAw

amber fractal
#

Should I add dbl api to my bot ๐Ÿค”

topaz fjord
#

Do you want server count on the site?

amber fractal
#

Ill just do it now so I dont have to do it later

#

The only problem is: attempting to install npm modules on a chromebook...

bright spear
#

Don't run ur bot on ur computer smh

amber fractal
#

?

#

I dont

bright spear
#

Why would installing npm modules work tho

amber fractal
#

All my code is on github... I need to install it then upload the file to my node modules

#

thats how I get all my modules

bright spear
#

Also it should probably work anyways since chrome os can run linux apps

amber fractal
#

Its a school chromebook

#

The console is blocked

bright spear
#

don't code on a school Chromebook smh

amber fractal
#

I have nothing else at the momeny

#

moment*

#

Im in the process of buying parts for my new computer

#

I just have to wait for school because they have computers there and I already installed node and git on it

quartz kindle
#

you can easily post your server stats without any module

amber fractal
#

It says I need it tho?

west raptor
#

make the post request your self

amber fractal
#

maybe if I knew anything about it ๐Ÿค”

primal ferry
#

.

quartz kindle
#

that means sending a POST request to the api url

amber fractal
#

Ik, idk how to do it tho, never have

quartz kindle
#

you can use node's http or any http library such as snekfetch/request/etc

amber fractal
#

I still need to download those though, dont i?

quartz kindle
#

not if you use node's own library

lament meteor
#

snekfetch is outdated

amber fractal
#

Ill look into it thanks

quartz kindle
#

check this example

#

scroll down to Giulio Roggero's answer

#

its clean and well commented, while most other answers are basically "use a better library"

amber fractal
#

It gives me error unauthorized, i generated a token just no idea where it goes

sick cloud
#

Authorization header

#

read the docs and you'll know

amber fractal
#

Im in the docs..

#

I read that

#

It doesnt help me

sick cloud
#

then read harder

#

it's all there

amber fractal
#

Ive never done posts or requests before

quartz kindle
#

a header is a separate part of the request

earnest phoenix
#

then read docs rather than diving blind

amber fractal
#

"Im in the docs.."

earnest phoenix
#

but you arent reading them

#

Guys don't be dicks.

#

and no, skimming isnt reading

#

Help him instead of saying the same thing over and over.

quartz kindle
#

show us what you tried @amber fractal

amber fractal
#

Now i have a 301 status code

#

Moved permanently

quartz kindle
#

show the code you tried

amber fractal
#

Trying one last thing

#
		server_count: bot.guilds.size 
	});
	var options = {
		hostname: 'https://discordbots.org/api',
		port: 80,
		path: '/bots/524286767373877253/stats',
		method: 'POST',
		headers: {
			Authorization: dbltoken
		}
		
	};
	var reqPost = http.request(options, (res) =>{
      		console.log("statusCode: ", res.statusCode);
		res.on('data', function(d) {
        		console.info('POST result:\n');
        		process.stdout.write(d);
        		console.info('\n\nPOST completed');
    		});
      	});
	reqPost.write(postData);
	reqPost.end();
	reqPost.on('error', (e) => {
  		console.error(`Error: ${e.message}`);
	});```
new error now tho too `Error: getaddrinfo ENOTFOUND https://discordbots.org/api https://discordbots.org/api:80`
quartz kindle
#

port 80 is http only, https uses port 443

#

also, to use https, you need to use node's https library instead: require("https")

#

i dont remember if dbl accepts http or only https, but in any case its better to use https

#

so ```js
const https = require("https");

req = https.request(options, etc...)```

inner jewel
#

also hostname: 'https://discordbots.org/api',

#

should be just discordbots.org

amber fractal
#

I tried that at first

#

Ill do it again

#

{"error":"Required parameter server_count or shards missing"}

quartz kindle
#

console.log(postData)

#

to make sure its being set correctly

amber fractal
#

Post data: {"server_count":8}

quartz kindle
#

hmm

amber fractal
#

It doesnt need to take the number as a string does it?

#

the server count*

#

no

quartz kindle
#

it should be number

amber fractal
#

Or array of numbers it says, but I dont see the issue

quartz kindle
#

maybe it needs the post body to be in querystring format?

sick cloud
#

content type must be json

amber fractal
#

It is in json

#

Or should be

#

JSON.stringify right?

quartz kindle
#

yeah

#

try adding 'Content-Type': 'application/json' to your headers

amber fractal
#
			Authorization: dbltoken,
			'Content-Type': 'application/json'
		}...```
#

?

#

Like that

quartz kindle
#

yes

amber fractal
#

status code 200

#

it worked then

#

I think

#

POST result: {} POST completed is what my console says

quartz kindle
#

check the website

amber fractal
#

True

#

It worked

#

Thanks for the help

quartz kindle
#

awesome :)

amber fractal
#

And now i know something about posts

prime cliff
#

Thonk why does Content-Type have to be wrapped in ' but Authorization isnt xD

inner jewel
#

because of the -

#

that makes it an invalid identifier

#

so it must be wrapped in quotes

prime cliff
#

Good to note lol

quartz kindle
#

in case of doubt, just wrap everything in quotes

sick cloud
#

'"THINg"': '"YAY things"'

fervent oyster
#

Is there a equivalent to broadcastEval for eris

lament meteor
#

same tbh

lyric talon
#

Hey guys, could someone help me to create a function that send every messages to a log channel ?

#

ty โค

gilded blaze
#

No need for a broadcastEval in Eris. It's only one process which is why you can use the Shard collection stored in the client

fervent oyster
#

Oh, so client.shards or somthin

earnest phoenix
#

raw data for music commands please

amber fractal
west raptor
#

no

#

as that would be spoonfeeding

mossy vine
#

im trying to get all channel ids and names in an array using the code below, but it only pushes the last chanobj a ton of times

#
client.on('ready', () => {
    client.channels.forEach(chan => {
        chanobj.name = client.channels.get(chan.id).name
        chanobj.id = client.channels.get(chan.id).id
        console.log(chanobj)
        chans.push(chanobj)
    })
    console.log(chans)
})ห›```
#

oh nice syntax highlighting discord

#

chans is the array and chanobj is supposed to be temporary

zealous veldt
#

where is chanobj declared?

mossy vine
#

right in the beginning of the code, outside of any scopes

#

as a var

zealous veldt
#

maybe declare it inside of the loop

mossy vine
#

oh thats a good idea

#

heyyy that worked

#

thank you

zealous veldt
#

No problem :)

mossy vine
#

alright, ran into yet another problem

#

appearently client.channels.get('channelid').send('message') doesnt work, when i console.log `client.channels.get('channel.id') it works, but doesnt send anything

knotty steeple
#

library

mossy vine
#

d.js

knotty steeple
#

get the guild then channel

mossy vine
#

but i dont want the guild

knotty steeple
#

try it

mossy vine
#

it wont be u s e r f r i e n d l y

knotty steeple
#

p l s

mossy vine
#

i need to do it like this

knotty steeple
#
client.guilds.get("currentguild").channels.get("channelid").send("hello")``` ![thonkeyes](https://cdn.discordapp.com/emojis/484571491632021505.webp?size=128 "thonkeyes")
mossy vine
#

everything works but .send

#

no i used to be able to do it like this

#

okay im doing that right now and still doesnt work @knotty steeple

#

client.guilds.get(client.channels.get(CHAN).guild.id).channels.get(CHAN).send(ans.message)

#

CHAN is the id if the channel

#

it logs the guild perfectly, logs the channel.get perfectly, but still doesnt .send

#

๐Ÿ˜ฉ

knotty steeple
mossy vine
#

im so fackin confused

#

the bot has send perms and everything

red spade
#

@mossy vine Wouldn't just client.channels.get(CHAN).send("Message") work?

mossy vine
#

i tried that above

#

didnt work

amber fractal
#

Wait what you trying to do?

knotty steeple
#

do people not read the past messages

mossy vine
#

im trying to get the bot to send a message to a specified channel

red spade
#

well I think trying very complicated things isn't gonna help

gilded blaze
#

Is ans.message null?

red spade
#

where do you get the channel from? Is it a channel ID or a complete channel object?

mossy vine
#

nope, ans.message is a perfectly fine string

#

its a channel id

#

as i said above

#

again, everything is perfectly fine except .send

amber fractal
#

"do people not read the past messages" no, we dont. And i cant help if i dont know what it is that they is trying to do, or atleast have an error message

red spade
#

and you're sure the channel id is from a valid text channel where the bot has the right read/write permissions?

mossy vine
#

yes, i am sure

#

it works with a message.channel.send but i am running this in the ready event

gilded blaze
#

Try handling the Promise returned.

#

Look at what it is saying

mossy vine
#

how do i do that?

amber fractal
#

Trying to get all channels by ids and names?

gilded blaze
mossy vine
#

again Steven, client.guilds.get(CHAN.guild.id), client.channels.get(CHAN), client.guilds.get(CHAN.guild.id).get(CHAN) all work perfectly

#

yet .send() doesnt

amber fractal
#

Error?

mossy vine
#

no error

#

it just.. doesnt

gilded blaze
#

It must error if it is not successful

#

You have an error

#

Maybe you are catching the promise rejections and not logging it

amber fractal
#

Must not be logging it

mossy vine
#
client.guilds.get(client.channels.get(CHAN).guild.id).channels.get(CHAN).send(ans.message)```
#

thats all i have