#development

1 messages · Page 492 of 1

slender thistle
#

I ain't a JS coder plznoblame

earnest phoenix
#

new ClassName is pretty common

slender thistle
#

Haven't seen that before, my bad.

limpid cosmos
#

@earnest phoenix npm i ffmpeg

#

and npm i ffmpeg-binaries

earnest phoenix
#

if u use debian package manager you can run sudo apt install ffmpeg

restive silo
#

thats you posting wrong stats to dbl api

earnest phoenix
#

ok srry

frank dust
inner jewel
#

bots can't have rich presence

frank dust
#

no, I mean the users rich presence details

#

how to get the time elapsed/left

earnest phoenix
#

What do you do with JDA then?

frank dust
#

wut

earnest phoenix
#

anyone know how to get this in JDA?

frank dust
#

I want to get the time elapsed/time left from a users rich presence details

earnest phoenix
#

They you need to be more clear from the start

frank dust
#

I thought it was pretty clear from me highlighting the time left in the image

earnest phoenix
#

You didn't mention that you want to get if from users' RP

frank dust
#

well where else was I gonna get it from?

earnest phoenix
#

As for me, I thought you are having issues with Google Play Music and were asking how to show time elapsed XD

#

I apologize then

inner jewel
#

Member#getGame()
Game#asRichPresence()

earnest phoenix
#

my first three shards are unresponsive, but everything else is fine

#

tried restarting machine

#

running 8 shards

inner jewel
#

what language?

earnest phoenix
#

i asked in the d.py server but they said it's likely a discord issue

#

it'd be documented and fixed by now though

#

this has been happening a few days

#

no errors

stuck ravine
#

Do you know how to automatically update its status please?

earnest phoenix
#

What do you mean by that

#

yes?

#

i can update statuses

lusty dew
#
(node:7940) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined
    at Url.parse (url.js:150:11)
    at Object.urlParse [as parse] (url.js:144:13)
    at Snekfetch.buildRequest (C:\Users\User\Desktop\No name\node_modules\snekfetch\src\node\index.js:27:23)
    at new Snekfetch (C:\Users\User\Desktop\No name\node_modules\snekfetch\src\index.js:36:43)
    at Function.runMethod [as get] (C:\Users\User\Desktop\No name\node_modules\snekfetch\src\index.js:247:12)
    at randomPuppy.then.url (C:\Users\User\Desktop\No name\commands\furry_nsfw.js:19:17)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:7940) 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:7940) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process witha non-zero exit code.
#

I can't seem to figure this out

real ocean
#

Make sure that the url you're passing in is a string?

lusty dew
#

I tried console logging it

#

It wouldn't return anything

#

Just that error

real ocean
#

If it's not returning anything that's because the string is empty...

#

What's your code?

lusty dew
#

No I mean

#

Sigh*

#

The code stops somwhere

#

I just don't know where

#

So where ever it stops is before the console log

#

So the console log won't even work

west raptor
#

log it as soon as you can

real ocean
#

Check the stack trace

lusty dew
#

Ok so I logged something else as a test so I know where the code stops now

real ocean
#

What's the line that makes it error?

lusty dew
#

Ok

#

So it works 2 times

#

then it stops

#

undefined

#

I get that when it stops working

real ocean
#

I can't help you if you won't show what the code is doing

lusty dew
#

Ok

#
const randomPuppy = require('random-puppy');
const request = require('snekfetch');
const fs = require("fs");
const Discord = require("discord.js")

module.exports.run = async (client, message, args, ops) => {
    if(!message.channel.nsfw) return message.reply(`Sorry NSFW commands can only be used in NSFW Marked channels!`)

    let subreddits = [
        "yiff",
        "Furryporndump",
        "Furry_Porn"
    ]

    let sub = subreddits[Math.round(Math.random() * (subreddits.length - 1))]

    
    randomPuppy(sub)
    .then(url => {
        console.log(url)
        request.get(url).then(r => {
            let PokePornembed = new Discord.RichEmbed()
            .setDescription(`${message.author.tag} here is your Furry porn`)
            .setColor("#00ff00")
            .setImage(url)
            .setTimestamp()
            .setFooter(`Command made using Reddit`)

            message.channel.send(PokePornembed)
        })
    })
}
module.exports.help = {
    names: ["furry-porn", "yiff"]
}
real ocean
#

Which line does it break on?

lusty dew
#

I don't know now :/

#

It worked 2 times

#

I may have a theory of why this isn't working though

real ocean
#

i have a feeling that for whatever reason, url is becoming undefined

#

so when you try to request.get(url) its breaking

#

either try and fix what ever is making url go undefined or just check to make sure url isn't undefined before you do the request

lusty dew
#

I have url console logging before it requests it

#

oof

#

No

#

I get that stuff

#

I get the links

#

BUT I was thinking

#

What if it is cause the stuff I am trying to get

#

is a video?

#

Cause it is reddit there are those types of things

real ocean
#

yeah its logging undefined and then breaking, and that could be it lol

lusty dew
#

Well

#

It isn't breaking per say

#

Not anymore at least

#

You can use the command again and it works

#

I just didn't know why I got that error now I think I know why

#

@real ocean Is there a way I can embed a video? Like not the actual video it's self

#

I am trying to make a Pornhub command, I saw a bot called NSFWbot do that

earnest phoenix
real ocean
#

uh you can put a video inside an embed without uploading it afaik?

#

you might need to link to the actual video though, not the page

cosmic swallow
#

anyone into py async ?

#

when yes mention me !!

lusty dew
#
RangeError: Maximum call stack size exceeded
    at rand (C:\Users\User\node_modules\unique-random\index.js:4:22)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\node_modules\unique-random\index.js:6:47)
#

I got this error

real ocean
#

a function is calling itself recursively and failing to achieve anything

lusty dew
#

oof

#

How can I stop these errors?

real ocean
#

make sure that whatever line youre doing random stuff on isn't doing anything funky with its params

