#development

1 messages · Page 490 of 1

earnest phoenix
#

If playing, when trying to add a song to queue, it will stop the one playing, then won't load the next

#

It will play, run the command, then stops, run the command again, and it starts back fine

#

No error in console

molten pewter
#

still trying to find a good way to deep fry images using imagemagick

earnest phoenix
#

anyone know how i can make a command for my bot so if i do --setstatus dnd test watching then it would set the status to say watching test and it would be do not disturb

rustic axle
#

Have a variable

#

Look up how to set presence in d.js (assuming you are using that)

#

And have the command set the variable to whatever comes after the command

#

Easy

earnest phoenix
#

im noob, will it say how to make it come after variable on the wesite?

neat falcon
#

wesite

earnest phoenix
#

i dunnp

#

as i daid

#

said

#

noob

#

anyone know how i can make a command for my bot so if i do --setstatus dnd test watching then it would set the status to say watching test and it would be do not disturb

#
earnest phoenix
#

So how do i put a pause between two messages (eg first message sends, then 5seconds later the second one sends)

knotty steeple
#

settimeout

earnest phoenix
#

And how exactly do i use that

knotty steeple
#

do you have to make that in bold

earnest phoenix
#

Yes

#

i do

knotty steeple
#

stop

earnest phoenix
#

k

dense needle
#

@quartz kindle keeping variables in memory is not an option if you want to keep your application stateless

lusty dew
#

I need help with something. It keeps saying I need a role but I have that role

earnest phoenix
#

ok

lusty dew
#
if(!message.channel.nsfw) return message.reply(`Sorry, NSFW Commands can only be used in NSFW Marked channels only`)
    let gRole = message.guild.roles.find(`name`, "18+")
    if(!message.member.roles.has(gRole)) return message.reply(`Sorry you need the ${gRole.name} role to use this command`)
#

That is my code

short mica
#

@lusty dew ok?

lusty dew
#

It keeps saying I have the role

#

I mean

#

It keeps saying I don't have the role

earnest phoenix
#

but

lusty dew
#

even though I do

earnest phoenix
#

do you have the role

lusty dew
#

Literally

#

What i JUST said

#

Yes I have it

vernal rivet
#

What's wrong @lusty dew ?

lusty dew
#

It is saying I don't have a role when i have it

vernal rivet
#

How did you define it

lusty dew
#
if(!message.member.roles.has(gRole)) return message.reply(`Sorry you need ${gRole.name} to use this command`)
vernal rivet
#

Ummmm

lusty dew
#

?

#

Oh also

#

It may be a problem with this

#
let gRole = message.guild.roles.find(`name`, "18+")
vernal rivet
#

Is there no error?

lusty dew
#

Nah

#

It just keeps sending the

#

message.reply(Sorry you need ${gRole.name} to use this command)

#

That

#

Keeps sending that

vernal rivet
#

Ummmmm....and your console is clear?

lusty dew
#

(node:832) DeprecationWarning: Collection#find: pass a function instead

#

I showed that to someone this morning, they didn't say anything about it

#

so I thought it was fine :/

vernal rivet
#

That's your problem

west raptor
#

.find(this => this === this)

knotty steeple
#

use a function instead of "name", "value"

vernal rivet
#

Your making find into a function

knotty steeple
#

dream

#

why

west raptor
#

im lazy

vernal rivet
#

Lol

earnest phoenix
#

that's cool

#

Just like me

lusty dew
#

No

#

@earnest phoenix Fuck america

#

Lol

earnest phoenix
#

😭

west raptor
#

woah

lusty dew
#

It is burning

west raptor
#

there

earnest phoenix
#

So nice

vernal rivet
#

Woah

earnest phoenix
#

Nicest people on the planet

west raptor
#

hold up

lusty dew
#

Not you but like America is burning cause of Trump

west raptor
#

nobody insults my boi america

#

or jonny

earnest phoenix
#

Thank you

lusty dew
#

We almost got into world war 3 cause of Trump

west raptor
#

no

earnest phoenix
#

How?

lusty dew
#

Yes

vernal rivet
#

Take that somewhere else, not in here

lusty dew
#

Ok

#

Sorry

earnest phoenix
#

like

vernal rivet
#

Thank you

earnest phoenix
#

where?

#

I need to know

west raptor
earnest phoenix
#

ok

lusty dew
#

I am reading anidiotsguide

#

Idk

#

why*

west raptor
#

hm

#

try getting the role id instead

lusty dew
#

They did exactly what I did

vernal rivet
#

That's what I said

lusty dew
#

Oh ok

#
 let gRole = message.guild.roles.get("492821208924946452")
    if(!message.member.roles.has(gRole.id)) return message.reply(`Sorry you need the ${gRole.name} role to use this command`)
#

So like that?

vernal rivet
#

``find("name", "<role name>");` is decrepited

lusty dew
#

Ah ok

quartz kindle
#

decrepited

lusty dew
#

lol

#

Hey Tim

vernal rivet
#

If your looking by name you have to do .find("name" => r === "<role name>"); right?

lusty dew
#

How would one log when messages are deleted and then send them out in an embed?

vernal rivet
#

It would be a event

lusty dew
#

Ok

vernal rivet
#

Anything that happens with out a command line is basically a event

lusty dew
#

Ah ok

vernal rivet
#

Yes

lusty dew
#

it would be a messageDelete event right>

#

?*

vernal rivet
#

Yes

knotty steeple
#

what

#

that code is very wrong

#

.find("name" => r === "<role name>"); GWvictoriaNotLikeBlob

earnest phoenix
#

why dont this work?

    member.ban(reason)
    await new Promise(resolve => { setTimeout(resolve, 5000) })
    bandel.delete()```
