#development

1 messages · Page 508 of 1

drowsy yew
#

Ok

#

Still isn't working

quartz kindle
#

do you see anything in your logs?

drowsy yew
#

Nothing

quartz kindle
#

does it show "ready"?

drowsy yew
#

Nope

quartz kindle
#

then its not even running

#

show me your console

drowsy yew
reef oriole
#

ok, how do you detect if theres nsfw in an image?

quartz kindle
#

you have to actually run the bot

drowsy yew
#

I know,

#

Its logged in and online

quartz kindle
#

the bot is online? so where is it running?

idle mountain
#

@reef oriole if you're getting the image from a certain place, you can tell that way (ie if your source is reddit, check if the post is marked NSFW), you can also use machine learning but that's not really as reliable

drowsy yew
#

I don't even know at this point

#

It won't do much but stay online

quartz kindle
#

i dont know if your code editor runs it, but usually you have to go to your bot folder, open a command line, and run node botfile.js

reef oriole
#

that doesnt't help. my bot was denied for showing nsfw content when i check if it's nsfw content coming through

#

but the api failed to flag it as nsfw

#

so i can't do that

quartz kindle
#

if its online is running somewhere though

drowsy yew
#

Ok

reef oriole
#

so how do you do machine learning then?

quartz kindle
#

you have to find where it is running, and restart it

drowsy yew
#

Ok.

#

I'll try it now

idle mountain
#

@reef oriole well there ain't nothing else you can do. get a better api or use some library that can detect NSFW stuff

reef oriole
#

honestly, i can't use another api since my bot is based around this one website

#

and i don't know any

idle mountain
#

what website?

reef oriole
drowsy yew
#

I ran the command and this is what I found

idle mountain
#

not sure how this site works

#

but if it has a point system, you can make it only accept images over a certain number of points or something

drowsy yew
idle mountain
#

that's what i do for reddit stuff and i've never had a problem

#

there's nothing else you can do

reef oriole
#

so basically i can't

#

alright

idle mountain
#

if you want to avoid the problem completely you can just make it so that you can only use the command in NSFW channels

quartz kindle
#

@drowsy yew i mean... the actual name of your bot file, not literally "botfile.js"

idle mountain
#

but i'm thinking you'd want to avoid that

earnest phoenix
#

any1 know how i can hide bot token in github code?

reef oriole
#

i'll just go ahead and delete it all, because the majority of the bot is useless anyways

#

@earnest phoenix gitignore files

drowsy yew
#

Oh

#

Lol

#

mb

idle mountain
#

Well, a command only working in NSFW channels is better than that command not existing bingT

reef oriole
#

but a bot that only works in NSFW channels is silly

#

the entire bot has 6 commands, 3 meta and 3 api-based. and i'd have to make the 3 api ones nsfw-only

drowsy yew
quartz kindle
#

show me your thomasbot folder

drowsy yew
quartz kindle
#

there is no thomasbot.js

#

there is "index.js" and "ThomasBot Code.js"

#

which one are you coding?

drowsy yew
#

The code

west raptor
#

Which file is the code in

drowsy yew
#

ThomasBot Code.js

west raptor
#

run node ThomasBot Code.js

#

in the console

drowsy yew
west raptor
#

It's the space

#

rename the file to ThomasBot-Code

quartz kindle
#

or run node "ThomasBot Code.js"

#

you need quotes for files with spaces

west raptor
#

yea or that

drowsy yew
#

Fair enough

#

I'll do it now

west raptor
#

Okay

drowsy yew
#

Holy

#

Entire paragraphs of these red lines

quartz kindle
#

you renamed your file to index.js?

topaz fjord
#

that's a vscode error I think

quartz kindle
#

i dont use vscode, so idk whats going on

earnest phoenix
#

try node . I got same issue and i fixed it by typing this

topaz fjord
#

node . targets the file index file specified in package.json afaik

drowsy yew
#

I got a response from it now I think

#

Earlier, it wouldn't send ready

quartz kindle
#

alright, if its sending "ready" then its working

drowsy yew
#

Ok

#

Thanks guys!

#

Gonna try it rq

wheat marten
#

how do I host my bot with gce

uneven depot
#

anyone ever tried AWS spot instances for a bot? Thinking about migrating to that to save costs.

drowsy yew
#

HOLY

#

ITS SPAMMING LOL

ruby dust
#

ok

west raptor
#

How many instances are you running?

ruby dust
#

on message event

#

not instances

west raptor
#

huh

quartz kindle
#

is it spamming indefinitely or a limited number of times?

#

create a new project, then go to Compute Engine, and create a new instance. F1 micro is free (on US servers)

drowsy yew
#

It wont stop

#

Its just spamming and pinging

quartz kindle
#

shut it down

#

go to terminal/cmd and press ctrl+c

ruby dust
#

shit code then

drowsy yew
#

It stopped just now

#

I changed the code

topaz fjord
#

im gonna guess that you didn't ignore bots

quartz kindle
#

he doesnt, but his code wouldnt match what the bot was senting

drowsy yew
#

Apparently, I made it Loop the message "Hello Dad!"

quartz kindle
#

show your code again

drowsy yew
topaz fjord
#

ew taking my prefix

drowsy yew
#

wait what

west raptor
#

ok so

#

uhm

quartz kindle
#

you didnt change the =, remember when we talked about it?

drowsy yew
#

Oh yeah

#

mb

#

So I put ==?

west raptor
#

yes

#

ot

#

===

#

or*

quartz kindle
#

= is for assigning a value, if you try to assign it inside an IF, it will always be true, because the assignment was successful

west raptor
#

^

topaz fjord
#

=== doesn't do type conversion like ==

wheat marten
#

@quartz kindle it let me in even though I don't have a credit card

topaz fjord
#

ok

wheat marten
#

wait no

quartz kindle
#

it will ask you to set up a billing account at some point

west raptor
#

@topaz fjord I thought it was the other way around?

wheat marten
#

Any service that doesn't take a credit card?

quartz kindle
#

idk, see if anyone here is offering to share their vps

#

sometimes people offer in here