lusty dew
#
let sub = subreddits[Math.round(Math.random() * (subreddits.length - 1))]
#

It is only doing that

real ocean
#

are you sure? the errors being caused by a package called unique-random

#

are you using uniqueRandom(a, b) anywhere?

lusty dew
#

No

real ocean
#

although it could actually be a dependant on one of the packages you're using

lusty dew
#

I don't even know what unique-random is

real ocean
#

random-puppy uses it to get its randomness

lusty dew
#

Ah ok

real ocean
#

make sure the subreddit you're using is typed properly

lusty dew
#

I am using random-puppy

#

It is typed

#

I copied and pasted it

#

lol

#

SO it better be correct

#

So*

real ocean
#

let me have a quick look at the source

#

1 sec

lusty dew
#

ok

#

oof I don't even have random-puppy installed o.O

real ocean
#

lol wut

lusty dew
#

I don't have it installed

#

Never did

#

npm i random-puppy

real ocean
#

how does it even run then

lusty dew
#

¯_(ツ)_/¯

real ocean
#

thats nodejs for you

lusty dew
#

Lol

#

Should I try and install it?

real ocean
#

yeah probably

lusty dew
#

Ok doing so now lmfao

#

I hope I don't get random dogs instead of Furry porn

#
RangeError: Maximum call stack size exceeded
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:4:22)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
    at rand (C:\Users\User\Desktop\No name\node_modules\unique-random\index.js:6:47)
#

I got that again :/

#

I have used this method a lot now I have problems with it Sigh

real ocean
#

this is a super dumb question but does the subreddit have more than 1 pic

lusty dew
#

Yes It does

#

I have checked all of them before I used them

real ocean
#

had to make sure

earnest phoenix
#

Any idea why my iframe's height is forced to 500px even though I set it to 300px on my bot's description?

<iframe src="..." width="600" height="300" style="height: 300px !important; width: 600px !important;" frameborder="0"></iframe>

It's still forced to 500px and looks like this:

lusty dew
#

Yeye I know XD

earnest phoenix
#

Any idea how to fix it?

#

Sure, I can leave it at 500 pixels height, but that doesn't look that good :3

lusty dew
#

Wow that looks awesome xD

#

What is it for though?

#

Does it go by like the Server region?

earnest phoenix
#

yeah.

lusty dew
#

Wow, that is cool

earnest phoenix
#

:3 ty

lusty dew
#

:3 yw

#
return prev = num === prev && min !== max ? rand() : num;

This is what is in unique-random's thing

#

Index*

#

On line 6

real ocean
#

yeah

lusty dew
#
module.exports = function (min, max) {
    var prev;
    return function rand() {
        var num = Math.floor(Math.random() * (max - min + 1) + min);
        return prev = num === prev && min !== max ? rand() : num;
    };
};

Whole hting

#

thing*

real ocean
#

so i have a feeling for some reason its trying to get a unique random number which can only be one thing

#

so it keeps trying

lusty dew
#

How can I stop that?

sly girder
#

Boyz, how do profile or other image with nodejs?
Wanna create a profile for my bot 😄

#

Maybe some link to guide, I rely want to learn that

real ocean
#

not too sure @lusty dew, i can't spot anything in the source for random-puppy which looks like it's obviously failing, you can maybe try debugging it for yourself in there or posting an issue on it's repo i guess

lusty dew
#

Hmm

#

Do you know any other way to request images from a subreddit?

real ocean
#

wait nvm

lusty dew
#

What?

real ocean
#

its the Furryporndump subreddit that's breaking it

#

random-puppy makes an api call to imgur, and if you try making that api call with aforementioned subreddit it returns an empty array

#

so random-puppy isn't getting any images

lusty dew
#

wait what?

inner jewel
#

wtf is that random function

real ocean
#

its u n i q u e

lusty dew
#

Ye

#

Lol

#

It was inside unique-random index

inner jewel
#

it's not even unique

#

it's only unique across two sequential calls

real ocean
#

its not the same as the last one

#

¯_(ツ)_/¯

inner jewel
#

that's pretty useless tbh

lusty dew
#

I didn't add it :/

inner jewel
#

and horrible practices

real ocean
#

as long as if you dont get the same result twice in a row amirite

lusty dew
#

I didn't put it in :/

#

I can try and get rid of it XD

real ocean
#

but ye, for whatever reason the api call isn't working

#

i dont really want to look at this subreddit

lusty dew
#

npm uninstall unique-random

inner jewel
#
module.exports = function (min, max) {
    var prev;
    return function rand() {
        var range = max - min;
        if(range == 0) return min;
        var num = Math.round(Math.random() * range) + min;
        if(num == prev) return rand();
        return prev = num;
    };
};```
real ocean
#

go make a pr natan

#

teach them how to code properly

lusty dew
#

Could I unistall unique-random

real ocean
#

nah thats not the issue

lusty dew
real ocean
#

the code is dodge but it works

lusty dew
#

It is a package

#

lol

#

Ah ok

inner jewel
#

try logging the arguments given to it

real ocean
#

God help my soul looking at the subreddit thats causing issues, it looks like the posts are on dbox not imgur

inner jewel
real ocean
#

so the imgur api isn't getting anything

#

ok but if issue is caused by what it looks like it is, yours would do the same thing >.>

#

if i had to take a stab in the dark i'd say that the module is calling randomUnique(0, 0)

#

wait lol nvm i saw your error checking

lusty dew
#

brb

inner jewel
#
const r = uniqueRandom(0.1, 0.2)
console.log(r());
console.log(r());```
#

this seems to trigger it

