#development

1 messages Β· Page 434 of 1

hexed whale
#

I Can get help ?

brisk notch
#

?

shy verge
#

pls tell us your issue

hexed whale
#

when i play my bot with the name of a music, my bot does not recognize and it even crash. I installed fs, ytdl-core and simple-youtube-api. on discord.js we said it worked and When I restart my bot. The same :/

shy verge
#

something in your code is broken then

#

show code pls

hexed whale
#

My pc is out of order (I almost Peter the screen with this shit troll.) Can I send it to you as soon as I calm down in a private message?

shy verge
#

ok

tall falcon
hexed whale
#

Me actually zoomeyes zoomeyes zoomeyes zoomeyes

west raptor
#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
    
    if(!message.member.hasPermission("MANAGE_MEMBERS")) return message.channel.send("No can do pal!");
    let rMember = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
    if(!rMember) return message.reply("User does not exist!");
    let role = args.join(" ").slice(22);
    if(!role) return message.reply("Specify a role!");
    let gRole = message.guild.roles.find('name', role);
    if(!gRole) return message.reply("Couldn't find role!");

    if(!rMember.roles.has(gRole.id)) return message.reply("They already have that role!");
    await(rMember.addRoles(gRole.id));

    try{
        await rMember.send(`You have been given the role ${gRole.name}`)
    }catch(e){
        message.channel.send(`<@${rMember.id}> has been given the role ${gRole.name}. <@${rMember.id}> If you would like this message in your DMs unlock them!`)
    }
  
    message.channel.send(`<@${message.author.id}>, you gave them that role!`)
}

module.exports.help = {
    name: "addrole"
}

always returns "They already have that role"

earnest phoenix
#

what is this command @west raptor

west raptor
#

addrole

earnest phoenix
#

Oo

#

lol

west raptor
#

ugh

#

this is so annoying

#

nothing is wronggggg

earnest phoenix
#

lol

#

I can't help you. I already don't understand the command.

#

lol

west raptor
#

k

#

it gives a user a role

earnest phoenix
#

yeah I saw but for example for me the commands must have its for example if (msg.content.startsWith("-kick")) { but there is not even a code like that to activate the add rol command

inner jewel
#

if(!rMember.roles.has(gRole.id))

#

read out loud what's written in this line

earnest phoenix
#

yeah ?

#

g is you prefix lol ?

west raptor
#

no

earnest phoenix
#

!r

west raptor
#

what about it

earnest phoenix
#

I'm trying to understand your code.

inner jewel
#

read what it says

#

if not rMember's roles has gRole's id

west raptor
#

;_;

earnest phoenix
#

πŸ€”

#

XD

west raptor
#

thanks

#

@inner jewel

tall falcon
#

When I do this: if(!message.content.startsWith('@' + client.user.username) || message.channel.type == 'dm') && client.user.id != message.author.id) return; the bot doesn't reply when I ping it 😦 but if(!message.content.startsWith('!') return; does

hardy fiber
#

assuming this is JS, you could do if (message.mentions.users.first().id == 'botid') {}

tall falcon
#

yes this is JS

hardy fiber
#

also mentions show up as <@!userid> to the bot

uncut slate
#

<@id> or <@!id>

hardy fiber
#

^

tall falcon
#

ok

#

still new to discord bot development

hardy fiber
#

discord.js has a help server if you need an invite

inner jewel
#

<@!id> is to tell mobile to use nicknames in notifications

#

(the !)

tall falcon
#

yeah that would be helpful

#

@hardy fiber

hardy fiber
#

DMed it

tall falcon
#

didn't get it

hardy fiber
#

how about now?

#

if not ill just send it here

inner jewel
#
hardy fiber
#

They got it

inner jewel
#

go there, scroll down, click discord

rapid olive
#

anyone knows how to change bitrate of audio on opusscript?

sick cloud
#

(https?:\/\/)?(www\.)?(discord\.(gg|li|me|io)|discordapp\.com\/invite)\/.+/
Someone gave that regex code to me somewhere, I was wondering about it. What invite links does it protect against, and is there a way to add certain ones like dis.gd and discord.com invites?

inner jewel
earnest phoenix
#

How to get how many uses a users invites has got (total) in the guild?
(discord.js)

sick cloud
#

I read that wrong. oof.

tepid laurel
#

Thats in my opinion a loss of mem

#

Storing all invites to your cache

#

Especially for uses

#

Every invite on djs has a prop uses which is a clear indicator of how many times the invite has been used

#

You could in my opinion, instead store the invite IDs you deem to track as an key and the uses as its value

#

In a single array, map, obj whatev

#

map would be a simple use for it I guess

#

Which defo lowers your mem usage from it

deep inlet
#

Are bots not allowed to use the provider key in embeds?

inner jewel
#

no

deep inlet
#

Aw

west raptor
#
(node:3640) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).setTitle(...).setUrl is not a function
    at Object.module.exports.run (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\cmds\test.js:8:6)
    at Client.bot.on (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\index.js:67:31)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\fazin\OneDrive\Documents\Coding\Dream-bot-testing\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
(node:3640) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3640) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
uncut slate
#

setUrl

#

setURL

west raptor
#

oof

knotty steeple
#

lol

sick cloud
#

Anyone know of a good file host that can host multiple .mp4 files and has an API?

oblique sequoia
#

the one your about to make

sick cloud
#

.-.

uncut slate
#

if you can get your hands on an OwO key, that'd be pretty great

#

I've used OwO to host files programmatically before

sick cloud
#

owo

#

is that an api thingy? πŸ‘€

uncut slate
#

owo has an API, yes

#

again, if you can get your hands on a key

sick cloud
#

ohk

glossy mason
fluid basin
#

Idk about openload, pretty sure it does have an api

sick cloud
#

@glossy mason ❀

earnest phoenix
#

my api works with any file except cmd/sh/exe and more executables eyeshake

earnest phoenix
#

anyone have any experience with mysql and javascript that can help me really quick please?

#

was wondering if you can UPDATE [table] SET [row]= Math.random() * 31 WHERE [row]= 0