it dont send a message and theres no error
#
 await new Promise(resolve => { setTimeout(resolve, 5000) })```
#

what is the purpose of this?

#

Why do you need this?

#

to wait 5 seconds them delete the ban message

knotty steeple
#

just do a settimeout

#

why do you need a promise

earnest phoenix
#

idk

#

that just what I always used

lusty dew
#
client.on("messageDelete", msg => {
    let embed = new Discord.RichEmbed()
    .addField("Message Deleted:", msg)
    .addField("Time:", msg.createdAt.toDateString)
    msg.channel.send(embed)
});
#

Would this work?

earnest phoenix
#

I dont understand why people make that

#

whats the use its just annoying

dusk skiff
#

Blacklists

earnest phoenix
#

msg.channel.send({embed})
@lusty dew

#

I guess but it gets very annoying @dusk skiff

dusk skiff
#

Yeah

earnest phoenix
#

@lusty dew make sure to disable it or move it to #265156361791209475 for this server or ur bot will get muted

lusty dew
#
    let embed = new Discord.RichEmbed()
    .addField("Message Deleted:", msg)
    .addField("Time:", msg.createdAt.toDateString)
    
    modchannel = msg.guild.channel.find(`name`, "mod-logs")
    if(!modchannel) return msg.channel.send("Couldn't find mod-logs channel");

    modchannel.send({embed})
#

Would this work better?

#

Also this is a private bot

earnest phoenix
#

if its private you can just search for it using the chat id incase you change the chat name @lusty dew

lusty dew
#

Ah yes

#

Good Idea

smoky spire
#

It's better without the curly brackets

#

In the send

earnest phoenix
#

makes no differance

lusty dew
#

Yea

#

I notice lol

smoky spire
#

With the curly brackets it can sometimes throw an error

earnest phoenix
#

ive never got an error

smoky spire
#

Hence "sometimes"

lusty dew
#

It did nothing

#

Lol

#

Did not even send the embed

earnest phoenix
#

any error?

lusty dew
#

Nope

smoky spire
#

Is it in curly brackets?

earnest phoenix
#

i doubt it @smoky spire

lusty dew
#

Nah it isn't

#

Still did nothing

smoky spire
#

Change that guild.channel.find to guild.channels.find

quartz kindle
#

you dont need guild

#

client.channels.get(id)

smoky spire
#

They're finding by name

earnest phoenix
#

you could do
const chat = client.channels.find("id", "chat id")

quartz kindle
#

thats depreciated

#

its find(function())

#

not find(arg,arg)

smoky spire
#

Using find on client.channels doesn't confirm guild

earnest phoenix
#

works for me

#

¯_(ツ)_/¯

lusty dew
#

It is still doing nothing

smoky spire
#

Being deprecated doesn't mean it doesn't work

earnest phoenix
#

im just weird

quartz kindle
#

regardless, he said its a private bot, meaning used in only one server, meaning better have a static id

#

in case of channel name change

smoky spire
#

True

lusty dew
#

Yea

quartz kindle
#

also

#

idk how your code looks like right now

earnest phoenix
#

its up

quartz kindle
#

but im pretty sure you cant add the entire message object to the field

lusty dew
#
client.on("messageDelete", message => {

    if(neko == undefined || addict == undefined){
       neko =  client.users.find("id", "479603748382179329"),
       addict = client.users.find("id", "337808716172886017")
    }
    let embed = new Discord.RichEmbed()
    .addField("Message Deleted:", message)
    .addField("Time:", message.createdAt.toDateString)
    .setTimestamp()
    .setFooter(`Owner's of the bot: ${neko.tag} ${addict.tag}`)
    
    modchannel = message.channels.get("492835442354552844")
    if(!modchannel) return message.channel.send("Couldn't find mod-logs channel");

    modchannel.send(embed)
});
vernal rivet
#

?

earnest phoenix
#

oof

quartz kindle
#

addField message.content

west raptor
#

@earnest phoenix .delete() for messages you can have a timeout before deleting without actually making a timeout (ie. message.delete(5000))

lusty dew
#

Ah ok

earnest phoenix
#

but wouldnt it delete the recent message @west raptor

quartz kindle
#

also, if you're matching against undefined

west raptor
#

what

quartz kindle
#

better do it like this

#

if(typeof variable === "undefined")

earnest phoenix
#

message.delete(5000) would delete the most recent message

west raptor
#

isnt typeof() @quartz kindle

quartz kindle
#

nope

west raptor
#

what

lusty dew
#
    if (papi == undefined || sanae == undefined) {
        papi = bot.users.find("id", "479603748382179329");
        sanae = bot.users.find("id", "201745963394531328")
    }

I was going off of an earlier bot I did and it works

#

That is from the other bot I used it from

vernal rivet
#

Yes it would delete the message

quartz kindle
#

or you know, you can simply do !papi || !sanae

west raptor
#

@earnest phoenix is it in a command?

lusty dew
#

?

#

Wdym?

vernal rivet
#

No this is a event

lusty dew
#

Honestly

#

I don't even need that

#

I just wanted it lol.

#

It is supposed to tell the names of the owners

#

no matter if they change it or not

earnest phoenix
#

let mute = await msg.channel.send({embed}) mute.delete(5000) @west raptor ?

quartz kindle
#

if you have a variable and you need to know if its empty or not, you do if(!variable) (if NOT variable, matches with false, undefined, "", 0, null)

west raptor
#

that would work?

earnest phoenix
#

idk

west raptor
#

try it

#

¯_(ツ)_/¯

lusty dew
#
 if(!neko || !addict){
       neko =  client.users.find("id", "479603748382179329"),
       addict = client.users.find("id", "337808716172886017")
    }
#

SO like that?

#

So*

quartz kindle
#

yes

lusty dew
#

Ok

quartz kindle
#

also

#

your find is still wrong

earnest phoenix
#

im the worlds saddest person im using team viewer to connect to my vps

west raptor
#

sad

lusty dew
#

oof I need to do get lol sorry

quartz kindle
#