#
function (min, max) {
    var prev;
    return function rand() {
        var range = max - min;
        if(Math.abs(range) < 1) return min;
        var num = Math.round(Math.random() * range) + min;
        if(num == prev) return rand();
        return prev = num;
    };
};```this would fix it
#

range < 1 -> return min

lusty dew
#

So I would put that into the file?

#

the index of it

real ocean
#

no

#

dif issue

lusty dew
#

Oh

real ocean
#

the issue is that the subreddit doesnt use imgur for the pictures

#

and random-puppy uses imgur

lusty dew
#

Ah ok

#

Which subreddit is it?

real ocean
#

Furryporndump

lusty dew
#

Ok

#

I will take that one out

#

and I will have a look at the others too

real ocean
#

Just makes sure that https://imgur.com/r/{subreddit}/hot.json actually has stuff in the data array

#

that means that it found pics

native folio
#

i need some ideas for commands

lusty dew
#

@native folio Steam

#

Reddit

native folio
#

this is my first time coding with python and i dont really know how to add much

lusty dew
#

oh

#

oof

slender thistle
#

Learn Python itself first.

#

And work with some stuff other than Discord bots.

earnest phoenix
#

nah just make a discord bot

#

this community needs more clueless people

slender thistle
#

in HTML.

earnest phoenix
#

paste bot

#

ez

quartz kindle
#

make a bot that repeats back everything everyone says

stuck ravine
earnest phoenix
#

ok so maybe there is some way to do something periodically

#

like on an INTERVAL... crazy thought

#

google probably wouldnt have any results for that..... no... PepeHands

stuck ravine
#

😦

formal atlas
#
function updateGameStatus() {
    bot.user.setActivity(`*help | Users: ${users}`, {type: "WATCHING"});
};
setInterval(updateGameStatus, 30000);

updates every 30 seconds @stuck ravine hope this helps.

stuck ravine
#

thanks !

formal atlas
#

sometimes spoonfeeds help, for next time.

earnest phoenix
#

well hes gonna come back asking why its not changing lmao

#

users variable aint gonna change itself

#

spoonfeed strikes again peepoHappier

real ocean
#

Do you not need to worry about sleeping on the thread in js? o.O

#

Or does set interval just run concurrently

earnest phoenix
#

is async

#

event loop

real ocean
#

ah

inner jewel
#

you just need to worry about not blocking the event loop thread

earnest phoenix
#

yes for example if u set an interval then put an while loop forever the interval wont happen awesmart

real ocean
#

Oh right

dim gate
#

Any python developer here?

west raptor
#

ok so first

#

you just showed us your bot token

#

so

#

um

#

reset that

#

now

dim gate
#

ty

earnest phoenix
#

run it with python

west raptor
dim gate
#

oh, i deleted that .format. still dont run >&

#

😦

west raptor
#

how are you running it

dim gate
#

there's another way?

west raptor
#

open the command prompt

earnest phoenix
#

LMAO

#

i called it

#

im fuckin dead

#

hes just clicking the file

slow pike
dim gate
#

ok, now?

west raptor
#

type in the console cd <file location>

#

you get the file location

#

by

dim gate
#

with the folders ?

west raptor
earnest phoenix
#

shift right click

#

open command window here

dim gate
#

its the syntax right?

quartz kindle
#

i dont know pyton, but im pretty sure you cant send a message to true

#

you're doing send_message(author.id == "id"), which becomes send_message(true)

earnest phoenix
#

ok

#

so uhh

dim gate
#

oh, how can i make that when the users id sends a message reply?, any message i mean

earnest phoenix
#

anybody here that works in java?

quartz kindle
#

i dont get what you mean, but it should be send_message(where to send, what to send)

#

pretty sure you can figure out what you need from there

frail sierra
#

Hey Tim do you work in discord.js

topaz fjord
#

doesn't everyone

frail sierra
#

Lol

slender thistle
#

@dim gate when the users id sends a message reply what

dim gate
#

right now i only want the bot to reply, later i will decide what he'll reply

slender thistle
#

await client.send_message(message.channel, "I WANT TO REPLY.")

earnest phoenix
#
    throw err;
    ^

Error: Cannot find module 'dblapi.js'

dont say to me do npm i dblapi.js because ive already done that, and the file it says the error in isnt even requesting anything to do with that, and it says the error is on a blank line, wtf could be the problem

frail sierra
#

Dblapi doesn't seem to be a module

earnest phoenix
#

NO SHIT

dim gate
earnest phoenix
#

but nothing is requesting it

frail sierra
#

What do you need it for 🤔

earnest phoenix
#

Im Using This Servers api

#

im moving channel

slender thistle
#

@dim gate Get a better IDE.

#

The one that doesn't mix tabs with spaces.

#

Sublime Text (or PyCharm, not sure).

#

Your issue is using tabs and spaces for indenting stuff.

topaz fjord
#

pycharm is only a 30 day trial

frail sierra
#

Or visual studio code

slender thistle
#

Sublime is light.

frail sierra
#

I like VSC for the itellisence

slender thistle
#

Preferences. /shrug

frail sierra
#

^

stuck ravine
dim gate
#

done

quartz kindle
#

yes @frail sierra

frail sierra
#

Ok

slender thistle
dim gate
#

TY @slender thistle

#

THAT WAS THE PROBLEM

slender thistle
#

Yes.

#

Just like the error said.

signal saffron
#

How can I do if I want to add motion picture(gif) to my bot message?

earnest phoenix
#
      let txt = doc.toString().split('\n')
      for(line in txt){
          if(txt[line].includes(approval)){
              //string is on line
              let text1 = txt[line];
              let text2 = text1.split(":")[1].trim()

          });

#

Why does that give me an error?

quartz kindle
#

which one is line 42?

earnest phoenix
#
      let txt = doc.toString().split('\n')
      for(line in txt){
          if(txt[line].includes(approval)){
              //string is on line
              let text1 = txt[line];
              let text2 = text1.split(":")[1].trim()
              if (text1 === undefined || text1 === null) {
                var id = message.author.id;
                var roblox = args[1];
                fs.appendFileSync('verify.txt', `${id}:${roblox}\n`);
              }             
          });

cursive dagger
#
### COMMON FUNCTIONS (NO COMMANDS) ####
def set_balance(userID:str,value:int):
    with open("data/coins.json") as f:
        j = json.loads(f.read())
        j[userID] = value
    with open("data/coins.json", "w") as f:
        f.write(json.dumps(j))

def get_balance(userID:str):
    with open("data/coins.json") as f:
        j = json.loads(f.read())
        try:
            return j[userID]
        except:
            return 0
def add_balance(userID:str, value:int):
    set_balance(userID, get_balance(userID)+value)
def remove_balance(userID:str, value:int):
    set_balance(userID, get_balance(userID)-value)
for i in res:
            try:
                if weekno<5:
                    await client.get_user(int(i)).send(embed=discord.Embed(title="VOTE",description="Thanks for voting! +5 hashes",color=0x000))
                    add_balance(int(i), 5)
                else:
                    add_balance(int(i), 10)
                    await client.get_user(int(i)).send(embed=discord.Embed(title="VOTE",description="Thanks for voting! +10 hashes (weekend bonus)",color=0x000))    
            except:pass

Some reason the json keys duplicate. {"397745647723216898": 10, "397745647723216898": 10}

earnest phoenix
#

i need help setting up the api for so i can get my bots stats onto the website

bright spear
spice coral
#

I have a Problem:
I did Change the Name and the Avatar of my Bot but it doesnt change, only in the invite is the new name and new avatar

west raptor
#

you are probably only changing the application name and avatar

spice coral
#

how else should I change it?

west raptor
spice coral
#

oooooh

#

that will be it

#

thanks alot and sorry for me being that dumb^^

west raptor
#

It's fine

#

I didn't know until recently also

#

😄

earnest phoenix
#

how can i have 2 prefixes on my bot, so if i use -- or tag the bot

#

Use prefixes array and regex

steel drum
#

if u wanna tag

#

u cud do smth like

#

if (message.mentions.users.first() && message.mentions.users.first().id = message.guild.me().id) {//do something}

#

idt u need the .id part

#

or u cud

earnest phoenix
#

Hm...

steel drum
#

cycle thru

#

the mentions

earnest phoenix
#

Why to loop, lol?

steel drum
#

what if the bot mention

#

isnt the first mention

wide ruin
#

Is it a good idea to add a TOS command for a bot?

tidal field
lusty dew
#

can someone help me?

#

I am trying to do something like this

quartz kindle
#

canvas

lusty dew
#

Yea

#

I know

#

I am talking about for the

#

XP bar and rank and level

#

Idk how to do that part

quartz kindle
#

thats simple math

#

if you already have a xp system

lusty dew
#

I don't know math well :/

quartz kindle
#

you just do

#

current XP * max XP / 100

lusty dew
#

Ok

#

For the XP bar?

quartz kindle
#

yes

lusty dew
#

Ok

quartz kindle
#

lets say bar starts from 0 to 100

#

max xp is 100

#

current xp multiplied by max xp divided by 100 gives you the value of the current xp bar

#

so if current xp is 70, it will give you 70 (70*100/100)

#

if bar goes from 0 to 350 (if you have its size in pixels for example)

#

70*350/100 = 245

lusty dew
#

I am trying to create something like Mee6

quartz kindle
#

which is 70% of the bar

lusty dew
#

Ok

#

I have the XP system in a JSON thing

#

But I want a Database

earnest phoenix
#

Oh, JSON...)

#

why wont this work

{
    "prefix": ["--", "@catmaniabot#4992"]
}
lusty dew
#

Lol

spice coral
#

so I did change the Botname in general information and the bot tab but it is still named the old name

#

pls help ;-;

earnest phoenix
#

@earnest phoenix what are you doing with an array?

#

have multiple prefixes

lusty dew
#

@earnest phoenix If you are trying to make the bot's prefix a mention also you need to do it by the bot's ID, also it won't work how you are doing anyway

earnest phoenix
#

Damn, show your code, I know ur trying to have multiple prefixes

#

that is the code, its in a config.json file

lusty dew
#

You can't do it like that

quartz kindle
#

when you mention someone, the bot doesnt see @ username#number

earnest phoenix
#

I'm done

quartz kindle
#

the bot sees <@ id number>

lusty dew
#

Yes

earnest phoenix
#

ye, i got that, will doing that make it work?

#

Nope, as I said, use regex

quartz kindle
#

depends on the rest of your code

lusty dew
#

Yea

#

I have my set up by mention

#

But my method most likely won't work with yours without rewriting your whole json

#

Plus not allowed to spoon feed

spice coral
#

repost: I did change the Botname in general information and the bot tab but it is still named the old name

earnest phoenix
#

thats the message event that grabs the prefix

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


exports.run = (client, message) => {
    if (message.author.bot) return;
    //Prefix Handler
    if (message.content.indexOf(config.prefix) !== 0) return;
    const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();
    const cmd = client.commands.get(command);
    if (!cmd) return;
    cmd.run(client, message, args);

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});


}

@quartz kindle

#

Ur doing wrong

lusty dew
#

why do you have an module.exports thing in your index.js?

#

if you want a message event do

earnest phoenix
#

thats not in my index

#

its int he message event

lusty dew
#

It should be

#

It should be in your index.js

#

Wait

#

Do you mean like a messageEvent.js?

earnest phoenix
#

Dude, it's CommonJS module

#

message.js

#

anyway

#

it works

#

so help

quartz kindle
#

you cant do indexOf(array)

#

you have to check for both possibilities

earnest phoenix
#
new RegExp(`^(${prefixesArray.join('|')})`)
quartz kindle
#

either an if/else, switch or ||

open basin
#

Does anyone have any idea on how to make a basic shop function in disc.py

earnest phoenix
#

@earnest phoenix where in code do i put that

quartz kindle
#

also, if you do indexOf just like that, you're matching the entire message content

#

meaning if the prefix is anywhere in the middle of the message, it will still work

#

and i doubt you want that

lusty dew
#

@earnest phoenix Have you tried learning JS?

earnest phoenix
#

You need to do something yourself, here you can just receive some hints
No one will code your bot for you
And, yeah, you should take a look at JS docs first

slender thistle
#

@open basin What would the shop contain?

spice coral
#
  1. repost because my question is going down under the other questions : so I did change the Botname in general information and the bot tab but it is still named the old name
west raptor
#

Try reinviting the bot

lusty dew
#

Also

spice coral
#

imma try that

lusty dew
#

That just renames the Bot's role

#

In the bot tab

#

Oh wait

#

General Info

#

I thought you meant the actual tab called bot

#

OOF

#

When you can't read >~<

spice coral
#

xD

#

and i reinvited him

#

but didnt do anything

lusty dew
#

Hmm

open basin
#

@slender thistle items like weapons and gear

#

It is a rp shop

slender thistle
#

A dict with items and stuff like that, I guess

open basin
#

Ok

#

@slender thistle what is that

#

Sorry I am a beginner

native folio
#

Can someone help me? I've been trying to do this for over an hour! Im trying to code a kick and ban command and I cannot get it I'm using python 3.6

slender thistle
#

@open basin {'Sword': 1000, 'Stick': 10} etc.

open basin
#

Ok

#

Thanks

earnest phoenix
#

ive put the exact same code in config and config2 and done the same with message and message2 but, the only thing i changed in message2 was the config file and only thing i chnaged in config2 was prefix, the first one works but the message2 and config2 doesnt

#

someone help

native folio
#

@slender thistle 3.6

earnest phoenix
#

You need to show both, @earnest phoenix

#

what u mean

#

@earnest phoenix

#

show the files

#

the code

#

check the config file for both

#

ye, i did...

merry haven
#

I use yargs-parser for parsing arguments

earnest phoenix
#

and i showed u them @earnest phoenix

#

I see

#

You're trying to do a mention prefix?

#

ye

#

I can't see all of the code

#

Your editor is being sliced

#
const Discord = require('discord.js');
const config = require('../settings/config2.json');


exports.run = (client, message) => {
    if (message.author.bot) return;
    //--prefix Handler
    if (message.content.indexOf(config.prefix) !== 0) return;
    const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();
    const cmd = client.commands.get(command);
    if (!cmd) return;
    cmd.run(client, message, args);


}

thats in both but config file is different, and the first one works, just the one where i tag bot doesnt

#

Yep, thought so

#

the prefix isn't working because you're trimming the string

#

So the prefix isn't actually <mention> command

#

it's <mention>command

#

In order to get around this behavior, you need to use regex

#

mention command doesnt even work without space

#

how do i use regex?

#

actually, ima go now

wide ruin
#

Is there a way to make a richembeds embed colour fade?

#

Discord.js

#

Is there a package or something?

knotty steeple
#

fade?

west raptor
#

im guessing like

wide ruin
#

Like red to grey

west raptor
#

^

#

no you cant do that

knotty steeple
#

edit the message and change the color

wide ruin
#

Changing colour

west raptor
#

i think he means in one embed

wide ruin
#

But can it be red at the top and change to grey at the bottom

knotty steeple
#

not possible

wide ruin
#

Not a package?

knotty steeple
#

not possible

wide ruin
#

Ok

rustic axle
#

#CSSGradientInDiscord.jsEmbeds

upper ember
#

how do I set default value with MariaDB?

lusty dew
#

Can someone help me with a giveaway command?

earnest phoenix
#

what lib?

lusty dew
#

Discord.js

native folio
#

Oo

earnest phoenix
#

Okay, then it's easy (4 steps)

  1. Create a reaction collector (or await reactions) using a duration that you set in a specific channel
  2. Wait for the collector or await reactions to end
  3. pick a random reaction emote from the collector
  4. Find the user of that random emote <reaction.message.member>
lusty dew
#

so like

native folio
#

Can someone help me with a giveaway command for discord.py 😀

lusty dew
#

Lol

native folio
#

You gave me a idea for my bot lol

lusty dew
#

XD

native folio
#

I've been trying and trying and I can't seem to figure out how to make a kick and ban command for python 3.6

lusty dew
#

I want my giveaway command like GiveawayBot's

native folio
#

I want my giveaway command like GiveawayBot's

lusty dew
#

-_-

native folio
#

Did you just copy me

lusty dew
#

I will end your life if you keep coping me

native folio
#

O

#

My god

#

I will end your life if you keep coping me

west raptor
#

hey

#

be nice now

normal grove
#

oof

native folio
#

Just having fun

normal grove
#

i have no idea where to start

#

anyone know where i get a bot editor

lusty dew
#

VScode

#

Atom

#

Those two

#

oof meant to DM

normal grove
#

oof

native folio
#

What is a bot editor

west raptor
#

wut

lusty dew
#

Bot editor = coding software

#

That is what they meant

#

lol

native folio
#

Just download java or python????

#

Like wot

lusty dew
#

?

#

They are making a bot in c++

native folio
#

Why not just download like python

#

Ah

lusty dew
#

Cause

#

Not everyone is going to write a bot in python xD

native folio
#

Isn't c++ harder or somethin

lusty dew
#

Depends

#

lol

#

Some people find it easy

native folio
#

Does this server support python because i have asked tons of questions and no answers

lusty dew
#

others harder

#

Yes it does lol

native folio
#

Do you code with python?

lusty dew
#

Nope

#

Someone give me an Idea for a bot

native folio
#

Purple

#

A python bot

lusty dew
#

no

#

Screw python

night imp
#

how about a bot that has custom chat tags you can put in

#

and if they find them it alerts/deletes them

lusty dew
#

Hmm possibly

night imp
#

with server customization and a website interface

#

ya yeet

sick cloud
#

ive already done that

#

just never released mmLol

lusty dew
#

OOF website I can't afford it nor can I code in HTML or css

night imp
#

Learn it in like 3 days™

lusty dew
#

Lol

#

I am too lazy

#

Plus I am trying to learn Java

night imp
#

ok i learned html+css over a weekend when I started out coding so not that hard if you want to try

lusty dew
#

ok

#

I need a life

#

I just cut a pancake with scissors 😆

west raptor
#

wut

#

👀

lusty dew
#

lol

#

Anyway

#

What about a HentaiBot :3

#

Damnit that is already a bots name :<

#

Sigh

earnest phoenix
#

wut

lusty dew
#

I am trying to find a bot name that isn't taken

#

XD

normal grove
#

anyone here know how to make bots

earnest phoenix
#

yes

#

like

#

everyone with a green name

lusty dew
#

XD

normal grove
#

oof

#

well i'm stumped

lusty dew
#

With?

#

What lib

#

lol

normal grove
#

everything

lusty dew
#

Ok

earnest phoenix
#

ok

night imp
normal grove
#

i got a potato bot

earnest phoenix
#

ok

night imp
#

Follow these

earnest phoenix
#

what lang

lusty dew
#
  1. Do you have a code editor
  2. Do you have a Bot app
  3. Do you have any knowledge on a lang
normal grove
#

yes yes what is lang

hushed trench
#

language

lusty dew
#

coding langauge

normal grove
#

almost none

night imp
#

programming language, it is what you write the bot in

hushed trench
#

Javascript, Pythom C#

lusty dew
#

like c++, c#, java

hushed trench
#

you should probably learn one before going onto this

night imp
#

I recommend either learning one with free things such as codeacademy or sololearn

hushed trench
#

it is a lot harder without any information

night imp
#

Or if you want to just experiment watching a tutorial online

hushed trench
lusty dew
#

I started without learning a language XD

hushed trench
#

codecademy, khanacdemy or sololearn like saddy said is good for python

lusty dew
#

Not saying you should o.O

night imp
#

khanacademy has python wait what

lusty dew
#

oof

#

Khanacademy is a thing?

#

I thought it was only for math o.O

#

XD

#

The more you know

night imp
#

Yeah they don't have a python course ok good

#

@lusty dew Nah, it is useful for a lot of things

lusty dew
#

Yea

#

I never used it for anything other then math

#

lol

#

Sad thing is I am still horrible at math

night imp
#

Not saying that other things are any good

lusty dew
#

oof

#

Maybe should start with 1st grade math>

#

?*

night imp
#

ie the grammar portion is at a 5th/6th grade level

lusty dew
#

Maybe I should start with 1st grade math*

hushed trench
#

neko what do you code in

lusty dew
#

Discord.js

hushed trench
#

saddy?

sick cloud
#

saddy takes years to respond

night imp
#

discord.js

lusty dew
#

lol

hushed trench
#

oof

night imp
#

only because I learned it

sick cloud
#

i use djs, eris and my own lib

hushed trench
#

from sourcecode

sick cloud
night imp
#

would use eris if I started out now

#

or maybe just create my own api calls 👌

sick cloud
#

i made my own api wrapper

#

that works

#

it connects to the gateway and all

lusty dew
#

I want to create my own API, but I don't know where I could host it

night imp
#

anywhere

#

galaxygate

sick cloud
#

glitch

hushed trench
#

amazon?

sick cloud
#

i literally hosted my api on glitch

night imp
#

@sick cloud pls

sick cloud
#

and just pinged it a lot

#

ok

lusty dew
#

On the price range of broke person

hushed trench
#

lol

sick cloud
#

well its better than putting it on my dedi

night imp
#

@sick cloud invest in a $3/mon

hushed trench
#

do you have a credit card?

sick cloud
night imp
#

@lusty dew it is $3/mon

sick cloud
#

i already got $55/month

night imp
#

for a galaxygate vps

lusty dew
#

Ahem again Price range of broke person

topaz fjord
#

galaxygate best gate

night imp
#

if that is too expensive where do you live nigeria

lusty dew
#

Meaning I got 0$

#

xD

night imp
#

work™

lusty dew
#

Ahem

sick cloud
#

getalife

lusty dew
#

I am 14 years old

sick cloud
#

same neko

topaz fjord
#

ask your parents

lusty dew
#

where am I going to work?

sick cloud
#

and i make money

night imp
#

you can work at 14

sick cloud
#

im 13 mmLol

lusty dew
#

Lol

sick cloud
#

and i earn myself money

#

not much but i can pay for stuff

lusty dew
#

I do too, just money stop coming in :/

topaz fjord
#

my parents pay for my vps

#

¯_(ツ)_/¯

west raptor
#

yes

lusty dew
#

I sell things

night imp
#

child labor laws are antiamerican

sick cloud
#

my mum pays for my nitro. i pay for everything else

night imp
#

but you can still work at 14

sick cloud
#

i'm aussie and i think here you gotta be 15/16..?

#

but idk

#

i just got a paypal and do commissions and junk

topaz fjord
hushed trench
#

@sick cloud

#

do you do art comms?

sick cloud
#

no

#

well

hushed trench
#

what sort of comms do you do

sick cloud
#

some

night imp
sick cloud
#

i do logos, bots, front/back end websites

hushed trench
#

nice

sick cloud
#

and sometimes i do banners

lusty dew
#

Damn

sick cloud
#

oh

hushed trench
#

gottem

lusty dew
#

I need to apply for a summer job

#

XD

sick cloud
west raptor
#

wait this is development

hushed trench
#

oof me too

night imp
#

I spend about half my year working on sciencefair projects for scholarships

west raptor
#

fuck

hushed trench
#

ohyeah

night imp
#

the other half making random crap

hushed trench
night imp
#

yeah probably best

#

before yasmoon hurt sus

lusty dew
#

I used to sell bots that were half broken for 5$ 👀

hushed trench
#

sell?

#

to who?

#

need to know

lusty dew
#

People who make money and can afford them

hushed trench
#

oof

lusty dew
#

I target a lot of groups of people

#

  1. People who sell nudes
  2. People who sell products
  3. People who have a twitch and raise money to buy things for themselves***
#

👀

#

My old paypal got hacked :<

#

I had 4$ on it

native folio
#

That's like

#

More than my rent

lusty dew
#

Lmfao

lusty dew
#

Can someoen help me set up an Sqlite database for a coin system?

quartz kindle
#

@native folio which language and library are you using?

native folio
#

python v 3.6.5

#

library??

quartz kindle
#

a library that interfaces with discord

native folio
#

thats what i am using

quartz kindle
#

which version?

native folio
#

how to check XD

quartz kindle
#

i dont know, i dont use python

native folio
#

i just use python 3.6.5

lusty dew
#

I use to use python 3.6.3

#

lol

native folio
#

i thought you said you didnt use python

quartz kindle
#

im not him lol

native folio
#

no i think neko said he didnt use python

quartz kindle
#

anyway, discord.py has message.author.bot which returns true if the message received came from a bot

#

but not all versions of discord.py have this, some older versions dont

#

so you have to check if the message received came from a bot, and if it did, dont run the command

lusty dew
#

Got it figured out ;p

slender thistle
#

@native folio How did you install d.py?

#

"Setup SQLite database" what

sick cloud
#

how do you run code after a forEach finishes? (js)

bright spear
#

not really sure but cant u just await the foreach?

sick cloud
#

well i got this code

client.YouTube.searchChannels(args.join(' '), 5)
        .then(results => {
            let res = [];

            results.forEach(r => {
                client.YouTube.getChannelByID(r.id).then(d => res.push(d));
            });

            

            const embed = new MessageEmbed()
            .setDescription(`Here are the top 5 results I found. Type 1-5 below to show a result.`)
            .setColor('#ED1B24')
            .addField(`Results found ❯`, res.map(c => `${res.indexOf(c) + 1}. [${c.title}](${url})`))

            msg.channel.send({ embed: embed });
        }).catch(err => msg.channel.send(err, { code: 'js' }) && console.error(err));

but i keep hitting a message embed field can't be empty error

#

so yeah, its not pushing all 5 channels to the res array before the embed sends

#

and idk

#

i don't think you can

#

forEach isn't async

frigid bone
#

forEach isn't async
You can make any function you want async

#
results.forEach(async r => {
       const channel = await client.YouTube.getChannelByID(r.id);
       res.push(channel)    
});
smoky spire
#

What he means is you can await a forEach

#

Can't*

dusk skiff
#

odd eror

lusty dew
#
MongoDB not running on the provided host and port
#

Can someone help?

#

I have already installed MongoDB Community servers

lofty abyss
#

what u guys think?

#

still alot to work on but /:

#

@lusty dew Read what it says

#

Would tell you alot

earnest phoenix
#

Can somebody tell me why ${client.users.size} and ${client.guilds.size} don’t work now?

#

It only shows 0

slender thistle
#

@lusty dew Run the mongodb service

#

There should be something on their documentation

earnest phoenix
#

Tag me with the answer brb

lofty abyss
#

client.guilds.size + " Servers", client.users.size + " Users"]; @earnest phoenix try that

#

if its for the activiity

#

idk

languid dragon
#

not entirely sure that'd make a difference

lofty abyss
#

it might 🤷

#

lukl

languid dragon
#

what's your reasoning behind that

lofty abyss
#

thats what i use

languid dragon
#

`${value}`
and
"" + value + ""
is the exact same

lofty abyss
#

mhm

earnest phoenix
#
const activities_list = [
    "codiac.onuniverse.com", 
    `with ${client.users.size} people`,
    `on ${client.guilds.size} servers`
    ];

client.on('ready', () => {
    setInterval(() => {
        const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
        client.user.setActivity(activities_list[index]);
    }, 10000);
});

Is there an error that cost it says 0?

earnest phoenix
#

how can i use this, the developers page gave me it

   static void UpdatePresence()
    {
        DiscordRichPresence discordPresence;
        memset(&discordPresence, 0, sizeof(discordPresence));
        discordPresence.state = "ProxyBot";
        discordPresence.details = "Coding";
        discordPresence.startTimestamp = 1;
        discordPresence.largeImageText = "Arabi";
        discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657";
        discordPresence.partySize = 1;
        discordPresence.partyMax = 1;
        discordPresence.joinSecret = "NULL";
        Discord_UpdatePresence(&discordPresence);
    }
bright spear
#

@earnest phoenix that's a really vague question

#

What are you trying to do, what lib, and where did you get that

slender thistle
#

Is that C#

knotty steeple
#

looks like

earnest phoenix
#

hey do you know a eval that unbans all people of a server?

#

in discord.js

ruby dust
#

p sure it's api abuse

cursive ravine
#

Hi ! is there any way that i can get node-gp working on windows ?

earnest phoenix
#

Uh if there's 10 ppl it isn't abuse

earnest phoenix
#

what does this do<div class="image filtered span-1-75" data-position="100% 100%">

#

?

#

a div with 3 classes image, filtered and span-1-75 and a "data-position" attribute with value "100% 100%"

#

the data-position thing is probably used by javascript somewhere

earnest phoenix
#

i need

#

help

#

how would i make my website play a song when the button is pressed

#

i'm using html5

earnest phoenix
#

This channel is for bot development.

languid dragon
#

it's for any development really

earnest phoenix
#

The channel description says otherwise, but okay

west raptor
#

its says (bot)

#

development

earnest phoenix
#

Right

#

how do i make the music button bigger?

#
  <source src="sound.ogg" type="audio/ogg">
  <source src="sound.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>```