west raptor
#
(node:1711) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): TypeError: kickChannel.send is not a function
earnest phoenix
#

kickChannel doesn't look like a channel

west raptor
#

It's defined

earnest phoenix
#

sure it is but its not a text or dm channel

#

show code

west raptor
#

Lol k

earnest phoenix
#

@earnest phoenix if you want to do it at an SQL level you can use RAND

fluid basin
#

kickChannel is probably not a text channel, most likely something else

#

Or just a raw channel

west raptor
fluid basin
#

Math.round(Math.random() * 31)

earnest phoenix
#

yeah i would want math.floor(math.random) correct?

#

at an SQL level that'd be UPDATE table SET column = FLOOR(RAND() * 31) WHERE column = 0

#

ahhh ok thats where i was going wrong then thank you

glossy mason
#

Yeah, ignore me. Do what @earnest phoenix said instead.

earnest phoenix
#

console log kickChannel before the error occurs

#

that let looks sus

quartz kindle
#

does it work if you do .find().send() ? maybe find() isnt finding it

west raptor
#

It's worked before

#

I haven't changed it any

fluid basin
#

Tbh just use channel ID

#

and store it somewhere

earnest phoenix
#

it should work tho if you aren't messing with it

#

log the var before the error occurs and see what's in it

fluid basin
#

Otherwise it'll break if you change anything

west raptor
#

Gotta wait 15 minutes cause of glitch

#

;_;

fluid basin
#

well if you want to logs messages its better to get a channel by id

west raptor
earnest phoenix
#
(node:1711) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): TypeError: kickChannel.send is not a function
hardy fiber
#

What is stored in kickChannel?

#

The entire channel, the name, the id?

#

@earnest phoenix

quartz kindle
#

lol thats exactly what was being talked about a few moments ago

lime falcon
#

Ugh writing unit test framework for a library not really designed for it is a pain

earnest phoenix
#

Hello, I am french. I speak little english and I cade discord js bit please send command clear tchat svp

fluid basin
#

We can try to help you with your code, but we don't spoonfeed

primal adder
#

someone help

#

i'm trying to change the background

#

but the image is a real working image

#

and it only shows as a white background

#

i can't even scroll

#

it's like my page got a virus all of a sudden

languid dragon
#

What elements are you applying it to

earnest phoenix
languid dragon
#

Makes no difference

earnest phoenix
#

O-o lol

primal adder
#

oh here's my desc btw