its not find(arg1,arg2) its find(variable => return match)

#

regardless

#

if you have the ID

#

dont use find

#

use get

#

client.users.get(id)

lusty dew
#

Yea

#

I did

#

Ty

#

I meant to do get instead of find lmfao

vernal rivet
#

Only use find if you don't have an id

lusty dew
#

Yeye

quartz kindle
#

back to the previous subject

earnest phoenix
quartz kindle
#

if you absolutely need to match against "undefined" only, and not ""/0/false/null

lusty dew
#

neko is not defined

quartz kindle
#

do if(typeof variable === "undefined")

earnest phoenix
#

define neko?

lusty dew
#

I got that

#

I did

#

Lol

earnest phoenix
#

good

#

👌

lusty dew
#

That was no help

#

Lmfao sorry

#
    if(!neko || !addict){
       neko =  client.users.get("479603748382179329"),
       addict = client.users.get("337808716172886017")
    }
earnest phoenix
#

@quartz kindle why it not send message?

    mute.delete(5000)```
vernal rivet
#

No is Neko defined

lusty dew
#

Oh wait

#

I forgot one thing lmfao

earnest phoenix
#

let

#

👌

vernal rivet
#

It's not {embed} it's ${embed}

earnest phoenix
#

oof

west raptor
#

that wouldnt work either

quartz kindle
#

dont use ${} unless you need string concatenation

vernal rivet
#

But you don't need ${}

quartz kindle
#

${} is only to mix variables with strings

vernal rivet
#

Yes

earnest phoenix
#

I use it for my mute

#

nobody cares

#

but what ever

lusty dew
quartz kindle
#

an embed built with the embed builder should not need {}

earnest phoenix
#
    mute.delete(5000)```
dont send the message
west raptor
#

are you using a embed builder, @earnest phoenix

quartz kindle
#

neko, client.channels

#

not message.channels

lusty dew
#

Why not do

earnest phoenix
#

its ur standard .setColor @west raptor