#

this

ruby dust
#

I love how you ask one thing and a few minutes later you ask another thing, even though no one answered to your first question yet

earnest phoenix
#

well, what can i do? i solved the first thing

#

so thats why i'm not repeating myself

ruby dust
#

that happens to me too sometimes, I figure out everything myself right when I'm in the middle of calling tech support xd

earnest phoenix
#

XD

earnest phoenix
#
12:24 PM
fs.js:113
12:24 PM
      throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
12:24 PM
      ^
12:24 PM
12:24 PM
Jump to
Error: EACCES: permission denied, open '../privacy.json'```

What
inner jewel
#

read the last line

earnest phoenix
#

o.O

#

Im using a hosting service and idk how to give permission

#

Is there a way through the bash console?

earnest phoenix
#

how can i put a clickable discord icon

inner jewel
#

by learning how to use html

#

that's basic webdev

earnest phoenix
#

i done it

#

dont worry lad

#
How to make shards?
 [I know it's a noob question]
spring ember
#

What lib

earnest phoenix
#

js

spring ember
#

Discord.js?

earnest phoenix
#

yes

spring ember
#

What version?

earnest phoenix
#

wait

#

11.4.2

spring ember
#

Oh I know only v12

earnest phoenix
#

how i can update?

spring ember
#

How many guilds are you in?

earnest phoenix
#

i or my bot?

spring ember
#

The bot lol

earnest phoenix
#

99

spring ember
#

Then you don't need sharding

earnest phoenix
#

why?

spring ember
#

It's irrelevant until you reach at least 1000 servers

earnest phoenix
#

someone has 300 and has

spring ember
#

Welp he should not

earnest phoenix
#

But what does a shard do?

spring ember
earnest phoenix
#

lol it's so simple

spring ember
#

Not that much

rustic axle
#

Sharding on heroku mmLol

harsh nova
#

hMM does anyone know how to refresh a JSON?

spring ember
#

What

#

Wdym

harsh nova
#

my bot has a password system (just a test bot not an open one) and when I "add" a new password it gets added to the json file but when I try to use it it dosent work. when i restart my bot and use the password again it works

ruby dust
#

that's kind of expected

spring ember
#

First of all, I don't recommend json for storing passwords

#

Second of all make sure you update the cache in your bot

harsh nova
#

thanks, I dont plan on using passwords in any of my bots, I just use it as a way to practise json since i've never got around to using it

earnest phoenix
#

how would i make a side way list

#

omg

#

like a side way

#

i got it

#

woah

#

after

#

ages

#

cannot read property setStatus of null

#

?

topaz fjord
#

.setStaus doesn't exist

earnest phoenix
#

It used to

topaz fjord
#

show code

earnest phoenix
#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args, admins) => {
  if(!admins.includes(message.author.id)) {
      message.channel.send('sorry, you can\'t use this command!').then(msg => msg.delete(3000))
  } else {
  
  message.delete().catch()
  message.channel.send("Done!").then(msg => msg.delete(3000))
  bot.user.setStatus('idle')
  }
}
module.exports.help = {

  name: "idle"

}```
topaz fjord
#