#
<link rel="stylesheet" type="text/css" href="https://codepen.io/Joshuliu/pen/eMqppw.css">
<iframe src="https://app-bot.000webhostapp.com"></iframe>```
#

i'm putting it to my bot page

#

the body tag

abstract mango
#

this is just my opinion but uh

primal adder
#

000webhostapp is trash

abstract mango
#

you shouldn't use codepen for permanent css hosting
000webhost is meh last time i tried, idk how it is now

primal adder
#

the problem is that it's been working

languid dragon
#

000webhost user data was leaked not that long ago

#

And you should apply css directly to the page using style tags

earnest phoenix
#

What would the order be so that for example I ban a person or I purge his poster in log?

primal adder
#

i'll try that

#

but the problem is that it's been working but only stopped working today when i changed the url

#

for the background image

#

ok I put everything in a <style> tag but it didn't seem to change anything

earnest phoenix
#

You want to create a code and put an image in it @primal adder

stray wasp
#

@earnest phoenix Yes if your bot is in it.

velvet jackal
#

hi there, my bot reply thing doesn't work. it just replies with a mention

earnest phoenix
#

Js?

#

@velvet jackal

velvet jackal
stray wasp
#

code?

earnest phoenix
#

What is you code?

velvet jackal
#

hang on

earnest phoenix
#

Just that bit

#

Not the whole thing

velvet jackal
stray wasp
#

ok nvm I can't coffeescript

velvet jackal
#

its js

earnest phoenix
#

Why are you making it type?

velvet jackal
#

because it takes some time

spring ember
#

@velvet jackal your.spilt in the second line takes strings

#

Idk what is in there

velvet jackal
#

so its my code and not the api right?

spring ember
#

It is your bot

earnest phoenix
#

I have a ask

#

What would the order be so that for example I ban a person or I purge his poster in log

#

I try to create a log of the bot..

spring ember
#

Wait what?

velvet jackal
#

so whats the code that breaks it?

spring ember
#

What is a poster?

velvet jackal
#

it should work 😦

spring ember
#

@velvet jackal the split

#

I think

velvet jackal
#

whats wrong with the split..?

spring ember
#

You need to give it a string

velvet jackal
#

it is a string?

spring ember
#

Are you getting any errors?

velvet jackal
#

nope it just replies with a mention only

spring ember
#

If yes send the stacktrace

velvet jackal
#

er, i tried fixing it and its giving a response but weird

spring ember
#

Send the current code

velvet jackal
#

hold on πŸ˜„

#

and thats the response now ^^

spring ember
#

What is / +/

fluid basin
#

regez

#

regex**

velvet jackal
#

it was in discordjs.guide to prevent the args thing (with the bot detecting lots of spaces)

#

yeah

spring ember
#

But don't you need to put that in a string?

velvet jackal
#

i don't know

#

i'm just doing what it said

spring ember
#

Nvm

velvet jackal
spring ember
#

Yeah yeah I saw

#

Wow I didn't know that ok

#

Umm tbh the reply is straight out of the api

velvet jackal
fluid basin
#

yes its the neko chatbot

spring ember
#

That is the api

#

Try

velvet jackal
#

.-.

#

so the api is broken..?

fluid basin
#

Its not I suppose?

#

You need to escape that ?

earnest phoenix
#

Nobody can help me?

velvet jackal
#

uhhh

#

idk how

#

since i'm just giving text to the api

#

and responding with text it gives back

solid cliff
fluid basin
#

encodeURI()

velvet jackal
#

oh

#

is that built into js?

solid cliff
#

yes πŸ‘€

velvet jackal
#

ok

#

well i tried it and it doesn't really work

#

msg.reply(decodeURI(body.response));

fluid basin
#

Encode it when you send it, decode it when you receive it

velvet jackal
#

oh i have to encode it when sent

uncut slate
#

@velvet jackal you want to use decodeURIComponent(body.response)

velvet jackal
#

thanks

misty river
#

How do I get a one line embed field, like this?

prime cliff
#

@misty river you cant thats not a field its using bold and this markdown

severe crag
#

ν•œκ΅­μΈμ€ μ•ˆκ³„μ‹ κ°€μš”

quiet bobcat
earnest phoenix
#

Who has already programmed a YouTube play code

misty river
#

@prime cliff It is, I just cropped it

#

Anyway I figured out how to do it

#

Well, someone else told me

earnest phoenix
#

oof

#

I hav

earnest phoenix
#

Why command youtube bug me I think its my connection but which ones have a bot music what connection do you have?

vast bane
#

show ur code

limpid cosmos
#

how can I create a invite link for a server where my bot is

#

?

low rivet
#

library?

earnest phoenix
#

@limpid cosmos

#

It's you ask?

#

@vast bane in pv?

frail kestrel
#

@earnest phoenix no one is gonna give you their code lmao

earnest phoenix
#

No lol

#

πŸ˜‚ πŸ˜‚

#

You don't have understand me

#

I have a code

#

Is fonctionnel

quasi marsh
#

@earnest phoenix for musicbots I recommend lavalink

earnest phoenix
#

Juste 1 problem

#

Lag

quasi marsh
#

Which lib are you using?

earnest phoenix
#

I don't now Why is the cause

#

I use ytdl-core and opussscript

quasi marsh
#

No but for Discord

#

Python?

earnest phoenix
#

Js

restive silo
#

d.js?

#

if you use d.js voice i would recommend using master version since quality is 10x better there and way less cpu usage or an external service like lavalink

earnest phoenix
#

I use just opus script and ytdl-core no api and no d.js

restive silo
#

what lib do you use for your bot then Thenky

#

eris, d.js, d.io or discordia

earnest phoenix
#

Glitch

restive silo
#

no

#

like

#

you need a discord api library to actuall connect to the bot

#

and there are 4 libraries for js

#

you would need to use one if you dont write your custom lib

#

what i guess you dont

fluid basin
restive silo
#

it has some patchy thing to make it work

#

idk

#

never used it

#

but yea its not really usable anymore

fluid basin
#

xD

earnest phoenix
#

πŸ€” πŸ˜…

fluid basin
#

Yes wuts the library

#

Thats the question

restive silo
#

which library do you use

#

look in your package.json or in your code whats in the const Discord = require('lib here')

#

or however you called your Client variable

earnest phoenix
#

discord.js

#

Versiob

#

11.3.2

restive silo
#

yea as i said

#

you should use master or an external service like lavalink

earnest phoenix
#

Const Discord = require('master') πŸ€”

restive silo
#

no install discord.js master version from github (but care master has a lot of breaking changes)

fluid basin
#

yup yup

earnest phoenix
#

What is the best for youtube command?

restive silo
#

"the best"

#

what you mean

earnest phoenix
#

What's best so that it doesn't bug anymore

restive silo
earnest phoenix
#

πŸ€”

restive silo
#

use master of d.js with ytdl-core or use an completly external service like lavalink with a library for your langauge

frail kestrel
#

You can start by learning JS?

restive silo
#

your choice

earnest phoenix
#

Okay I go try

vast bane
fluid basin
#

@restive silo wuts the difference between d.js master and d.js stable voice?

topaz fjord
#

Master is unstable zoomeyes

restive silo
#

master got anotherβ„’ rewrite for voice what doesn't use ffmpeg and node-opus or opuscript for ogg/opus streams (that saves tons of cpu when using youtube as source)

#

this does reduce cpu usage a lot

#

also

#

they improved the system so it doesn't stutter anymore because of the cpu usage

#

i personally still use Lavalink since master voice has some bugs but i remember hydra fixed mostly all big ones

fluid basin
#

owo

restive silo
#

and lavalink can use Youtube, Soundcloud and twitch lewd

#

as sources

fluid basin
#

Time to invest in lavalink nodes

restive silo
#

same

quartz kindle
#

can you stream twitch livestreams?

#

time to watch e-sports in discord

restive silo
#

yes you can

#

Lavalink accepts twitch streams

earnest phoenix
#

@tulip coral

#

I read that if you get certified you can do more changes to the entire bot page such as changing the css of the whole page, etc.
How can you do so?
Would like to change the background of the page from white/black to a color which fits my bot better.

#

@restive silo how rggistre at lavelink?

#

Because He asks me the password lavelink

#

They changed the background of their page

#

but how did they do it?

tulip coral
earnest phoenix
#

mmh ok

#

can't find anything about it @tulip coral

#

the docs are only about the api itself

#

but doesn't write about bot descriptions

tulip coral
#

Pretty sure everything is also showed whenever you click on Edit on the bot page

quasi marsh
#

Editing a bot page is like normal website editing

#

As cert you can also use JS to move elements or fully redesign the page to your liking

#

As long as the buttons are still there

#

Best bet is using the dev console to look for classes and id's

earnest phoenix
#

Guys why I have a error with lavelink?

#

nice thx @quasi marsh

#

/app/node_modules/lavalink/dist/core/Client.js:8

constructor({ password, userID, hosts }) {

              ^

TypeError: Cannot destructure property password of 'undefined' or 'null'.

#

i install lavelink and i have this error

#

gg

#

You don't say?

#

Can we in Js display youtube live ?

solid cliff
#

@earnest phoenix it cant get a password property from a null object

earnest phoenix
#

I put in the password and it still doesn't work

earnest phoenix
#

@solid cliff how did you do that

#

password thing

gilded blaze
#

Put ` around the text you want

earnest phoenix
#

oh ok

#

YOU HAVE AIDS

#

~hi~

slender thistle
gilded blaze
earnest phoenix
#

Ok

#

Unistall other version

uncut slate
#

type your messages in one sentence pls

topaz fjord
#