lusty dew
#
message.channel.send({embed}).then(msg => {
msg.delete(5000)
}
quartz kindle
#

kayo what is not sending?

lusty dew
#

I used that

#

and it works for me

west raptor
#

.send(<embed>) should work fine

#

no need for the {}

quartz kindle
#

^

lusty dew
#

Ok

#

Sorry I ws just going by what they had

earnest phoenix
#

So I am switching from async to rewrite with discord.py

vernal rivet
#

I know why

west raptor
#

code?

earnest phoenix
#

oh wait

#

Here is my code

vernal rivet
#

Your doing let mute = await embed, not just a standard message.channel.send(embed)

west raptor
#

it would be ```py
@bot.command()
async def meme(ctx):
await bot.send(newurl("meme"));

earnest phoenix
#

So I keep getting the error

Traceback (most recent call last):
  File "C:\Users\jlpat\source\repos\Reddit Bots\Meme Bot (R-D)\test.py", line 16, in <module>
    ctx = bot.ctx
AttributeError: 'Bot' object has no attribute 'ctx'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000027FF38BACF8>
lusty dew
#
Time:
function toDateString() { [native code] }

This popped up in the embed

earnest phoenix
#

oh

#

I just noticed that

#

Lol

west raptor
#

also you dont need to define ctx

#

iirc

earnest phoenix
#

When you're copy and pasting

vernal rivet
#

OwO

earnest phoenix
#

And you forget

lusty dew
#

oof ok

#

Fixed it

#

I needed to do

#
message.createdAt.toDateString()
#

lol I forgot the ()

earnest phoenix
#

Thank you @west raptor

west raptor
#

np

lusty dew
#

how do I do a memberUpdate event?

#

isn't it

client.on("messageUpdate", oldMessage, newMessage => {

})
bright spear
#

always say ur lib

#

also that says messageupdate not memberupdate Thonk

lusty dew
#

Discord.js

#

I meant

#

message XD

#

Not member

#

oof

topaz fjord
#

also its (oldMessage, newMessage) =>

bright spear
#

^

lusty dew
#

Oh ok

#

Thank you

topaz fjord
#

oldMessage =>

#

if your taking one param

lusty dew
#

Also how would I define message in it?

#

Cause I want it to display the author

#

would I just do

(oldMessage, newMessage, message)

bright spear
#

no

lusty dew
#

Ok

bright spear
#

you can use either oldMessage or newMessage

#

since they're both message objects

#

and have the same author

lusty dew
#

.addField("Author:", message.author)

#

Ah ok

bright spear
#

either oldMessage.author or newMessage.author

lusty dew
#

ok

#

Also it is not sending anything

trim saddle
#

@earnest phoenix i see the issue

bright spear
#

@lusty dew full code?

trim saddle
bright spear
#

also is there an error

lusty dew
#
 .addField("Original Message:", oldMessage.content)
    .addField("Edited Message:", newMessage.content)
earnest phoenix
#

Yeah

#

Thanks

#

And

bright spear
#

the full code

lusty dew
#

Ok

earnest phoenix
#

I don't get code completion in VS with ctx

lusty dew
west raptor
#

coffeescript

trim saddle
west raptor
#

ok

lusty dew
#

@west raptor It isn't coffeescript lol

#

It is js

west raptor
trim saddle
#
  1. we don't use semicolons in py
  2. thats not how you send in rewrite
lusty dew
#

Ok I understand what it says

bright spear
#

any error?

lusty dew
#

but it has said stuff like that before and have been wrong

earnest phoenix
#

@trim saddle I'm sorry for semicolons

west raptor
#

tHat Was iN The PateBin

lusty dew
#

No luca

#

No error

bright spear
#

and @west raptor thats just hastebin's language detection being dumb

west raptor
#

oh

#

ok

lusty dew
#

:/

#

Told you

#

Anyway

#

No Luca no errors

bright spear
#

try putting console.log('Message Edited') at the top of the thing

#

before let neko, addict

trim saddle
#
@bot.command()
async def hewwo(ctx):
    await ctx.send("gimme the big s u c c")
earnest phoenix
#

hewwo

lusty dew
#

@trim saddle That message tho

#

xD

trim saddle
#

this is how furries code

earnest phoenix
#

@trim saddle I mean at least do

@bot.command()
async def hewwo(ctx):
    await ctx.send("gimme the big **S U C C**")
lusty dew
#

Yesss

earnest phoenix
#

lol

lusty dew
#

Also

#

Luca I got nothing

#

I had to fix the Console log

#

lol

bright spear
#

well yeah thats the issue @lusty dew

#

you're using message

#

the error is pretty clear

lusty dew
#

Yes

#

I know

#

So should I use

bright spear
lusty dew
#

newMessage.createdAt.toDateString()?

bright spear
#

well

#

that would show the time the message was originally sent

lusty dew
#

oh ok

bright spear
#

you can use .editedAt instead of .createdAt

lusty dew
#

oh?

bright spear
lusty dew
#

so

#

editedAt.toDateString()?

bright spear
#

yeah

trim saddle
#

py™

lusty dew
#

editedAt is not defined

bright spear
#

🤦🏾 its newMessage.editedAt

lusty dew
#

oof

#

yea

#

forgot to add that part

#
Time:
null
#

It posted that in the embed

earnest phoenix
#

I need help again

#

So I keep getting the error

Ignoring exception in command kick:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 61, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\jlpat\source\repos\Reddit Bots\Meme Bot (R-D)\memes.py", line 214, in kick
    await discord.Guild.kick(username, reason = kreason);
TypeError: kick() missing 1 required positional argument: 'user'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\bot.py", line 898, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 550, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 70, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: kick() missing 1 required positional argument: 'user'
#

I am sorry for the semicolons

#

It's the command $kick which is causing the problem

#

Does anyone know what the problem is?

#

Thanks!

trim saddle
#

@earnest phoenix

earnest phoenix
#

yes

trim saddle
#

rewrite or async?

earnest phoenix
#

rewrite

lusty dew
#

@bright spear

Time:
null
#

It gives me that

trim saddle
#

await member.kick(reason=kreason)

earnest phoenix
#

I'm migrating from async to rewrite

#

It doesn't work

trim saddle
earnest phoenix
#

Like how do you kick the user?

#

I'm having problems with that

bright spear
#

@lusty dew hm try just new Date().toDateString()

trim saddle
#

@earnest phoenix you summon a discord.Member object

# bad example
wew = ctx.guild.get_member(id_here)
await wew.kick()
earnest phoenix
#

What about discord.User

trim saddle
#

user is global

west raptor
#

^

#

member is per-guild

earnest phoenix
#

# bad example

#

hmmmm

west raptor
#

yes

earnest phoenix
#

Can I have a good example

west raptor
#

cause

trim saddle
#

thats not a command

west raptor
#

skull is amzing

#

yes

lusty dew
#

@bright spear That worked thanks :3

earnest phoenix
#

Oh I see

#

Wait

#

Lemme try it out

bright spear
#

yw

earnest phoenix
#

@trim saddle This is what I did

@commands.has_permissions(kick_members = True)
@bot.command(brief="Kicks user. Mod's only", description="Usage: $kick [@user] [reason]")
async def kick(ctx, username: discord.Member, *, kreason = None):
    mem = ctx.guild.get_member(username);
    await mem.kick(reason = kreason);
    await ctx.send("Successfully kicked " + str(username));
    print("Kicked " + str(username));
#

It still isn't working

inner jewel
#

username: discord.Member

#

a member isn't a name

earnest phoenix
#

So

#

What should it be then?

inner jewel
#

you want to call kick on a discord.Member object

earnest phoenix
#

so

#

show me

#

I don't understand

#

like

#
@commands.has_permissions(kick_members = True)
@bot.command(brief="Kicks user. Mod's only", description="Usage: $kick [@user] [reason]")
async def kick(ctx, username: discord.Member, *, kreason = None):
    await discord.Member.kick(username, reason = kreason);
    await ctx.send("Successfully kicked " + str(username));
    print("Kicked " + str(username));
#

I don't get it

inner jewel
#

you should learn python

earnest phoenix
#

I just figured it out

#

Thank you for your help

#
@commands.has_permissions(kick_members = True)
@bot.command(brief="Kicks user. Mod's only", description="Usage: $kick [@user] [reason]")
async def kick(ctx, username: discord.Member, *, kreason = None):
    await discord.Member.kick(username, reason = kreason);
    await ctx.send("Successfully kicked " + str(username));
    print("Kicked " + str(username));
#

This worked

lusty dew
#

How do I make the bot's icon appear on an embed?

west raptor
#

<client>.user.avatarURL

#

then you can put that in the thumbnail or whatever

earnest phoenix
#

ok

#

so like

lusty dew
#

Ah ok

#

Ty

west raptor
#

np

earnest phoenix
#

i know when writing to a json file

#

it can get corrupt

west raptor
#

uh huh

earnest phoenix
#

but what about getting data from a json file

#

can it still get corrupt?

west raptor
#

getting data from a json shouldnt be an issue

earnest phoenix
#

oh

#

ok

west raptor
#

👍

earnest phoenix
#

im about to waste hours making a json file

west raptor
#

uh

#

why

earnest phoenix
#

im making a command that gets data about a stand from JoJo's bizzare adventure

lusty dew
earnest phoenix
#

ok

west raptor
#

code

earnest phoenix
#

i mean

#

javascript errors are pretty simple

lusty dew
#

@earnest phoenix Yes, but not when the thing it says is empty really isn't

#
Author:
@Neko Ali
Original Message:
lol
Edited Message:
Testing
Time:
Fri Sep 21 2018
Owner's of the bot: Neko Ali#0674 and The ADDict#5196•Today at 5:40 PM
#

This is what it sends

#

So it isn't empty

earnest phoenix
#

is that what is sending

lusty dew
#

🤦

earnest phoenix
#

or supposed to be sending

lusty dew
#

That is what it sends

#

I said that already

earnest phoenix
#

ok

vernal rivet
#

Javascript Errors can be complexed

earnest phoenix
#

true

vernal rivet
#

Errors can occur without it showing up in the console

lusty dew
#

Yea

#

Well, Idk how to fix the error :/

vernal rivet
#

What is it supposed to happen?

lusty dew
#

It does what it should do

#

But an error pops up anyway

inner jewel
earnest phoenix
#

oof

quartz kindle
#

comment out one of the fields at a time

lusty dew
#

@inner jewel It is not useless to me

quartz kindle
#

to find which one is the culprit

lusty dew
#

:/

inner jewel
#

it is

#

the if will always do the same thing

lusty dew
#

Ok

inner jewel
#

you declare those variables right above it with no value

#

so the if will always be executed

vernal rivet
#

Yes

lusty dew
#

Ok

inner jewel
#

and discord returns empty strings for content of messages

#

when they're eg just an embed

lusty dew
#

Huh?

quartz kindle
#

also, you instead of getting the bot's owners every time, just set them once at startup. you can set them in some unused client namespace for example client.botowners = users.get etc

lusty dew
#

ok

vernal rivet
#

Yes

lusty dew
#

So how am I to fix the error? I did not understand anything Natan said

vernal rivet
#

What is the error?

quartz kindle
#

do something like oldMessage.content || "no content"

vernal rivet
#

We cant automatically know what it is, if we don't see it

lusty dew
#

I already showed it though

#

Error :/

vernal rivet
#

I wasn't here for that

west raptor
#

do what tim said

quartz kindle
#

i already told you, comment out the addfields

#

and test one at a time

#

to see which one is the culprit

#

if that message always appears

inner jewel
#

oldMessage.content == "" or newMessage.content == ""

quartz kindle
#

and as natan said, add a fallback to message.content

inner jewel
#

those are the only cases that error can happen

quartz kindle
#

.content || "no content found"

#

on all of them

#

just in case

lusty dew
#

That was the error

vernal rivet
#

That's not a error

lusty dew
#

Well

bright spear
#

yeah thats not an error

lusty dew
#

That is what appeared in my Console

#

¯_(ツ)_/¯

vernal rivet
#

That's data

lusty dew
#

Ok

bright spear
#

yeah, probably something you console.logged

vernal rivet
#

It's a json formatted

quartz kindle
#

thats an entire message object/collection

lusty dew
#

Ah yes

#

I console logged oldMessage

#

oof

quartz kindle
#

anyways you can see

#

that inside that long ass collection

#

there is content: ''

#

so that message had an empty content

#

which is the cause of your error

#

hence why .content || "no content found"

lusty dew
#

Ok

#

But it sends out the original message, how does it not have any content?

quartz kindle
#

if the original message is nothing but an image, or an embed

#

the content is empty

#

because these are stored in other parts of the message

lusty dew
#

Oh

vernal rivet
#

Would [{}] in a Json formatting affect anything Tim?

quartz kindle
#

thats an object inside an array

#

how are you using it?

vernal rivet
#

Not for me

lusty dew
#

This is the code

quartz kindle
#

its valid json, but you have to know when to use object keys and array keys to access it correctly

vernal rivet
#

It's in nekos console

quartz kindle
#

you can mix arrays and objects yes

#

arrays are needed when order is important

vernal rivet
#

Ok

quartz kindle
#

objects do not have a defined order

lusty dew
#

Um

#

This is my code

#

if you need it

quartz kindle
#

did you test it?

lusty dew
#

Yes

#

I did

vernal rivet
#

And?

lusty dew
#

It just spams the channel

#

with the embede

#
Author:
@No Name
Original Message:
no content
Edited Message:
no content
Time:
Fri Sep 21 2018
#

It spams that

vernal rivet
#

That's because it's a run-time error, you made of made a forever loop

quartz kindle
#

it spams that?

#

even if nobody edited anything?

lusty dew
#

Yes

#

Well no

#

If I edit ti

#

it*

#

omfg

#

Keyboard work with me

vernal rivet
#

Lol

lusty dew
#

If I edit a message it spams that

quartz kindle
#

weird

#

remove everything

#

and try

#
client.on("messageUpdate", (oldMessage, newMessage) => {
    console.log("message updated")
}```
#

see if it still happens multiple times with a single edit

lusty dew
#
client.on("messageUpdate", (oldMessage, newMessage) => {
    console.log("message updated")
}

Full code^^

#

Like that?

west raptor
#

yes

lusty dew
#

Nah it doesn't spam it

#

Sends it once

quartz kindle
#

good

#

now try console.log(oldMessage.content,newMessage.content)

#

to see if it shows up correctly

lusty dew
#

Nah

#

It just sends it once

#

But it doesn't show old message

#

only the new message

quartz kindle
#

never?

#

old message is always empty?

#

if you try editing more times in more ways

#

with different contents everytime

lusty dew
#

Oh wait

#

It does

#

I just thought it would send it like
Old message
New message

#

not

#

Old message new message

quartz kindle
#

alright so everything seems to be working

lusty dew
#

Yes

quartz kindle
#

now add your code back, one thing at a time

#

and test one thing at a time

lusty dew
#

Ok

quartz kindle
#

try first an embed with only author

#

then only one message

#

etc

#

also, dont add back this if(!modchannel) return message.channel.send("Couldn't find mod-logs channel");

#

there is no message here

#

and its better to keep those kind of errors in the console only, instead of making them public

lusty dew
#

oof

#

i just did

#

Ok

#

Removed it

#

Hmm

#

It won't send anything

#

Lol

#

Does it not work when you edit a message you already edited?

quartz kindle
#

it should work

#

if it did show up in the console, it should work

lusty dew
#

It didn't

#

So i just sent a new message and edited it

#

seems like

.addField("Author:", newMessage.author)
#

This is making it spam?

quartz kindle
#

it makes no sense if it does

#

mas who knows lol

lusty dew
#

It does spam with just that

quartz kindle
#

try newMessage.author.username

lusty dew
#

Still spams

bright spear
#

screenshot?

quartz kindle
#

i have no idea how that makes any sense

west raptor
#

what luca said

west raptor
#

what

lusty dew
#

Also it sends the name of the bot

#

You asked for a screenshot there you go

#

It just spams it

quartz kindle
#

the message the bot is sending is being caught in the messageUpdate event

#

no idea why

#

try just doing console.log(newMessage.author.username)

lusty dew
#

maybe cause I am using newMessage?

#

or does that not have anything to do with it

quartz kindle
#

it shouldnt

lusty dew
#

Ok

west raptor
#

newMessage is the updated message

#

not a whole new message

lusty dew
#
Neko Ali
No Name
No Name
No Name
No Name
No Name
No Name
No Name
No Name
No Name
No Name
#

Says my name once

#

then Spams No Name(Name of the bot)

quartz kindle
#

thats with nothing in the command besides the console.log?

lusty dew
#

Ye

#

That is the console log

quartz kindle
#

then try oldMessage instead lol

lusty dew
#

Still spams :/

west raptor
#

hold on lemme test

lusty dew
#

Ok

west raptor
lusty dew
#

Yea

#

I don't understand it lol

#

is there another way of getting the person who sent the message?

#

edited*

quartz kindle
#

thats really weird

#

is it possibly a d.js bug?

jagged plume
#

probably

lusty dew
#

Yea most likely

#

¯_(ツ)_/¯

#

I guess for now No Author XD

quartz kindle
#

well

#

you can always use fetch message

#

and get message author from there

lusty dew
#

oof

#

Never done it that way so idk how lo

#

lol*

#

Always done message.author

west raptor
#

should i put it as a issue on d.js repo

#

if it isnt already

lusty dew
#

I wish there was a way to define message in the event

#

so I can do message.author

quartz kindle
#

try asking about it in the d.js server first

#

anyway, try doing the rest of the command

#

without author

#

to make sure everything works

#

and then figure out the author later

lusty dew
#

Ok

earnest phoenix
#

So I was wondering

lusty dew
#
RangeError: RichEmbed field values may not be empty.
    at RichEmbed.addField (C:\Users\User\Desktop\No name\node_modules\discord.js\src\structures\RichEmbed.js:165:34)
    at Client.client.on (C:\Users\User\Desktop\No name\index.js:59:6)
    at Client.emit (events.js:182:13)
    at MessageUpdateAction.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\actions\MessageUpdate.js:13:16)
    at MessageUpdateHandler.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\packets\handlers\MessageUpdate.js:7:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\No name\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
#

This is with oldMessage^

earnest phoenix
#

How do you make a purge command in rewrite? I've made on in async but I'm switching over. The lib is discord.py.

lusty dew
#

Just follow Rewrites docs

#

and change the things that need to be changed over

earnest phoenix
#

I am

#

Well, I'm trying

lusty dew
#

@quartz kindle I get the same error with oldMessage as before

quartz kindle
#

is it repeating again?

lusty dew
#

Not spam

#

the Author thing caused the spam

#
RangeError: RichEmbed field values may not be empty.
    at RichEmbed.addField (C:\Users\User\Desktop\No name\node_modules\discord.js\src\structures\RichEmbed.js:165:34)
    at Client.client.on (C:\Users\User\Desktop\No name\index.js:59:6)
    at Client.emit (events.js:182:13)
    at MessageUpdateAction.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\actions\MessageUpdate.js:13:16)
    at MessageUpdateHandler.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\packets\handlers\MessageUpdate.js:7:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\No name\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