west raptor
#

DO accepts paypal iirc

topaz fjord
#

lmfao

#

you're making me think of ipad

wheat marten
#

I am thinking of using Glitch

topaz fjord
#

did I hear free hosting

#

banne

drowsy yew
#

It still isn't working

topaz fjord
#

show code

drowsy yew
#

I just changed the = to =x3

ruby dust
#

token

#

delete

#

reset

topaz fjord
#

you need to restart the bot

drowsy yew
#

How do I restart it again?

topaz fjord
#

Ctrl-C

#

then node <filename>

queen sentinel
#

omg did that picture actually have his token in?

topaz fjord
ruby dust
#

yes jonny, he was ignoring my warnings

wheat marten
#

how do I make a batch file that starts my bot??

topaz fjord
#

1 shard with 1 vc has 300 megs while the other with 3 vcs has 200

queen sentinel
#

@drowsy yew I'd recommend resetting your token

topaz fjord
#

mem leaks are fun

drowsy yew
#

Restarted

#

And Im gonna try again

queen sentinel
#

dude

#

Don't just post a picture of your token

drowsy yew
#

Wait what

wheat marten
#

oh god

drowsy yew
#

I did?

queen sentinel
#

that's like a -50IQ move

topaz fjord
#

@queen sentinel take control u wont no balls

queen sentinel
#

yes

drowsy yew
#

Oof, I didn't see it

wheat marten
#

yes it is 0 iq

drowsy yew
#

Mb

queen sentinel
#

I deleted the picture you sent

#

but reset it just in case

wheat marten
#

posting your token is dangerous

drowsy yew
#

I know

#

I forgot

#

Because I like

#

I kept sending this

#

So I thought I still had it copied n shit

#

@queen sentinel tysm

#

I literally thought that I forgot something for a min

wheat marten
#

@drowsy yew forgot a ";" after your token

ruby dust
#

does d.js not have commands extension or something?

drowsy yew
#

Oh

topaz fjord
#

@ruby dust thats commando

#

semi colons aren't needed in js

wheat marten
#

true

#

but people use em

#

lol

topaz fjord
#

It's for good code

drowsy yew
#

It can log in just fine

#

Gonna go reset my token

wheat marten
#

How do I make a .bat file that starts off my bot???

queen sentinel
#

can someone explain commando to me

topaz fjord
#

you know you can google how to execute a command from a bat file

#

@queen sentinel literally it has a command framework built in

#

so

#

like

queen sentinel
#

oh

topaz fjord
#

for the lazy people

queen sentinel
#

no wonder Oliy was opposed to me using it ages ago lmao

topaz fjord
#

no if statements for commands

wheat marten
#

so do I do

topaz fjord
#

idek if commando is even updated

wheat marten
#

start
/c node .
#

?

drowsy yew
#

Heck

#

I need help now

#

I regenerated and replaced the token

#

But now its offline

wheat marten
#

yea

queen sentinel
#

yea

#

that happens

wheat marten
#

you got to put the token in the code

queen sentinel
#

now you replace the token in your bot with the new one and restart it

drowsy yew
#

I know

#

I did

wheat marten
#

does this work /c "node ."

#

?

drowsy yew
topaz fjord
#

did you put the semi colon inside the string

#

please say no

drowsy yew
#

No, I don't think so

#

Got to get it up again

#

Any suggestions?

earnest phoenix
#

suggestions for what?

drowsy yew
#

How to get the bot back up

wheat marten
#

node .

#

is the command you run in the terminal

drowsy yew
topaz fjord
#

your token is wrong

queen sentinel
#

^

drowsy yew
#

Wdym

wheat marten
#

I just invented some rad VS code crashing code

topaz fjord
#

ok

wheat marten
#

everytime a command is used it logs it in the terminal

drowsy yew
#

Hoping it debugs

wheat marten
#

lol no

topaz fjord
#

and @wheat marten ?

#

that's easy to do

wheat marten
#

it won't debug by itself @drowsy yew

topaz fjord
#

it wont break vscode

wheat marten
#

@topaz fjord unless thousands of commands run

#

at the same time

topaz fjord
#

still wont

wheat marten
#

NAni

#

That would happen when I did Lua

drowsy yew
#

I know

topaz fjord
#

vscode uses command prompt/powershell

drowsy yew
#

I replaced the token

topaz fjord
#

it will break if those break

drowsy yew
#

And it still won't work

wheat marten
#

oh

#

forgot

drowsy yew
#

UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection.client.ws.connection.once.event

queen sentinel
#

You've put the token in wrong or something

#

cus it says the "login details" are incorrect

drowsy yew
#

Oh

queen sentinel
#

just remove the token and copy and paste the new one back in

drowsy yew
#

I'll try again

#

Still wont work

#

I've copy and pasted it several times now

topaz fjord
#

are you sure you're pasting the part that says bot token

drowsy yew
#

Yes

#

Its const Discord = require('discord.js');
const bot = new Discord.Client();
const TOKEN = (INSERT MY TOKEN HERE)

queen sentinel
#

is your token in quotes?

topaz fjord
#

is the token surrounded by ""

queen sentinel
#

like "" or ''

drowsy yew
#

Yes

queen sentinel
#

throw a ; at the end of the token line, just to be sure idk

drowsy yew
#

Ok

#

After the last ' or before?

topaz fjord
#

try regenerating the token again

drowsy yew
#

Regenerated

topaz fjord
#

and use the regenerated token

drowsy yew
#

Replaced

topaz fjord
#

now try to log in

#

/ start bot

drowsy yew
#

Im on java

#

So do I do /start bot?

topaz fjord
#

no

#

ur in js so use node <bot file>

queen sentinel
#

node . would work right?

knotty steeple
#

yes

drowsy yew
#

Error: Incorrect login details were provided.
at WebSocketConnection.client.ws.connection.once.event

knotty steeple
#

if the main file is in package.json

queen sentinel
drowsy yew
#

Nothing is working atm

#

aaHHHHHH

topaz fjord
#

im p sure node . uses the index file declared in package.json

knotty steeple
#