Upgrade python

#

the answer is in the error

buoyant oak
#
Guys for digital ocean, I created a droplet. I made the SSH private/public keys. I made a user, & disabled root. Installed python3, & then installed discord.py using pip. but I was met with:
async-timeout requires Python '>=3.5.3' but the running Python is 3.5.2
what do I do, please help. I'm desperate.
#

@topaz fjord I tried doing that, however it doesn't go above 3.5.2

slender thistle
#

What is the OS? retardEyes

buoyant oak
#

ubuntu 16.04.4

solid cliff
#

Β―_(ツ)_/Β―

buoyant oak
#

okay still getting it

buoyant oak
#

thank youu @slender thistle

slender thistle
#

I mean, Python 3.6 pretty much is compatible with Discord.py, isn't it?

restive silo
#

with rewrite iirc

slender thistle
#

New Discord.py rewrite update requires Python 3..5.3 and higher. 02Shrug

buoyant oak
#

it says 3.6 installed but it's saying 3.5.2

solid cliff
#

Try python3.6

buoyant oak
#

oh ok

#
Traceback (most recent call last):
  File "/home/yousef/league/CTE/0.28 MAIN.py", line 1, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
#

do I do pip install

#

again

slender thistle
#

Yep. retardEyes

buoyant oak
#

async-timeout requires Python '>=3.5.3' but the running Python is 3.5.2

slender thistle
#

I wonder if python3.6 -m pip install discord.py would work. retardsmile

buoyant oak
#

;-;

#

I'm soRrY I'm TrAsH. tysmmmmmmmmmm

slender thistle
#

That worked? thinkeyboard

buoyant oak
#

seemed to do the trick

slender thistle
buoyant oak
#

xD

earnest phoenix
#

Lol

hot sleet
#

Trying to install canvas
when i import canvas module it response Can't find module

#

Error: Cannot find module 'canvas'

earnest phoenix
#

npm i canvas

hot sleet
#

-_- read what i typed

earnest phoenix
#

O-o lol

#

npm i discord.js

#

And after

#

npm i canvas

hot sleet
#

i have discord.js already

earnest phoenix
#

The upgrade version

hot sleet
#

okay wait

inner jewel
#

install python

hot sleet
#

....

earnest phoenix
#

@inner jewel lol the code is in js

hot sleet
#

i use Js

earnest phoenix
#

It's okay? @hot sleet

#

You upgrade

inner jewel
#

@earnest phoenix read the error

hot sleet
#

wait till i check

inner jewel
#

it can't find python

#

node-gyp requires python

hot sleet
#

python but i use js lang

earnest phoenix
#

Ah

#

Lol

#

No see

hot sleet
#

@inner jewel will it work when i install python

#

?

inner jewel
hot sleet
#

even when i use Javascript

#

??

inner jewel
#

yes

#

node-gyp requires python to build

hot sleet
#

okay ..

earnest phoenix
#

I have this body:

    body {
        background: linear-gradient(270deg, #363b74, #673888, #ef4f91, #c79dd7, #4d1b7b);
        background-size: 1000% 1000%;
        -webkit-animation: AnimationName 30s ease infinite;
        -moz-animation: AnimationName 30s ease infinite;
        -o-animation: AnimationName 30s ease infinite;
        animation: AnimationName 30s ease infinite;
    } !important;

But for some reason it won't change the background on discordbots even though I have the !important tag.
What am I doing wrong?

quartz kindle
#

i dont think you can do that

#

you have to put the !important tag in every css rule

#

at least i havent seen it used that way yet

earnest phoenix
#

I did that, too, but it still won't work on DiscordBots

#

Do you know why? @quartz kindle

quartz kindle
#

idk about the animation, but the background works for me, at least it does in the console

frail terrace
#

does anyone know how to use reactions to turn pages in c#/discord.net?

#

i've been trying to work it out but the best solution i came up with is to somehow return something from an event handler

glossy mason
brisk notch
#

javascript pls

idle mountain
#

^that seems cool and tbh im gonna look at that bingSip the way I did it was like this:

  1. On the message send, react with whatever emojis are required for paging (like β¬… and ➑)
  2. Listen to reactions in an event. If they both are the same emojis you reacted with (these can be hard-coded idk) and they are on a message you sent (this can be done pretty easily, just put something unique to that command (like a "this is a paginated command for help" or something) and then check for it on the reaction)
#

then edit

#

i don't know where to put that last parenthesis

#

but yeah you should probably use that addon

glossy mason
#

I've never used this addon myself, so I can't vouch for how good it is, but it has a whole 10 stars.

idle mountain
#

bc it's made by the d.net devs

frail terrace
#

i use that addon already and didn't realize that that's how the paginated stuff works

#

let's see if it uses reactions

idle mountain
#

Well my system doesn't use the addon

#

if that's what you're thinking

#

i've no idea how the addon works bingSip

frail terrace
#

i do

#

but just the "NextMessageAsync"

earnest phoenix
#

Sorry I'm in Phone lol i Require screen

quartz kindle
#

thats basically how i did my pagination, listen to reactioncollector on that message and edit based on reacted emoji

earnest phoenix
#

Nobody ca' help me I pm

#

My code is not valid I don't now who

#

What *

grizzled isle
#

@earnest phoenix You have to do something like:

class Citation extends server{
    // Code here
}
module.exports = Citation

Thats how I have my bot set up

earnest phoenix
#

You can verif my code?

grizzled isle
#

I can't verify your code. That's something you have to do on your own

earnest phoenix
#

Okay np :)

quartz kindle
#

i dont use module.exports so i cant help you there

earnest phoenix
#

Np guys

keen anvil
#

less about development, more about trivia logic but

#

there are 3 difficulties for trivia. Should the hardest have MORE or LESS time to answer than the easier questions? On one hand, less makes sense because it's harder, but more also makes sense?

grizzled isle
#

just have three different categories, one for easy, other for medium and expert and assign it to a question.

keen anvil
#

I, I am

#

I'm talking about the time on the timer to answer

#

lets say easy has 10 seconds, should harder questions have 5 seconds or 15 seconds