#

This is the error

quartz kindle
#

but in the console it worked

#

it correctly showed the message content

#

right?

#

so try doing it without an embed

#

just do channel.send(oldMessage.content)

lusty dew
#

Ok

#
 channel.send("Original Message:", oldMessage.content)
    ^

ReferenceError: channel is not defined
    at Client.client.on (C:\Users\User\Desktop\No name\index.js:57:5)
    at Client.emit (events.js:182:13)
    at MessageUpdateAction.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\actions\MessageUpdate.js:13:16)
    at MessageUpdateHandler.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\packets\handlers\MessageUpdate.js:7:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\No name\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\No name\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
    at Receiver._receiver.onmessage (C:\Users\User\Desktop\No name\node_modules\ws\lib\websocket.js:137:47)
west raptor
#

hm

#

weird

bright spear
#

obviously channel is not defined

lusty dew
#

Yes

west raptor
#

try

floral stone
#

Any ideas on how to split a message that is too long (over the 2000 limit) without messing up with the umm markdown.

west raptor
#

oldMessage.channel.send() maybe? @lusty dew

bright spear
#

that'll send in the channel where the message is

earnest phoenix
#

It's however you defined the channel

bright spear
#

@lusty dew just use the same channel thing you were using before

lusty dew
#

Wdym>