it does

queen sentinel
#

is there anywhere else where you use your token in your code or something?

knotty steeple
#

which is why i said if the main file is in package.json

drowsy yew
#

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

bot.on('message', function(message){
console.log("Ready"); if(message.content === 'tb!help')
{
message.reply('Sorry! ThomasBot Content has not been fully completed!');

}

});

bot.on('ready',function(){
console.log("Ready");

})
bot.login(TOKEN);

#

All the current code

knotty steeple
#

that code triggers me

drowsy yew
#

good

topaz fjord
#

not good

west raptor
#

```js

topaz fjord
#
const Discord = require('discord.js');
const bot = new Discord.Client();
const TOKEN = 'my token'

bot.on('message', (message) => {
    console.log("Ready"); 
    if (message.content === 'tb!help') {
        message.reply('Sorry! ThomasBot Content has not been fully completed!');
    }
});

bot.on('ready', () => {
    console.log("Ready");
})

bot.login(TOKEN);
``` if you want syntax highlighting
queen sentinel
#

only thing I'd do is chuck a ; after the token

#

but hey what do I know? ¯_(ツ)_/¯

drowsy yew
#

Ok

knotty steeple
#

@queen sentinel literally

drowsy yew
#

Before the ' or after?

knotty steeple
#

no difference

queen sentinel
#

aw

west raptor
#

semi-colons are optional in js

queen sentinel
#

I do it cus it just looks nicer to me

west raptor
#

afaik

#

in most cases i should say

knotty steeple
#

its like doing ```js
hi();

// vs

hi()

topaz fjord
#

es6 is hot

#

so is es7

knotty steeple
#

import GWqlabsFeelsKCHHH

#

require() GWqlabsFeelsGoodMan

topaz fjord
#

no

#

import is nice

knotty steeple
#

no

west raptor
#

i use import when using ts

knotty steeple
#

this aint python

west raptor
#

thats like

#

the only time i use it

queen sentinel
#

swear import isn't supported or something Thonk

quartz kindle
#

are you actually saving the file before you run it?

#

.>

queen sentinel
#

or am I thinking of something else

#

that's a good point Tim

topaz fjord
#

it isnt jonny, but there are transpilers that compiles es7 into es6

knotty steeple
#

i rather require than import

topaz fjord
#

babel is one

#

babel is nice

queen sentinel
#

no thank you

#

I didn't get to that on Codecademy thanks

knotty steeple
#

ok next talk

#

is node multithreaded

topaz fjord
#

i use import for react

drowsy yew
#

I give up on my bot, lol

topaz fjord
#

did you save the file mmLol

west raptor
#

literally what i said when i first started making a bot

#

i came back eventually mmLol

drowsy yew
#

Lol

quartz kindle
#

never give up :3

drowsy yew
#

It wont work anymore

#

hec

topaz fjord
#

or just take a break

reef oriole
#

i added a block on my random command and a big warning in help

drowsy yew
#

I did

quartz kindle
#

give me your token and i'll test it

#

:^)

topaz fjord
#

lmao

reef oriole
#

if it gets denied again i'm not sure what to do :\

drowsy yew
#

Ok ig

#

Tim og

knotty steeple
#

lmao

quartz kindle
#

he actually gave me LMAO

#

but dont worry, i wont do anything

drowsy yew
#

lool

#

k

quartz kindle
#

i'll test it

drowsy yew
#

Alright

quartz kindle
#

@drowsy yew it works

drowsy yew
#

O

quartz kindle
#

so your token is not the problem

drowsy yew
#

So is it online now?

quartz kindle
#

idk check your server

drowsy yew
#

Oh it is

#

Thanks so much

quartz kindle
#

lmao

#

but you have to run it yourself

#

once i close the program it will go offline again

drowsy yew
#

Oh

#

I'll try it

#

Can you send me the code you used?

quartz kindle
#

i literally copied your code

#

lmao

#

i'll send you in dm

drowsy yew
#

Oh

#

Lol

#

Gg

ivory cobalt
#

ok thx B pumkin

topaz fjord
#

@quartz kindle chrome dev console zoomeyes

quartz kindle
#

actually nw.js dev console

#

because node

wheat marten
#

Should I host my bot with Glitch?

lost scarab
earnest phoenix
#

why wont this work

client.on("guildCreate", function(client, message, args) {

module.exports  = async (client, guild) => {
    const invite = await guild.channels.find(c => c.type !== "category" && c.position === 0).createInvite({
        maxAge: 0
    });
    let guildCreateChannel = client.channels.get('505120663892394015');
    guild.createChannel("globe-logs", "text");
    let joinEmbed = new Discord.RichEmbed()
    .setTitle("Bot joined server!")
    .setThumbnail(guild.iconURL)
    .addField(`Server Name:`, `${guild.name}`)
    .addField(`Server ID:`, `${guild.id}`)
    .addField(`Server Owner:`, `${guild.owner}`)
    .addField(`Server Invite:`, `${invite.url}`)
    .setColor("#4286f4")
    .setFooter(`${client.config.botname}`)
    .setTimestamp();
    guildCreateChannel.send(joinEmbed);
}
});
knotty steeple
#

can you say what doesnt work?

quartz kindle
#

@lost scarab you have a bunch of weird stuff in that code

earnest phoenix
#

@knotty steeple the whole thing does nothing when the bot is added to a server

lost scarab
#

i just want an embed that gets reactions after sent

knotty steeple
#

ok please

lost scarab
knotty steeple
#

say why do you have

#

module.exports

quartz kindle
#

@lost scarab js message.channel.send({ embed: newembed .then(e => { e.react("1️⃣"); e.react("2️⃣"); e.react("3️⃣"); e.react("4️⃣"); e.react("5️⃣"); e.react("6️⃣"); e.react("7️⃣"); e.react("8️⃣"); e.react("9️⃣"); // 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ }) });
this for example, you're not closing the send() function, so you're basically doing embed: newembed.then(e=> ...)

lost scarab
#

oh i see

earnest phoenix
#

because i do @knotty steeple

knotty steeple
#

what

#

remove it

earnest phoenix
#

removed

#

still not working

knotty steeple
#

any error

#

@lost scarab for that reaction thing use a loop pls

earnest phoenix
#

no error

#

just sits in the code, does nothing

#

even though it should

topaz fjord
#

I don't recommend creating an invite for each guild

#

you will run into issues where you don't have perms

earnest phoenix
#

the bot isnt huge, im having it there until it grows

wheat marten
#

to host my bot on glitch do I just put my code on the site

topaz fjord
#

idk, google

knotty steeple
#

making server invite without permission from end user is against tos

#

if you have some eula stating the bot does that maybe

earnest phoenix
#

ok removed it then

#

now why wont it s´work

earnest phoenix
#

im just going to lurk here until i can help

#

how about now ("i can't type ;( ")

#

know?

#

Oof don’t forget
("i can't type 😭 ")

#

😂

earnest phoenix
#

@earnest phoenix Please.

#

You don't seem to understand how events work in Discord.js

wheat marten
#

I am too braindead on deciding what I should most my bot with

#

I don't want to use github

bright spear
#

github cant host bots...

wheat marten
#

no for like using glitch

earnest phoenix
#

ok

#

what do you mean

wheat marten
#

I don't know what service to use

earnest phoenix
#

for what

wheat marten
#

bot hosting

earnest phoenix
#

i thought you were using glitch?

bright spear
#

glitch is pretty good

earnest phoenix
#

^

#

but only if you want small js discord bots

#

Glitch is shit

#

Their interface looks like something a preschooler drew in his spare time bloblul

#

also that

bright spear
#

the homepage?

earnest phoenix
#

the whole site

bright spear
#

not the editor

earnest phoenix
#

the design of the site looks cartoonish

#

If you can afford a cheap Linux server, I highly recommend going with that

bright spear
#

i use glitch for some projects, not just because its free

#

its easy to update and has collaboration

earnest phoenix
#

Don't use glitch for hosting unless you absolutely can't be asked to spend like $2 a month on a server that will let you have so much more control

west raptor
#

Any reason this would fire multiple end events? (sorry for messy code, im kinda rushing)

function play(client, player, video, msg) {
    console.log(client.queues);
    if (!client.queues[msg.guild.id]) client.queues[msg.guild.id] = {queue: []};
    console.log(client.queues);
    client.queues[msg.guild.id].queue.push(video);
    console.log(client.queues);
    console.log('[ INFO ] Added song to queue');
    player.once("end", data => {
        console.log(data);
        if (data.reason === "REPLACED") return;
        msg.channel.send("Song has ended... Going to next song");
        console.log(client.queues);
        client.queues[msg.guild.id].queue.shift();
        console.log(client.queues);
        player.play(client.queues[msg.guild.id].queue[0].tracks[0].track)
    });
    if (player.playing) return;
    player.play(video.tracks[0].track);
}```
#