quartz kindle
#

id say make time configurable

#

and leave difficulty for questions only

keen anvil
#

Well these give you currency, so I'm trying to regulate how balanced the currency stays. I'll probably just make them all the same time amount

quartz kindle
#

you could link the timer to currency as well

#

lower timer = bigger reward

keen anvil
#

that's a good idea

#

thanks

austere meadow
#

make it be like kahoot where the amount you earn goes down as the timer ticks :^)))

fluid basin
sturdy edge
#

How do you get your bot to change its name and PFP to mimic a user in discord.js?

#

Like what UnbelievableBoat does with the suggestions.

fluid basin
#

Depends on your lib

#

And it should be pretty clearly stated in the docs of your lib

solid cliff
#

Webhooks mby mm

sturdy edge
#

I want to do that. I'm using Discord.js but I don't know what that function is even called

#

If someone could guide me to the general area where I might find that info I would greatly appreciate that! ❀

sturdy edge
#

I don't think that is what I'm looking for. I think that the bot does that without webhooks

#

The owner won't tell me how it does it though

#

Or at least give me a hint

solid cliff
#

If it doesn't use webhooks and changes the bots avatar + name, it would be ratelimited on nickname and avatar change and would also reset back to the same avatar on client refresh. Webhooks can post a custom name and avatar through 1 webhook

sturdy edge
#

Right

#

So, the bot adds a webhook every time it does that?

#

Actually, that just might make sense

solid cliff
#

It just needs 1 webhook

sturdy edge
#

Wait... really?

solid cliff
#

Avatar and name can be changed on post

sturdy edge
#

It's not ratelimited?

solid cliff
#

With the same webhook diff name

sturdy edge
#

Ok. I see now

#

That's pretty cool

#

I wanted to do it but I couldn't figure out the ratelimiting

#

Thanks for the explanation!

violet wyvern
#

\😎

#

Empty message

austere meadow
#

for any d.js master experts out there, what's the point of this new property deleted and why is it on all of the main structures like GuildMember and Role? https://please.zbot.me/kZinmQfN.png

stray wasp
#

GWqlabsThinkLol makes no sense

#

Maybe if there is a event triggered like a member joined you can check if the role exists I guess with one line extra

gilded blaze
#

Probably for cached or stored Member/Role Objects

#

Actually na

austere meadow
#

and this is the same for all of the structures

gilded blaze
#

oh

#

Still being developed?

stray wasp
#

d.js's internal code makes no sense to me either lmao

gilded blaze
austere meadow
#

ah thanks

#

i was looking for a commit like that

gilded blaze
#

πŸ‘

fluid basin
#

Anyone knows a good console logger for nodejs with color?

stray wasp
#

@fluid basin

#

Something like this maybe? I haven't used it but just a idea.

fluid basin
#

Yeah but I mean a logging library to handle log messages

#

like info, warn, error and debug events

stray wasp
#

Oh yeah nah

#

sorry

restive silo
#

@austere meadow its true when it got deleted on discord.

#

like emojis

#

there was no way to tell if that emoji got deleted from the object itself

#

and when you try to fetch an deleted emoji it would error

austere meadow
#

oh okay

#

wasn't aware of that

#

i thought if you fetched a deleted object it would just return null

restive silo
#

no it returns an error

astral pier
abstract mango
#

i was about to link that

fluid basin
#

O.o

abstract mango
#

it seems pretty nice

astral pier
#

I was faster GWmythsBlobGlare

abstract mango
#

same

earnest phoenix
#

who is this (node:9868) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
(node:9868) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 guildMemberAdd listeners added. Use emitter.setMaxListeners() to increase limit

tulip snow
#

Anyone know java? Im getting this error when I try and load my plugin Could not load 'plugins\og.jar' in folder 'plugins': Restricted Name

gusty topaz
#

@earnest phoenix you have 11 client.on("message")

#

Why not have just 1?

earnest phoenix
#

O-o I have 11 lol πŸ€”

fluid basin
#

Yea put them together under one, @earnest phoenix

earnest phoenix
#

I don't have see lol

fluid basin
#

You can use if ... else if... else

spice magnet
#

if I want to replace undefined, i needs to be "undefined" or undefined?

#

like... its 'status code' or text?

austere meadow
#

what?

#

are you trying to use .replace() on undefined? @spice magnet

spice magnet
#

yes @austere meadow

austere meadow
#

that's not possible

#

you can only use .replace() on Strings

#

unless you're talking about undefined inside of a string

#

like "hello this is undefined"

#

(notice the quotes)

#

undefined has it's own type separate from strings

sinful lotus
#
const Haruna = require('eris');
const fs = require('fs');
const config  = require('./harunaconfig.json');

const client = new Haruna(config.token);
// Binding it all to client to make it cleaner somehow
client.ytapi = require('simple-youtube-api');
client.ytdl = require('ytdl-core');
client.youtube = new client.ytapi(config.ytkey);
client.commands = new Map();

is it ok to bind stuffs in client? for a cleaner code

quartz kindle
#

if you're 100% sure those namespaces will never be used, it should be fine. but i wouldnt do something like that

#

its basically making a mess out of the hierarchy

#

if you wanna do something like that while keeping the hierarchy intact, you could make your own superglobal and assign everything to it

earnest phoenix
#

you could use global but its kinda meh, why don't you just export w/e you want and import the file from w/e you wanna use those

#

you just mind circular dependencies a bit and it will be just fine

uncut slate
#

globals are a horrible practice

#

generally I wouldn't bind requires to anything at all, just have them at the top of your file

#

and don't worry about the overhead from having to re-require modules, as require cache will take care of that

#

you could just

const { Client } = require('eris');
const fs = require('fs');
const config = require('...');
const YoutubeAPI = require('simple-youtube-api');

class Haruna extends Client {
  constructor (token, options) {
    super(token, options);

    this.config = config;
    this.commands = new Map();
    this.yt = new YoutubeAPI(config.ytkey);
  }
}

const client = new Haruna(config.token);
#

(possibly split the Haruna class into a different file)