#

?*

bright spear
#

how were you sending it before

lusty dew
#

Ok it sends the old message

quartz kindle
#

i meant

#

channel.send

#

as in

floral stone
#
msg = [msg[i:i+2000] for i in range(0, len(msg), 2000)]
``` I use this to separate long messages but i'm not sure how to make it so it doesn't split the markdown.
quartz kindle
#

the channel you defined

#

from your client.channels.get

lusty dew
#

Ok

#

It sent the old message

floral stone
#

Nevermind, I'll just add some code to separate the long message if it over exceeds the 2k limit

quartz kindle
#

@floral stone d.js has a built in split function

floral stone
#

So does python

#

I got it solved

lusty dew
#

How can I put it into an embed though?

quartz kindle
#

try building a literal embed

#

without using the embed builder

lusty dew
#

How do I do that o.O

quartz kindle
#
embed = {
    embed:{
        author: "bla",
        field: {
            title: "etc",
            value: "duh"
        }
    }
    }```
#

something like that

lusty dew
#

Ah ok

quartz kindle
#

there are builders online

#

check this one

lusty dew
#

What is the Author for?

quartz kindle
#

check the right side of the window

#

it shows up in the embed, above the title

bright spear
#

author lets you make a title with an image next to it

lusty dew
#

What does inline do?