no errors btw

#

lots of console logs

#

wew

earnest phoenix
#

executing the function more than once?

#

That's my guess

west raptor
#

i only execute the function once in the entire file

earnest phoenix
#

Thonk
Check, real quick
make sure that you're not executing it twice

west raptor
#

i'm not

#

ive checked the whole file

earnest phoenix
#

What’s happening

#

Well, that doesn't make much sense, then..
The end event should only fire one time when the stream ends

#

Oof rip bot

west raptor
#

Yea

#

im so confused

#

like this is just pissing me off that this point

mild quarry
#

For some reason, embeds are only working if the bot has administrator permissions. Is it possible that they can say embeds if they aren't administrators? (discord.py)

trim saddle
#

what

knotty steeple
#

i think you mean embed links

mild quarry
#

I'm not embedding links

knotty steeple
#

what

trim saddle
#

embed links is what you need to generate embeds

knotty steeple
#

to make an embed you need embed links GWvictoriaNotLikeBlob

mild quarry
#

Ok

knotty steeple
#

discord edit pls

mild quarry
#

Oof

west raptor
#

@earnest phoenix could it be because im running the command multiple times?

#

imma try something

lavish forge
#

What kind of things are 'popular' for Discord Bots that would be best stored in a SQL db. Trying to get the backbones setup before I start in on commands so I don't have to go back and make edits.

potent frost
#

hey guys

potent cypress
#

Uh

potent frost
#

hey

potent cypress
potent frost
#

oh is the image deleted?

potent cypress
#

It's not the footer

potent frost
#

hmm.

potent cypress
#

It's uploaded fine, but it just hasn't put the image in the embed

potent frost
#

hmm

#

maybe sizing?

#

no discord auto scales it

potent cypress
#

Same code, rebooted the bot, the image is being generated fine but Discord isn't doing it right

potent frost
#

yea

#

i think this is on discords behalf

potent cypress
#

That's my thought too.

potent frost
#

wow

#

did my bot get kicked again 0.o

#

no nvm

#

im confused because it just left vc

#

and i didnt remember applying autoleave to this guild

#

when you added the alexa meme into ur bot's music feature

#

Feels Good

potent cypress
#

@ me if you find anything out

sick cloud
#

but it mucks up when small and open

#

so how do i fix this angeryBOYE

astral quail
#

@sick cloud you using a framework?

sick cloud
#

custom css

#

like fully custom

earnest phoenix
#

help

#

me

#

now

#
import youtube_dl
from discord.ext import commands