sinful lotus
#

I see, got it thanks

quartz kindle
#

gotta learn how to use classes xD

austere meadow
#

does anyone know a way to manually call sendMessage or createMessage in d.js master

spring ember
#

like from a subclass?

#

what do you mean manually?

austere meadow
#

theres probably another way to stop it but look its 1am

spring ember
#

you are overriding a method?

austere meadow
#

yes

spring ember
#

umm why do you need sendMessage?

austere meadow
#

because message.channel.send() calls sendMessage

spring ember
#

what happens if you change sendMessage directly?

austere meadow
#

i couldn't find an easy way to do that

topaz fjord
#

Can you directly access Shared?

austere meadow
#

not from my knowledge

#

i can't access it using deconstructing

topaz fjord
#

Not with the / in require?

austere meadow
#

eh ill try that

#

didn't think of that tbh

spring ember
#

maybe call sendMessage yourself but with your stuff?

topaz fjord
#

Just to locate the folder it's in

#

Then do require('discord.js/whatever/folder/its/in')

spring ember
#

or add an event when you write a message, edit it to your liking mmLol

austere meadow
#

im pretty sure that doesn't work @topaz fjord

#

i dont know what you're saying @spring ember lmao

#

yes pretty good

austere meadow
#

@restive silo i can't seem to extend Message properly when trying to extend message.reply, i just get TypeError: message.zreply is not a function https://please.zbot.me/x0uZPXWV.png

#

oh fuck

#

im so dumb

#

ok im so sorry

#

lmfao

#

thank you for reminding me hart

restive silo
void mantle
#

I made this beautiful html thingy for my bot so i can put that in the description but when i use the same code there it looks like shit :?
And idk why. im still a beginner in html btw

#

😭

granite hedge
#

so that it is Invite and Support server?

spring ember
#

it's a part of markdown