quartz kindle
#

everything is there

lusty dew
#

Ah ok

#
"embed": {
    "timestamp": "2018-09-22T02:05:01.078Z",
    "footer": {
      "icon_url": "client.users.displayAvatarURL",
      "text": "footer text"
    },
    "thumbnail": {
      "url": "client.users.displayAvatarURL"
    },
    "fields": [
  {
        "name": "OriginalMessage",
        "value": "oldMessage.content"
      },
      {
        "name": "Edited Message",
        "value": "newMessage.content"
      }
    ]
  }
#

So like this?

bright spear
#

client.users.displayAvatarURL isnt a thing

lusty dew
#

I meant bot >~<

#

oof

#

Would that work though?

#

After I fix the minor thing

quartz kindle
#

you're using strings instead of values

#

but you can test it like that to make sure it works first

lusty dew
#

Screw it

#

I will worry about this later

#

I am behind on things now lmfao

earnest phoenix
#

can someone help me my kick command wont read back when it doesnt have permissions ``` if(command === "kick") {
let member = message.mentions.members.first();
let reason = args.slice(1).join(" ");

if (!message.guild.me.hasPermission("KICK_MEMBERS"))
return message.reply("You or I dont have perms to kick.");

member.kick(reason);

}```

#

and also remove the name

lusty dew
#

What do you mean it doesn't have permissions? @earnest phoenix

#

how do I use a userUpdate event?

#

Like to get the old username

#

adn the new username?

earnest phoenix
#

i went on my computer and followed the thing excactal made a folder got discord on computer but when i am in node.js and i press enter it fails

limpid cosmos
#

@earnest phoenix so what's your question ?

earnest phoenix
#

dont worry about it my computer just died and wont charge oliy

limpid cosmos
#

Okay 😂

#

Good luck man 😂

earnest phoenix
#

@quartz kindle how i can delete this white line?

#

on my DBL page

#

beacause the backgroundcolor is transparent for img

bright spear
#

@earnest phoenix use this css

#bot-details-page .bot-img {
    box-shadow: none !important;
}```
earnest phoenix
#

not working 😢

bright spear
#

@earnest phoenix why do you have <html> <head> etc

earnest phoenix
#

idk

#

i'm not pro

#

in HTML

#

I'm a beginner

bright spear
#

just remove all the html head body stuff

earnest phoenix
bright spear
#

no you dont really

#

just dont try to make a new page inside a page

earnest phoenix
#

ooh now

#

it's working

#

thank's man

#

Beginners should take a look at the CSS tutorial

bright spear
#

yw

earnest phoenix
#

I already looked at that site

#

@earnest phoenix

#

@bright spear

#

how i can change the buttons stile

#

like

prime cliff
#

@earnest phoenix Hey

earnest phoenix
#

?

prime cliff
#
#bot-details-page .bot-img {
  box-shadow: none !important;
}```
Should definitly work
earnest phoenix
#

ik

prime cliff
#

Oh i see remove the <style> </style> out of the <html> and put it at the bottom

#

See if that fixes it

#

The html parsing is a bit picky on DBL

#

But it works

earnest phoenix
#

IK

#

it works

#

see

prime cliff
#

Mkay lol

earnest phoenix
#

@earnest phoenix to change style, as I said, learn CSS

craggy fox
#

How do I show the servers count on dbl

earnest phoenix
craggy fox
#

I’m using python @earnest phoenix

earnest phoenix
#

You need to google then

#

@earnest phoenix

craggy fox
#

Cool

earnest phoenix
#

I just want to change the color of these buttons. And if I search on the site in which category?

craggy fox
#

Learn css @earnest phoenix

earnest phoenix
#

oof

craggy fox
#

Will help you do more customizations

earnest phoenix
#

To change color you need background-color

#

?

craggy fox
#

You will need to be more specific for the css

earnest phoenix
#

buttons color

craggy fox
#

It won’t be like coding a new page

earnest phoenix
#

Yes, dude, it's obvious af

craggy fox
#

It will be like working inside an existing page

earnest phoenix
#

I do not understand a fucking thing. Where do I find the location of the buttons?