TOKEN ='token kid'
client =  command.bot(command_prefix='B'

players = []

@client.event
async def on_ready():
   print ('bot online')
    
@client.command(pass_context=True)
async def join(ctx):
    channel = ctx.message.author.voice.voice_channel
    await client.join_voice_channel(channel)
    
@client.command(pass_context=True)
async def leave(ctx):
    server = ctx.message.server
    voice_client = client.voice_in(server)
    await voice_client.disconnect()

@client.command(pass_context=True)
async def play(ctx, url):
    server = ctx.message.servere
    voice_client = client.voice_client_in(server)
    player = await voice_client.create_ytdl_player(url)
    players[server.id] = player
    player.start()

client.run(TOKEN)```
#

whats wrong with this

solid cliff
#

missing )

earnest phoenix
#

oh

#

fixed it but i still get error

solid cliff
#

yeswhaterror

earnest phoenix
#

all

#

good now its working

#

i was missing a little space

#

lol

#

well

#

now

#

nvm

#

lol

broken slate
#

Hello , someone can give me a function in discord.js , when i send a command '!clean' it will delete all messages of my bot pls

sick cloud
#

get the last 100 messages from the channel

#

filter the author id to your bots

#

and then delete

earnest phoenix
#

actually thinking they know how to do that topkek

lilac spire
#

guys

#

<@&265158261945270273>

#

i need to add my bot

#

its online

#

but its not responding

languid dragon
#

pls dont ping us all for a request one person could handle 😩

#

you add your bot on the website
if it's not responding that's a you problem not us?

earnest phoenix
#

@lilac spire there is nothing to do with the website registry

#

And, to be honest, you need to be more clear

lilac spire
#

i added it

#

but no verify

hollow fulcrum
#

How do I parse json?

#
    @commands.command(name='ai', description='Talk to an AI!', brief='Talk to a robot.', aliases=['talk'])
    async def ai(self, ctx, *, talk):
        if ctx.author == self.bot.user:
            return
        if ctx.author.bot:
            return
        payload = {'input': str(talk)}
        url = 'http://ask.pannous.com/api'
        r = requests.get(url, data=payload)
        data = r.json()
        datap = data[0]
        send = datap
        ctx.send(send)```
#

wont work

#
{
  "info": {
    "apiVersion": "1.1.0",
    "clientFeatures": [
      "say",
      "open-url",
      "show-url",
      "show-images",
      "reminder"
    ],
    "clientTime": "2018-10-26T12:14:49.536Z",
    "detectedLanguage": "en",
    "emotions": [],
    "input": "tell me a joke",
    "isNewUser": true,
    "locale": "en",
    "login": "test-user",
    "responseTime": 288
  },
  "output": [{
    "actions": {
      "custom": {},
      "say": {"text": "What do wizards stop for on the highway?"}
    },
    "entities": {
      "dialoguesInfo": {
        "dialog": "wizard",
        "dialog_id": "1109",
        "forced": false,
        "initiative": false,
        "match_id": "1166758",
        "matchscore": "4.77",
        "response_id": "1166765"
      },
      "input": "tell me a joke",
      "locale": "en"
    },
    "handler": "Dialogues",
    "responseTime": 158,
    "results": {}
  }]
}```
#

is json

native folio
#

how to make a client command that is a poll command and it reacts with thumps up and thumbs down

earnest phoenix
#

I recoded my bot so it was way more effecient but it still has these moments.. http://prntscr.com/laqg8n is there any method in discord.js to reduce memory and cpu usage??

Lightshot

Captured with Lightshot

quartz kindle
#

how many servers is it in?

earnest phoenix
#

idk like 160 with over 1.5mil users

quartz kindle
#

is it a music bot?

earnest phoenix
#

It has music and a neural network

quartz kindle
#

then idk, those are probably the reasons

earnest phoenix
#

is it possible to like clear caches of discord.js emoji's or something

quartz kindle
#

double/triple check for possible memory leaks, reuse variables as much as possible instead of creating new ones

earnest phoenix
#

Okay

quartz kindle
#

you can clear user and message cache

earnest phoenix
#

Is that a option on creating the Client?

quartz kindle
#

there is an option to auto sweep messages, but not users

earnest phoenix
#

I also guess I can disable events that aren't needed

#

okay thanks bro.. I'm getting a better host soon 🙏

#

neural net and music blobsweat yeah theres ur problem

#

lmao

#

I disabled a ton of events and stuff and its really working :DDDD

#

not all events safe to disable

#

wym

#

for example channel create/delete, ur bot wont know of new channels and wont work there

#

GWjiangoOmegaLUL really?

#

yes

#

oh damn bloblul

#

Because the database is a good 50MB

tulip axle
#

Hey guys, does anyone know with discord.js how to get the last message sent by the bot?

#

(even if the bot restarts)

hushed berry
#

You'd have to store that externally

zealous idol
#

hey

wheat marten
#

Should I have a github acc if I use glitch

quiet orbit
#

I say Yes

lost scarab
#

anyone knows how to make a battle between 2 people? GWseremePeepoThink

wheat marten
#

Yggdrasil 😉

sick cloud
#

how does a library like d.js get the gateway ping?

quiet orbit
#

Client.ping ?

#

that one ?

lost scarab
#

@wheat marten i want to make

earnest phoenix
#

using code

#

duh

lofty abyss
#

am very confused

#

{
"prefix": "!",
"token": "Blured",
"devID": "276364682695278602",
"dbUrl": "mongodb://Mysterious:Password Blured@ip Blured:27017/Suggestions",
"embed": {

earnest phoenix
#

Does anyone have an example of making an economy bot with Node?

#

I'm currently using discord-eco but it sucks.

lofty abyss
#

am so mind blown

#

does anyone know? <@&304313580025544704>

loud salmon
#

🤦

earnest phoenix
#

mongodb auth error tickYes didnt read the error at all tickYes ping all mods tickYes dbl dev channel mmLol tickYes

knotty steeple
#

@tulip axle get the bot user and look for lastMessage iirc

#

<Client>.users.get(<Client>.user.id).lastMessage should work

sick cloud
#

@earnest phoenix get a database, design ur eco, implement it, profit

#

why people use pre built blows my mind

earnest phoenix
#

i swear to god people would use a node module that checks if a boolean is true or false

sick cloud
#

i should make that

earnest phoenix
#

yaes FeelsGoodMan

uncut delta
#

lol

earnest phoenix
#

l m a o

hardy sierra
#

how to log messages that was deleted

#

but that it would log even who deleted the message

#

@earnest phoenix all economy systems requires sql

earnest phoenix
#

I know, I am just looking for a tutorial on it. The docs are a bit confusing.

chrome olive
#

i can cunstomize the background?

#

@bitter sundial

bitter sundial
#

only cert devs

chrome olive
bitter sundial
#

cert only

chrome olive
#

xD

earnest phoenix
#

@bitter sundial when was the bot page css cert only?

bitter sundial
#

css is not cert only

chrome olive
#

My bot must have over 1k servers to become certified?
@bitter sundial

bitter sundial
#

certification is being reworked and is still closed

chrome olive
#

ok

hardy sierra
#

how to log messages that was deleted
but that it would log even who deleted the message

topaz fjord
#

message delete event

hardy sierra
#

yeah i know

#

but i dont know whats the line for like WhoDeletedMessage

topaz fjord
#

The deleted message should have a property for getting the author

hardy sierra
#

yea

#

but if someone else deletes someones message

topaz fjord
#

then you would probs have to check the audit log

hardy sierra
#

its still possible to make

#

how to log messages that was deleted
but that it would log even who deleted the message

#

only for those who knows the events

raven torrent
#

is there a way to clone a channel ?

smoky spire
#

@raven torrent what lib

#

@hardy sierra you have to check the audit log to see who deleted the message

raven torrent
#

@smoky spire

warm marsh
#

hey need help

#

with message.mentions.channels.first().id;

#

is it correct or am i doing something wrong?

smoky spire
#

It's correct

warm marsh
#

But it returns undefined

smoky spire
#

As long as message is a proper message object

warm marsh
#

I do it like this

smoky spire
#

If it's undefined, you didn't mention a channel

warm marsh
#

but returns undefined

warm marsh
#

oh... So how do i create a invite to message.channel; and get the code

#
var invite = message.channel.createInvite();
var code = await invite.code;
#

but doesnt work

earnest phoenix
#

You need to await the createInvite() function

#

Then you can get the code

warm marsh
#

with code = await invite.code?

earnest phoenix
#

Don't await the code Thonk

warm marsh
#

why

#

?

#

it returns promise otherwise

west raptor
#

await the createInvite

warm marsh
#

done that

#

ok works now

slim heart
#

Ok, so, I'm really quite confused at this point, I've done so much googling I can't stand the logo anymore. I've been trying to change a variable in a json file, just defined at an object in the code. I've tried the .push(), and I've learned that you can't do that because push is for arrays, I get that now, but even when I tried to do the other things I saw like, JSON.parse(obj).push(), it still never seems to actually work.

drowsy yew
#

(js) Im trying to make my bot run a Coin Flip command,

#

But when I run it, it wont execute.

knotty steeple
#

the run function is outside the class

drowsy yew
#

oof

#

How do I fix it?

knotty steeple
#

put it in the class

slim heart
#

Can i get some help on mine?

mossy vine
#

@slim heart look up object methods for your language

drowsy yew
#

I don't think I understand how

slim heart
#

@drowsy yew wdym, u just select the async run, then click ctrl+x, then go to the class brackets, and hit ctrl+v

drowsy yew
#

Oh

#

Now it just gave me more problems

heady zinc
#

@slim heart change a variable in a json file?

#

excuse me?

slim heart
#

like change a specific part of the json without changing the others

#

u know what i mean

drowsy yew
#

Can anybody help?

#

Nothing is working

#

it says it doesn't have any problems

heady zinc
#
let object = JSON.parse(json);
object.memes = true;
json = JSON.stringify(object);
``` ?
slim heart
#

So like say

{
"hello": 1,
"goodbye": 0
}```
and say I wanted to change hello, yeah i could rewrite the file, but i'd also like to say change "hello" from 0 to 1
heady zinc
#

yeah

earnest phoenix
#

@drowsy yew just a heads up you have MathF.random()

heady zinc
#

refer to what i posted above then

drowsy yew
#

I know

#

Its part of the command

#

Its a random coin flip

earnest phoenix
#

so you have mathf defined

slim heart
#

this happened before when i tried JSON.parse(obj).push(yada)

heady zinc
#

you can't parse a non-json object

slim heart
#

(the same error)

#

homo

#

I see

#

I feel stupid

#

oh my

#

ok well

#

How would I append to that?

heady zinc
#

same way you would change a value

earnest phoenix
#

append?

heady zinc
earnest phoenix
#

I think you mean to say something else

slim heart
#

I mean both tbh

#

I tried figuring out appending

#

but whatever

heady zinc
#

literally same way

#

object.wew = true;

slim heart
#

ok yeah i feel like an idiot

#

obj['hi'] = 0

#

hh

heady zinc
#

works too yes

#

the fundamental thing to know about JSON is that it's just an object in the end, once parsed you interact with it like an object blobmeowsip

high tinsel
#

if I have this api

#

how do I ask for the hex thing?

#

color.body.colors[0].hex

#

is not working

slim heart
#

fs.writeFile(JSON.stringify(JSON.parse(fs.readFileSync('C:/Users/jpb/Desktop/bot/priv/server_data/' + message.guild.id + '.json')['censor'] = 1)))
Is there something wrong with this or am I just too meta and it won't do it?

heady zinc
#

wrongly placed parenthesis but it should work

#

though JSON files for database purposes is strongly not recommended

slim heart
#

I'm actually transfering from db to this rn

#

Idk why I just find it easier and my machine runs fine honestly

heady zinc
#

you shouldn't

topaz fjord
#

wait transferring from db to json

slim heart
#

yes

#

lol

topaz fjord
#

am I in hell?

slim heart
#

No i am

topaz fjord
#

I think I am

slim heart
#

I'm the one whos doing it u sure?

heady zinc
#

it works fine at a very small scale, the difference in performance between an actual database and "this" is just ridiculously big

slim heart
#

btw @heady zinc i figured out why it doesnt work

#

fs.writeFile()

#

I didnt have a dir

heady zinc
#

also databases usually offer more features than what limited objects can do

topaz fjord
#

what db are you switching from

quartz kindle
#

be careful how you handle json files

slim heart
#

i just had the file

quartz kindle
#

the slightest error will destroy the entire file

topaz fjord
#

@heady zinc baguette db when

heady zinc
#

never

slim heart
#

I have seperate files per server

topaz fjord
#

stores data in the words baguette

#

Separate files per server

slim heart
quartz kindle
#

wtf

topaz fjord
#

If I did that I would have 2.5k files and I don't want that

heady zinc
#

this is even worse than having a single object

topaz fjord
#

If I did the same for users I would have 180k

quartz kindle
#

you're using 2.5mb block size?

slim heart
#

each file is only like 5kb

#

so

#

1*

quartz kindle
#

the file is 10kb, but its using 2.5mb disk space lmfao

topaz fjord
#

tf

#

fun

quartz kindle
#

oh thats a folder

#

nvm

topaz fjord
#

Your a folder

quartz kindle
#

its 32kb allocation size, makes sense

topaz fjord
#

I'm about to live with Ubuntu server mmLol

slim heart
#

ok for some reason when i write a file it comes up with this <Buffer 7b 20 22 63 65 6e 73 6f 72 22 3a 20 30 20 7d>

#

as a return

#

and in the json its basically the same thing just in json format

heady zinc
#

that's normal

quartz kindle
#

you need to set utf-8

#

else it uses buffer as default

#

("file","encoding",callback)

bitter sundial
#

{ "censor": 0 } :)

zenith moss
#

Where do I go to get a webhook url?

#

I've tried the webhooks in channels but it doesnt work.

topaz fjord
#

you have to set up the server that receives the webhook and the url is the url of the webserver

#

dbl webhooks dont work with discord

zenith moss
#

ohhh

rapid citrus
thin loom
#

did you send that image with that

topaz fjord
#

you cant

#

that would be a self bot

zenith moss
#

Where would I go to setup a server to get the webhooks?

cinder gate
quartz kindle
#

idk whats your structure

#

but there are many things you can do

#

margins, vertical-align, position: absolute...

#

dont use transform unless you need to, its a waste of resources

cinder gate
#

I know that much.

#

My structure:

      <div class="info">
        <div class="mc healthbox">
          <span id="mobname"></span><br>
          <span id="mobhealth"></span>/<span id="mobttlhealth"></span> HP<br>
          <span id="mobeffects"></span>
        </div>
        <div class="uc healthbox">
          <span id="playername"><?php echo $username; ?></span><br>
          <span id="playerhealth">15</span>/<span id="playerttlhealth">15</span> HP<br>
          <span id="playereffects"><b><u>No Effects</u></b></span>
        </div>
      </div>
      <div class="brdr">
      </div>
      <div class="story">
        451 Character MAX
      </div>
    </div>```
#

It's not a margin issue.

#

Vertical align works- Thanks, @quartz kindle!

quartz kindle
#

vertical-align is good when you're using inline-blocks

cinder gate
#

Looking Good so far, Thankkks~

onyx summit
#

so, I have a bot that should play short audio clips, he does, but with small lags (like playing faster, making very short breaks)
my vps usage is really not high, (cpu under 10% and ram okay too)
tested download/upload speed:

#

(d.js)

earnest phoenix
#

either:

  • blocking event loop
  • oversold vps
onyx summit
#

blocking event loop?

quartz kindle
#

are you reading files with a sync function?

earnest phoenix
#

nah is just oversold vps

#

cpu usage lies on scuffed vps js

onyx summit
#

doubt man

earnest phoenix
#

run code on ur own pc in a single server

#

and u get noe lag

#

guarantee

onyx summit
#

I runned a forge server with 20 mods and nothing lagged

quartz kindle
#

do you have a lot of short audio clips? if its not a lot, you could cache them in memory

#

but idk what you're using for processing audio

earnest phoenix
#

like i said just run it local and u get no lag

#

then is just bad vps host

onyx summit
#
 voiceChannel.join().then(connection => {
        const dispatcher = connection.playFile('./music/airhorn.mp3');
        dispatcher.setVolume(volume);
        dispatcher.on('end', () => {
            voiceChannel.leave();
        });
    });
earnest phoenix
#

djs voice isnt that bad dw

#

its not caused by that

onyx summit
#

dude, how would you explain a mc server with 20 mods & no lag

earnest phoenix
#

because music is more noticable to minor lag

topaz fjord
#

or just use lavalink

onyx summit
#

@earnest phoenix just want to notice I was talking about very small lags, for example having the music playing faster for a short time, or having a really short delay. things like that. I now hosted it on my pc and got the same result

quartz kindle
#

you coult try playStream instead of playFile

#

you have to create a readable stream first

earnest phoenix
#

xd

sick cloud
#

the right aligned links aren't all the way along

gusty rune
#

hey, guys does changing username from discord dev panel change the name of the bot?
or i need to make a command to do it
cause i changed the name and only the roles name got changed not the bot it self.

quartz kindle
#

whats your css like?

sick cloud
#

none

#

just bootstrap

quartz kindle
#

then do float:right

sick cloud
#

@gusty rune you have to change it on the bot page

#

oh ok

#

i already use mr-auto to push it to the right but it doesnt go all the way

quartz kindle
#

idk if bootstrap has its own css, but mr-auto is the only difference between the left menus and the right ones, so try float:right on .mr-auto

sick cloud
#

ok

#

makes no difference

quartz kindle
#

you can right click it and inspect element to see whats the css structure

#

and experiment on it live

gusty rune
#

@sick cloud i have

#

thats why i asked cause the name it self didnt change yet

#

but the role that the bot has is changed

sick cloud
gusty rune
#

yes

sick cloud
#

you have to click on the bots profile and wait a bit

#

and itll refresh

gusty rune
#

k ill just wait 12h

#

lol

sick cloud
#

not that long

gusty rune
#

k just changed

#

thx

#

LOL

frigid thistle
#

Im making a dbl api wrapper

#

dbl.js

knotty steeple
#

we dont need another one

frigid thistle
#

ik

#

it's just a project :p

pale marsh
#

@sick cloud don't use a container in a navbar

#

Also try ml-auto instead

sick cloud
#

i fixed it, thanks though

rapid citrus
#

damn, this setTimeout timeout parameter, why it uses milliseconds btw? any one know other remedies for this. I'm not too export with javascript

earnest phoenix
#

1000 = 1sec

#

thats all you need to know

rapid citrus
#

yeah I know man.

#

my timeout is 3 months

#

and its overlapped to the maximum value.

#

I don't know if javascript supports long values

#

oh I know now. I will just set the timeout to 2147483647 when it is larger than that.

#

damn.

sick cloud
#

so has anyone ever used express and knows how to do a "user online" session type thing?

earnest phoenix
#

you can use websocket to show like "x people online" or smth

sick cloud
#

not helpful

#

idk how to mark users as online or not

earnest phoenix
#

I am trying to make a command called 8ball, Can anyone help?

sinful lotus
#

make an array of response, use Math.Random to pick a random number from that array

earnest phoenix
#

How to make a play command work, Current coding,

  if (!args[0]) {
    message.reply("Please provide a link or title.");
    return;
  }

  //if(args[0].indexOf("youtube.com") === -1){
  //  message.reply("only YouTube links are supported at the moment");
  //  return;
  //}

  if (!message.member.voiceChannel) {
    message.reply("You must be in a voice channel!");
    return;
  }

  let player = Players.get(message.guild, true);

  Entry.fromMessage(Client, args.join(" "), message)
    .then(data => {
      let { entry, msg } = data;

      player.addToQueue(entry);

      if (msg !== null)
        msg.edit(`Added ${entry.getInfo().getTitle()} to the queue`);
      else message.reply(`Added ${entry.getInfo().getTitle()} to the queue`);

      if (!message.guild.voiceConnection) {
        message.member.voiceChannel
          .join()
          .then(conn => {
            player.setConnection(conn);
          })
          .catch(e => {
            player.destroy();
            Players.remove(message.guild);

            message.reply(`Error joining voice channel: ${e}`);
          });
      }
    })
    .catch(console.error);
});
#