void mantle
#
            background: -webkit-linear-gradient(left, #ff69b4, #8d1cff);
            background: linear-gradient(to right, #ff69b4, #8d1cff);
#

my background color is not working :?

proud folio
#

When i stary my DBM Bot in CMD i get this

mystic lotus
#

😐

proud folio
#

Im screwed

hexed whale
#

Hello, when I execute my order, my bot connects then disconnects... Can I get some help?

west raptor
#

How would i pick a random line from a txt/pastebin then dm a user that line?

knotty steeple
#

wdym

#

for what

west raptor
#

codes

quasi marsh
#

Is this pastebin supposed to be edited?

#

By others

#

Otherwise I'd say put it in a json and get a random line

knotty steeple
#

yes

west raptor
#

how

quasi marsh
#

Like load responses.json and the name will be a number

knotty steeple
#

require the json

#

have the lines in an array

quasi marsh
#

And you choose a random number

knotty steeple
#

with Math.random

quasi marsh
#

Yeah could do that

#

There's probably something like random.choice

#

To choose a random item from an array

knotty steeple
#

nah

quasi marsh
#

I mean in Python it's just random.choice

knotty steeple
#

Math.random * howmuchitems_in_the_array

quasi marsh
#

Could do that

knotty steeple
#

so you gotta round it

west raptor
#

yeah

#

i know

sinful copper
#

Would that work?

knotty steeple
#

what

sinful copper
#

Unless it goes into decimals

knotty steeple
#

it does go into decimals

sinful copper
#

oh kk

knotty steeple
#

thats why i said you have to round it

sinful copper
#

ye sry

west raptor
#

like Math.floor(Math.random * (number))

knotty steeple
#

no

#

well almost

west raptor
#

how

#

math.floor rounds to nearest whole number

knotty steeple
#

Math.random * (number)

#

this is the problem

west raptor
#

how

knotty steeple
#

Math.random is a function

#

so just Math.random() * (number)

#

but remove () around number

west raptor
#

oof

#

i forgot about that

#

alright so how would i get it to send the user the text on the line

knotty steeple
#

have the lines in an array

#

preferably in a json file

#

then just require that json file and whatever you have defined as you array in that json just do whateveryoudefinedjsonas.yourarray[TheRandomThing] :v

earnest phoenix
restive silo
#

make sure you use the correct token

earnest phoenix
#

yes i am

#

fixed it

granite hedge
earnest phoenix
#

no that’s an discord error with Arabic text

sick cloud
#

leave the server? :^)

granite hedge
#

I was hoping on a more user friendly way xd but ok

earnest phoenix
#

I have a bot setup with an events folder and a commands folder, how would i go about making it so my command scripts are linked to the message event in Node?

#

I'm using djs

#

I have a ready event in the events folder and one for the message event too

#

But I want to know how would I integrate the commands

sick cloud
#

Command handler. There's a few guides floating around.

earnest phoenix
#

Do i rly need to read the whole thing

#

Because i already know to do the events

#

I just need help with the individual commands

sick cloud
#

Yeah, both guides will show you how to do commands and the other things.

#

plus, you code could be different so we can't give code and it'll work.

knotty steeple
#

i get Error: Could not locate the bindings file. when i try to require better-sqlite3

#

why?

#

and how to fix

high lava
#

npm i node-gyp
cd node_modules
node-gyp rebuild
then
npm i package-name

#

Try that. looks like it could just be a Node-gyp problem. Not better-sqlite3

earnest phoenix
#

@high lava no

keen drift
knotty steeple
#

how is this related to bot development zoomeyes

keen drift
#

I'm developing the bot's... page

knotty steeple
keen drift
south finch
graceful rock
#

ub!!

#

ub!!help

#

ub!!help

#

ub!help

#

ub! ! help

#

.-.

#

@earnest phoenix

#

ub!!help

#

ub!!help

#

.-.

south finch
#

go to testing channels

sick cloud
#

So I have an array with this kind of layout:
watchChannels: => [{ channel: <>, guild: <> }, { channel: <>, guild: <> }]
..and there are multiple entries.

I'm adding them all on the ready event(discord.js) like so:

watchChannels.push({ channel: c, guild: g.id });```
..and I was wondering how do I access them? Do I do it like this maybe?
```js
watchChannels[{ channel: <> }]```
I'm totally unsure, so any help is appreciated. Thanks :3
uncut slate
sick cloud
#

Thanks o:

hexed whale
#

Hello, when I execute my order, my bot connects then disconnects... Can I get some help?

gilded blaze
#

Have you checked the error

#

Also wouldn't use ytdl. Old and buggy.

hexed whale
#

the problem is that on my console I have no error

velvet jackal
#
try {/*code*/} catch(err) {console.error(err)}```
#

put your code in a try

#

then if it errors console will get an error

#

@gilded blaze ytdl is not old and buggy, its the best. and its getInfo is just crazy

spring ember
#

@velvet jackal if no error was thrown during runtime it won't throw in a try catch

velvet jackal
#

oh ok

#

its resolved it for me sometimes

sinful lotus
#

@hexed whale promises inside an async function, that isnt awaited will cause that

neat pelican
#

guys

#

who know reply command?

earnest phoenix
#

how to get guilds id with evenbot.on("ready",?
cz message.guild.id message not defined

halcyon torrent
#

wdym? which guild(s) do you actually want to get?

hexed whale
#

Ok thanks @sinful lotus

old glade
#

little question

#

if I quit the discord server

#

will my bot be unlisted from the website ?

restive silo
#

no but you dont recieve any updates on if your bot is muted/kicked/deleted

old glade
#

I see

#

thank you for the answer

restive silo
#

np thumbUp

earnest phoenix
#
    if Regex_IsMatch(Message, "[.*]?invite&s;link[.*]?") == true then
        return {empty=false, message = "https://nicolediscord.wordpress.com/"}
    else
        return {empty = true}
    end
end```
#

One of Nicole's modules

#

I have to figure out a way to make her only enable an NSFW module in only an NSFW channel

quasi marsh
#

Check the nsfw property on a GuildTextChannel

earnest phoenix
#

x.x how would i get her to check that?

quasi marsh
#

Are you using Discordia?

earnest phoenix
#

Discordia? Don't think so, she's using a lua reader

quasi marsh
#

Hmm

earnest phoenix
#

Hmmm I'll look into this further and see what I can do

quasi marsh
#

You could do a GET on /channels/Channel_ID

#

Send a header with {'Authorization' : 'Bot your_token_here'}

#

And read the nsfw property from the returned JSON

earnest phoenix
#

Well, she's not using JSON, she's using LUA

quasi marsh
#

JSON is mostly used for web requests

#

It's a default for getting data from webapi's

#
{
"key": "name",
"nested" : {"key": "name"},
"array" : ["key", "key2"]
}
#

Looks like this

earnest phoenix
#

nods

quasi marsh
#

So make a request like this, and you can fetch the nsfw property if the way you interface with discord doesn't allow this natively

#

Note the second to last line with the nsfw property

elfin bane
#

What’s the git

earnest phoenix
#

Whats the git?

#

Huh?

#

What?

elfin bane
#

Didn’t Donkku say to learn about the git

earnest phoenix
#

Oh yea

elfin bane
#

So I asked what it was

earnest phoenix
#

Err

spring ember
#

Learn about git

#

Not the git

earnest phoenix
#

How do i explain whats git

#

Umm

#

Its a place where people store code

spring ember
#

Git is a version source control system

earnest phoenix
#

Ok yea thats better

elfin bane
#

Uh ok...

spring ember
#

It allows you to branch your code and work efficiently with your team

#

It's also a great place to store code

elfin bane
#

lol what if ur working alone

spring ember
#

Doesn't matter

earnest phoenix
#

Oh i found it

spring ember
#

I am almost always working alone GWfroggySadCat

elfin bane
#

And why can’t I just save the code to my computer

earnest phoenix
#

You can

#

Why not

#

Saving it to your computer is if yoy want to run your bot locally

#

To make a discord bot run, your machine that stores the code must be online

elfin bane
#

Oh ok

spring ember
#

That is unrelated to git though

earnest phoenix
#

People store the code in github cause they want to deploy their code to another external server or vps

#

Yea

#

True

elfin bane
#

So why do I need this to start programming?

earnest phoenix
#

You don't

elfin bane
#

Oh

spring ember
#

Idk I put code there to version everything and keep it simple

#

Also it is easy to transfer between devices

elfin bane
#

ok

#

So I download git right?

spring ember
#

You download a client

#

You can have a repo on GitHub or GitLab or BitBucket

earnest phoenix
#

A repo is a place to store your code

elfin bane
#

Where do I download the client from?

earnest phoenix
#

There are many git client around

#

Just search it up on the net and see which one you want

#

Somebody help me please
i have problem with check permissions in cog
I write bot in Python

#

I haven't learnt python yet...sorry can't help

#

k no problem

elfin bane
#

GUI client

#

?

earnest phoenix
#

For what?

#

Git client

elfin bane
#

I found this...Git for windows

earnest phoenix
#

Yea that works

elfin bane
#

k

#

What do I do here

#

it gives me 3 options. Use git from Git Bash only
Use git from windows command prompt
Use git and optional Unix tools from windows command promt

#

@earnest phoenix k I downloaded the git. What next?

earnest phoenix
#

? Whats next?

elfin bane
#

What do I do now

earnest phoenix
#

just start coding your bot first

#

You can worry about git later on

elfin bane
#

it says : Launch Git Bash

#

do I do that?

earnest phoenix
#

Isn't git bash for linux?

elfin bane
#

I mean the site I’m on is git for windows

earnest phoenix
#

Oh wow

elfin bane
#

Want me to send a pic. Maybe that will help

earnest phoenix
#

Git for windows actually has a git bash emulator

elfin bane
#

Emulator? For a git

earnest phoenix
#

Nothing i am talking to myself

#

Umm just start coding your bot first

elfin bane
#

I’m confused I thought emulators were for like old gaming console

#

Ok

#

so I open Vs code?

earnest phoenix
#

Nah emulators are fro everythinf

#

Everything

#

Yea go ahead start using vs code to code

elfin bane
#

K

earnest phoenix
#

Rivan

subtle steeple
#

Aye hello?

#

Anyone here know much about rethinkdb? I got a issue i can’t seem to figure out, I’m either dumb or just stuck

uncut slate
#

just ask your question

subtle steeple
#

Alright, so i've made my rethinkdb in a db.js file, which has functions, for example: addGuild, deleteGuild, guildSettings etc, then i'm exporting that and using that in the command handler, everything seems to work apart from it returning undefined when i do like delixdb.guildSettings(guild).prefix, and when i do the same but having that function in an async/await it returns Promise { <promise> }

#

Any idea on how to fix it? I'm either dumb or i've fucked it up

earnest phoenix
#

because it returns a promise

#

do you know what promise is?

gilded blaze
#

Promises occur due to JavaScript being asynchronous.

earnest phoenix
#

instead of .then you can do await

subtle steeple
#

Yeah, i looked into that and tried it makes no different

earnest phoenix
#

do something like let guild = await delixdb.guildSettings

#

then for prefix do guild.prefix

subtle steeple
#

so your saying use an async in the function & use it in the command?

earnest phoenix
#

not in the fuction

#

if you’re on about the function in that image you sent

subtle steeple
#

Yeah

earnest phoenix
#

use what i said in the command

subtle steeple
#

Yeah don't work either

subtle steeple
#

Just returns undefined man

earnest phoenix
#

how to create a invite link with guild id in discord.js?

pale marsh
#

@earnest phoenix yeah Git for Windows installs cygwin as well

earnest phoenix
#

That's nice

#

πŸ€”

abstract crystal
#

@earnest phoenix with only guild id you can't

#

do you mean how to generate a invite link for a specified guild, please note that you need to have permissions for that

earnest phoenix
#

ok

#

but how to make?

#

πŸ€”

#

@abstract crystal

little bluff
#

on giving permissions

earnest phoenix
#

on giving permissions sorry i hadn't understood what do you mean πŸ€”

little bluff
#

like this

granite hedge
#

updating a message every 60 seconds is not considered spamming the api right?

abstract crystal
earnest phoenix
#

explain please πŸ€”

little bluff
#

click on ur sever settings choose the channel and user, then edit their permissions

earnest phoenix
#

in my server all can make invite links

abstract crystal
#

OwO, get a channel from the guild then call the createInvite method and ur done

little bluff
#

what's OwO

earnest phoenix
#

how to get channel from the guild? πŸ€”

#

I am fully new at making bots

granite hedge
#

guild.channel

abstract crystal
#

^

earnest phoenix
#

example?

granite hedge
#

if you have a message event, and want the channel the message was send in you can do msg.channel

#
    console.log(msg.channel.id)
})
earnest phoenix
#

I want my bot to make a invite link of specific guild when i message is sent from other guild

granite hedge
#

oh

#

yeah that's easy

earnest phoenix
#

but idk how to do that πŸ€”

granite hedge
#
var parrot= bot.guilds.find(g => g.id == "448434988333924353")
var channel = parrot.channels.find(c => c.id == "457160657473896448")
channel.send(`Inviteurl`)
little bluff
#

@abstract crystal omfg

#

why

#

look

abstract crystal
#

u wot

granite hedge
#

Parrot is in this case the guild you want to send it to, channel is the channel

#

bot is the client

earnest phoenix
#

where's the invite code?

little bluff
#

read

abstract crystal
#

pls not here

little bluff
#

demon

#

read

abstract crystal
#

ik

earnest phoenix
#

πŸ€”

little bluff
#

read that nani

earnest phoenix
#

I meant i want my bot to make the invite code @granite hedge

little bluff
#

just look it up

#

if I learned how to make a small payload, then you can learn how to make that invite code

granite hedge
#
channelguild1.createInvite().then(invite => channelguild2.send(`I was added to ${guild.name}, invite: ${invite.url}`)).catch(console.error);
abstract crystal
#

@earnest phoenix PLEASEEE just read the docs
Helpful links:
https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/
https://discord.js.org/#/docs

earnest phoenix
#

πŸ€”

little bluff
#

@abstract crystal weeb

abstract crystal
granite hedge
#

yeah you will have to learn to work with the docs

little bluff
#

it's kinda hard at first

abstract crystal
#

keep in mind that docs can be hard to navigate through at first, but when you know your way around they become your friend

little bluff
#

sometimes

#

spent an hour making a bot but it wasn't friendly

#

lost all that work tho

abstract crystal
earnest phoenix
#

url looks perfect for me πŸ€”

#

lol

little bluff
#

uh

#

a

#

where do I go to select a song

elfin bane
#

Im achieved lol

#

I made a bot where when someone says cookie a cookie emoji pops up and when I say milk a milk emoji pops up

cold harness
#

omg why

keen drift
#

sounds

#

useful

elfin bane
#

Just bcs

#

it’s very useful. What’s more useful then fun...cookies!

topaz fjord
#

have fun getting your bot that mute if your bot gets in the server

trim plinth
abstract crystal
trim plinth
#

ty

abstract crystal
#

np uwuwu

vale gull
#

how to do a ban command

abstract crystal
#

check the docs please

granite hedge
#

anyone got a forever restart command working?

knotty steeple
#

just process.exit

#

it should restart

vale gull
#

how
to
do
a
ban
command

keen drift
#

the d o c s

vale gull
#

k

knotty steeple
#

@vale gull you didnt even say language

#

or library

vale gull
#

ok

keen drift
jovial sigil
#

Maybe you have ad blocker?

#

And that's an ad shown as blocked?

bitter sundial
#

no ads are there

#

I dont see a line there

jovial sigil
#

What's the website? Can try to see if I see it too

earnest phoenix
#

its the bg image

#

its visible in higher / wide res

#

and if you open the bg image in chrome it'll hide them because the bg is dark and they blend in xD

elfin bane
#

@topaz fjord I have no idea what u were trying to say other then have fun so...thanks?

earnest phoenix
west raptor
#

when i try to install quick.db (npm i quick.db) it returns an error

knotty steeple
#

what is the error

west raptor
#

its above char limit