lean minnow
#
if(!tempVars("test")[2]) {
  msg.channel.send({embed: {
    color: C11515,
    title: ":ERROR: Error",
    fields: [{
       name: "Invalid Or Missing argument",
       value: "Ussage: ${server.tag}embed (Title, Color, Description)"
      }]}
} else {
  msg.channel.send({embed: {
    color: tempVars("test")[1],
    title: "${tempVars("test")[0]}",
    description: "${tempVars("test")[2]}"
    }
  })
}
#

HAve I done anything wrong?

earnest phoenix
harsh musk
#

I don't know JS, but you're sending an object, that object probably has an attribute you're looking for.

earnest phoenix
#

how do i fix this
this is code

    client.user.setPresence({ game: { name: args[0], type: args[1] } });
    client.user.setStatus(args[2])
        .then(message.channel.send("Bot Status Has Been Set To:" + "Name: ``" + args[0] + "`` Type: ``" + args[1] + "`` Status: ``" + args[3] + "``"))
        .then(console.log)
        .catch(console.error);

earnest phoenix
#

owo

#

why not just use the current status Thonk

#

If the promise is resolved, then the one you set will be the one that the client currenly is

#
const discord = require('discord.js')
const ownerID = '274284493043531776';

exports.run = async (client, message, args) => {
    if (message.author.id !== ownerID) return message.channel.send("You are not authorized to use this command."); 

    client.user.setPresence({ game: { name: args[0], type: args[1] }, status: args[2] })
    .then(message.channel.send("Bot Status Has Been Set To:" + "Name: ``" + args[0] + "`` Type: ``" + args[1] + "`` Status: ``" + args[2] + "``"))
    .then(console.log)
    .catch(console.error);


}

this is new code, doesnt work at all, but the part where it responds with sending a message does work

#

oof

#

okay im wrong, does work but the status part doesnt set it to dnd when u use dnd as args

#

i use --set test watching dnd
and it sets it to test watching but not dnd

earnest phoenix
#

can I just add,

.then(message.channel.send("Bot Status Has Been Set To:" + "Name: ``" + args[0] + "`` Type: ``" + args[1] + "`` Status: ``" + args[2] + "``"))```
#

Makes no sense?

#

if the promise is resolved, then you can use the presence of the current client user.

steel heath
#

whats the new cooldown thing and how do you set it with a bot

#

js pls

lusty dew
#

How do you make an eval command?

earnest phoenix
#

there's a eval function in js ¯_(ツ)_/¯

#

called eval(stuff)

#

anyways

craggy fox
#

@earnest phoenix u tell the button where to be

earnest phoenix
#
          .catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
          ^

SyntaxError: Unexpected token .
thorn vault
#

Who codes in .js and wanna help me make a bot? 😃

earnest phoenix
#

wahts ur problem?

thorn vault
#

I wanna team with someone to make a bot

earnest phoenix
#

depends

#

what would i get for helping

thorn vault
#

Idk

#

insta account with 600 followers idk

earnest phoenix
#

no

#

lol

#

I code in js but well

#

I don't really like pressure

#

anyways

#

I'm bored so

#

For some reason this code doesnt work ${mentionedUser}

#

you need to define mentionedUser ofc

#

I know

#

you dont understand

#

oki sowwy

#

what are you trying to do?

#

Im creating a mute command i already made the part with you need to mention a user and now when i use the ${mentionedUser} code in the bot when its muting the mentioned user the code doesnt work

#

ouh

#

i did something to my library because of something wrong and now that stopped working

#

Oh

#

wait

#

got it working now

#

lool ok

#

gg

knotty steeple
#

what exactly is mentionedUser

lusty dew
#

How do you make an eval command?

#

I know js has a eval() thing in it

#

but idk how to use it

earnest phoenix
#

well first you need to get what you type after the command

#

if you do a command I mean

#

anyone know how i can catch an error on my kick command

#

and have it send it to the channeö

#

l

#

what lang?

#

js

lusty dew
#
.catch(err){
console.log(err)
}//js
#

That is how I do mine

earnest phoenix
#
.catch(error => message.channel.send(`Sorry ${message.author} I couldn't kick because of: ${error}`));

should work aswell

lusty dew
#

Ye

#

But better to keep your errors in console

earnest phoenix
#

mm

lusty dew
#

Show code

#

I want to see what that thing above it is lol

earnest phoenix
#
const discord = require('discord.js')
const owner = ['274284493043531776'];


exports.run = async (client, message, args) => {
const first = undefined;
const memberr = message.mentions.users.first();
if(!memberr) return message.channel.send(`Mention a user!`)

if (!message.member.hasPermission("KICK_MEMBERS") && message.author.id !== owner[0])
 return message.channel.send("You Do Not Have Permssions To Kick Members!");
 if(!message.guild.me.hasPermission("KICK_MEMBERS"))
 if (!message.member.hasPermission("KICK_MEMBERS") && message.author.id === owner[0])
return memberr.kick().then((member) => {
        message.channel.send(":wave: " + member.user.username + " has been successfully kicked :point_right: ");    
 .catch(error => message.channel.send(`Sorry ${message.author} I couldn't kick because of: ${error}`));
         
}); 

};
#

owo you need to have the catch thing on the kick thing

lusty dew
#

that ;

#
return memberr.kick().then((member) => {
        message.channel.send(":wave: " + member.user.username + " has been successfully kicked :point_right: ")
#

take out the ;

knotty steeple
#

all you do is eval(code)

lusty dew
#

Ok

earnest phoenix
#

@lusty dew theres another problem, when i run the command it doesnt get to the kick user part, something is stopping it, so it doesnt send the error

lusty dew
#

Hmm

earnest phoenix
#

it could be

#

that it is mentions.users so you have to change it to memberr.member.kick?

#

idek

quartz kindle
#

your IFs are not doing anything

earnest phoenix
#

also you have 1 if thing for kick_memebers that isn't right used I guess

#

oof

quartz kindle
#

dont use IFs like that, its confusing and its probably breaking your code

lusty dew
#

Hmm

quartz kindle
#
//right
if(condition) {
    //code
}

//wrong
if(condition)
//code```
lusty dew
#

Also shouldn't you use let instead of const?

earnest phoenix
#

oof

lusty dew
#

Since const declares a variable that can't be changed?

earnest phoenix
#

i didnt use let anywhere...??

lusty dew
#

I know

quartz kindle
#

doesnt matter how you declare

lusty dew
#

I said shouldn't you use let instead of const

knotty steeple
#

why does he have to use let instead of const

lusty dew
#

I was just asking

#

lol

#

for my personal use

#

XD

#

Not him

quartz kindle
#

i always use var

knotty steeple
#

its not needed

lusty dew
#

Ah ok

knotty steeple
#

var is bad

lusty dew
#

Someone told me not to use var

knotty steeple
#

i read a thing about it wew

quartz kindle
#

its not bad