That should work zoomeyes

earnest phoenix
earnest phoenix
#

is while true do a thing on js?

smoky spire
#

while(true) {}

topaz fjord
#

yes

#

but it's extremely stupid

earnest phoenix
#

Callback must be a function?

#
      setTimeout(25000)
      bot.user.setActivity(`discord.gg/NOU | kh>help`, {type: "PLAYING"})
      setTimeout(25000)
      bot.user.setActivity(`discord APIs | kh>help`, {type: "STREAMING"})
      setTimeout(25000)
      bot.user.setActivity(`for commands! | kh>help`, {type: "LISTENING"})
      setTimeout(25000)
      bot.user.setActivity(`over ${bot.guilds.size} guilds! | kh>help`, {type: "WATCHING"})
    }``` @smoky spire
#

cool

slim heart
#

discord.js, I'm getting this error and it's because of my line:

let logchannel = message.guild.channels.find("name", "log");

Is there like a new way of doing this or what?

rustic axle
west raptor
#

@slim heart pass it as a function instead

slim heart
#

which would beeee-?

west raptor
#

(ie. .find(c => c.name === 'Log') )

slim heart
#

uuuu

#

ok

#

thanks

west raptor
#

Np

inner jewel
#

you should learn js

earnest phoenix
#

:/

#

i fixed it

steel drum
#

@earnest phoenix

#

js has

#

do {//body} while (boolean);

#

diff with do loops and while loops is

#

do loops will always execute the body of the loop once

#

then check the boolean

#

very niche

earnest phoenix
#

How can I get my bot to not crash on any errors?

#

I mean there are many methods, but use this little tool

#

called pm2

#

If this is discord.js pm2 will help.

#

It auto restarts bot on crash.

#

My bot keeps crashing because of this stupid undefined message that don’t need to be defined

#

Discord.js?

#

Ye

#

That m

#

Crashes my bot

#

Okay, so

#

do npm install pm2 -g

#

in terminal

#

in the same directory

#

of that

#

let me know when its done installing

#

Done

#

@earnest phoenix

#

...

#

um

#

Well now open up terminal

#

change cd to whatever folder the project is in

#

Ye

#

do pm2 start filename

#

It’s in there anyway

#

filename is like where all the main code is

#

so like even tho the bot will crash when error comes

#

it will auto reboot

#

@sage spade uses it <<3

#

Okay I did that

west raptor
#

just catch the error

earnest phoenix
#

k all good to go

#

that works too

#

I guess we’ll see if it work

#

Now we wait

#

It tells you a lot of info on the bad

#

Bot

#

If I wanted to restart it why do it do?

#

pm2 stop name?

#

@earnest phoenix

west raptor
#

yes

#

just do smth like this

earnest phoenix
#

I’d just rather get my bot to restart I get so many errors on my bot

west raptor
#

i know you aint executing a command

#

but just catching the error then returning the error to the console works

earnest phoenix
#

I think I should just now make random message it makes too many errors

zealous veldt
#

Might not want to send your full error lol

earnest phoenix
#

um

#

well usually i have a an eval command

#

so i just process.exit(0);

#

and it reboots

#

but if you don't want to make one

#

try dream's method

#

both work fine

#

if (msg.content == "etst") {

try {

//your code here

} catch(err) {

return;
}

}```
#

god horrendously

#

done

#

but still work

#

s

#

It’s not a command tho