is this eris

#

discord.js package on glitch

#

oh

#

it looks like eris from the command registering (sort of)

#

I could probably get eris on glitch

#

yea

#

ive done it

#

are you getting an error with that setup?

#

I don't get errors with the code setup, The command won't work atall.

#

lol i dont get errors

#

use something like sentry/raven

#

so you can get errors

#

On glitch?

#

no ill dm you the link

#

KK

earnest phoenix
#

that wasn't even proper js

austere sedge
#

Can someone make a example on how to make a NSFW command in discord.py (not rewrite)

low rivet
#

you can't

stoic vigil
#

im literally just starting out in this

#

and i tried running it

earnest phoenix
#

smells daneeko You smell like my brother

stoic vigil
#

no but really

#

anyone has any idea?

bright spear
#

Looks like you're using discord.net; I doubt much people here know it so it would probably be a better idea to ask in the discord.net server

zealous veldt
#

Damn that response sounded clippy like @bright spear

stoic vigil
#

oh

#

ok

#

where can i find it

split dune
#

xd

stoic vigil
hardy sierra
#

guys

#

how to make my bot never crash on errors

knotty steeple
#

process manager

#

like pm2

hardy sierra
#

whats that

knotty steeple
#

no wait

#

never crash being not going offline

hardy sierra
#

what do you mena

#

mean

#

i just need that if my bot throws an error

#

that it wouldnt go offline

knotty steeple
#

well if you get a connection error with discord thats impossible

#

just have a process manager restart it on crash

hardy sierra
#

if i write: ~profile @mentionsomeone

#

then its good

#

but if i write ~profile name

#

it throws an error

knotty steeple
#

ok then fix ur code

hardy sierra
#

how

earnest phoenix
#

you need to write an exception with if then

hardy sierra
#

if (!message.content === @)

#

message.send("mention someone please")

#

else (the whole code)

earnest phoenix
#

what lib?

hardy sierra
#

discord.js

earnest phoenix
#

you need to check if mention exists

hardy sierra
#

how

earnest phoenix
hardy sierra
#

yeah but how

#

i always read docs

#

how to make that it would check if the message contains mention

#

it doesnt even say what can i use after .mentions

knotty steeple
hardy sierra
#

owww

#

so

earnest phoenix
#

then you need to test it out ¯_(ツ)_/¯

hardy sierra
#

if (message.metions.members) {

#

right?

knotty steeple
#

no

#

members is a collection

#

of mentioned members

hardy sierra
#

ussers?

#

if (message.metions.users) {

knotty steeple
#

users is a collection of mentioned users

#

just get the first one

hardy sierra
#

if (message.mentions.users.first()) {

knotty steeple
#

test it out

hardy sierra
#

that worked

#

im just a bit dumb

#

i had the message.mentions.users.first()

#

in my code

#

like message.mentions.users.first().tag

#

and stuff

#

and i didnt even realise

amber junco
#

Why is my nick Hoister no hoisting?

earnest phoenix
#
  1. not a development 1uestion
#

2.because you had a dumb username starting with ! that puts you at the top of the list

earnest phoenix
#

"1uestion" yes i love it

west raptor
#

I kinda need help... Basically I have an event firing as many times the command is ran (say I ran the command 5 times, the event; fires 5 times) Play function code: js function play(client, player, msg, song) { if (!client.queues[msg.guild.id]) { client.queues[msg.guild.id] = {queue: []} } const queue = client.queues[msg.guild.id].queue if (player.playing) { queue.push(song); console.log('Added song to queue') } else { queue.push(song); console.log('Added song to queue'); player.play(queue[0].tracks[0].track); } player.once('end', data => { if (data.reason === 'REPLACED') return; console.log('Debug') }); } play command code: js if (!msg.member || !msg.member.voiceChannel) return msg.reply("Must be in a voice channel"); const player = await client.player.join({ guild: msg.guild.id, channel: msg.member.voiceChannel.id, host: util.getIdealHost(client, msg.guild.region) }, { selfdeaf: true }); if (!player) throw "No player found..."; const song = await util.getSong(args.join(' ')) util.play(client, player, msg, song)

lost scarab
#

does anyone know how remove sqlite points?

earnest phoenix
#

function 😩

#

log the player.playing and not playing @west raptor