#development

1 messages ยท Page 445 of 1

stiff juniper
#

the "made changes to server" event

#

in audit logs

#

is what guildUpdate is equal to

old swallow
#

There is an audit log entry though.

#

INVITE CREATE I believe.

stiff juniper
#

yes

#

so there you'd need the View Audit Log permission

old swallow
#

Maybe there's an event like auditLogUpdate?

stiff juniper
#

nope

#

there isnt

#

checked

#

here's the class for an audit log entry

#

then all the types of audit log actions it knows of

#

which includes INVITE_CREATE, INVITE_UPDATE AND INVITE_DELETE

#

@old swallow

old swallow
#

Got it, though ugh, that sucks.

stiff juniper
#

it's Discord's fault probably

#

they dont provide proper endpoints for invites

old swallow
#

They give us all these fancy events, though no audit log or invite events. Exactly.

#

I know this is possible though, bots like @earnest phoenix and @leaden arrow do it

wild tide
#

is there a way to send a message into a certain channel in a certain server with a command?

#

discord.js, btw

#

nvm I figured it out XD

#

bot.channels.get('channelID').sendMessage('your message')

restive silo
#

you shouldn't use sendMessage anymore, its deprecated

cold niche
#

Sometimes the websocket latency (delay of the last heartbeat) is negative for me... It is d.py and I am wondering if it is just the lib's issue or you can also experience something similar with other libs aswell

wild tide
#

oof just realised its deprecated, thanks ๐Ÿ˜ƒ

restive silo
wary sluice
#

$plau

#

$play

long forge
#

Can someone assist me with an issue Im having involving discord.js and ytdl-core?

oblique sequoia
#

im sure someone can

sick cloud
#

@long forge, post your issue, don't ask to ask practically.

long forge
#

My bot for some reason won't continue through the queue of songs in my song playing command (play.js). It just stops. It doesn't give an error in console or anything. Only when you finally do the skip command will the bot continue to the next song, but once it ends, it just stops right there again.
node modules I am using: discord.js and ytdl-core.
https://pastebin.com/3KiNSCnn

opaque magnet
#
                            ^^^^^

SyntaxError: await is only valid in async function
``` why  ?
restive silo
#

The error is straight forward telling you that you can only use await inside an async function

#

not much to explain there

#

๐Ÿ‘€

opaque magnet
#

what should I do then?

#

@restive silo

restive silo
#

mark the current function as async

opaque magnet
#

bot.on('message', async => {

command here

});

#

@restive silo ??

restive silo
wild tide
#

Anyone know how to get Custom Colors in embeds? The syntax of the command requires you to say <text> color:<6-digit number>.

stiff juniper
#

what lib

wild tide
#

Basically, a user sends in a 6 digit color number, preferably RRGGBB, and it gets the number and put's it where the discord embed puts it's color

#

discord.js

stiff juniper
#

so discord.js uses 0x[html/hex color code]

wild tide
#

yep

stiff juniper
#

so you'd need to do 0x[their color]

#

make sure to validate its a real color

#

the max is FFFFFF, which is white

wild tide
#

Well, I already tried that and the DiscordAPI pumps out an error

stiff juniper
#

what error

wild tide
#

embed.color Color must be smaller than...

stiff juniper
#

must be smaller thannnn

#

what

wild tide
#

The number is too big, and it has to be 6 digits

stiff juniper
#

uhhhh

wild tide
#

basically thats what it means

stiff juniper
#

what version of djs are you using

wild tide
#

11.3.2

stiff juniper
#

aha

#

i use 12.0.0-dev

wild tide
#

but thats unstable

sick cloud
#

It ain't.

stiff juniper
#

not really tbh

wild tide
#

rlly

sick cloud
#

I run a public bot at 100 guilds on it, works fine af.

#

Its better in ways.

stiff juniper
#

@limpid pike uses 12

wild tide
#

it has 11 servers

#

doe

stiff juniper
#

so

#

well @sick cloud said he had one with 100+

#

sooo

#

(running 12)

wild tide
#

oh, how do I upgrade discord.js?

sick cloud
#

@dusty bronze uses v12/discord.js master, and yeah. It works fine.

wild tide
#

sorry, I havn't done it in ages lmao

sick cloud
#

uninstall discord.js and install hydrabolt/discord.js through npm

wild tide
#

ok

stiff juniper
#

@wild tide change your discord.js dep to github:hydrabolt/discord.js#master too

sick cloud
#

just remember that djs master has major changes

stiff juniper
#

in package.json

#

also yeah

#

here's the 12.0.0-dev docs

wild tide
#

hmm

#

in package.json I changed the version number to github:hydrabolt/discord.js#master

#

I uninstalled discord.js and installed hydrabolt/discord.js using npm

stiff juniper
#

yeah there are some major changes

#

in this new version

wild tide
#

like what?

stiff juniper
#

so some of your bot's functions might not be compatible

#

and need to be updated

#

well theres no real list atm

#

but some stuff's changed

austere meadow
#

not here to brag, just want to mention that i would say v12 is much better in many ways

#

zBot uses v12 (latest master commit) and it has nearly 1600 guilds

#

user caching and performance has improved a lot

stiff juniper
#

yeah my bot uses v12 too

austere meadow
#

as well as adding some new features which are useful

wild tide
#

welp v12 just broke my whole bot

#

and I still havn't fixed my custom colors

#

in fact I made it worse

#

soooo

stiff juniper
#

yeah you have to port it to v12 mate

#

there's too many new changes

wild tide
#

meh

#

nvm ill just figure out how to fix my colors myself, since changing versiosn didn't work sadcatte

#

btw I downgraded discord.js back to v11

wild tide
#
var argument = message.content.trim().split(" "); // text is the input
var lastArgument = arguments[arguments.length - 1];
if (lastArgument.startsWith("color:")) {
  var color = lastArgument.replace("color:", "");
  var sendcolor = lastArgument - color
} 
        
        
        if(color == undefined){ color = defaultcolor}
     
        var noFlags = args.filter(arg => !arg.startsWith("color:"));
const sayMessage = noFlags.join(" ");
      
        message.delete().catch(O_o=>{}); 

        message.channel.send({embed: {
          color: Number(`${sendcolor}`),
          description: sayMessage
    
                
                                                      
  
        }})
      console.log(sendcolor);
      console.log(color);
      console.log(lastArgument);
              ```
`sendcolor` is returning `undefined`
`color` is returning the defaultcolor (which is 3447004)
`lastArgument` is returning `/app`

I am proper confused rn
stiff juniper
#

why are you using Number()

wild tide
#

It turns a string into a integer

stiff juniper
#

yes ik

wild tide
#

so?

#

why should I not use it?

stiff juniper
#

i wasnt saying that

wild tide
#

hmm

#

is there anything I am doing wrong? I mean, obviously I am, but I don't know where

stiff juniper
#

do the console log for send color after you set it

#

like

#

right after

#

see what it does then

wild tide
#

sure lemme run it

#

returns undefined after I set it

stiff juniper
#

show me the new code

wild tide
#
var argument = message.content.trim().split(" "); // text is the input
var lastArgument = arguments[arguments.length - 1];
if (lastArgument.startsWith("color:")) {
  var color = lastArgument.replace("color:", "");
  var sendcolor = lastArgument - color
} 
     console.log(sendcolor);   
        
        if(color == undefined){ color = defaultcolor}
     
        var noFlags = args.filter(arg => !arg.startsWith("color:"));
const sayMessage = noFlags.join(" ");
       
        message.delete().catch(O_o=>{}); 
     
        message.channel.send({embed: {
          color: Number(`${sendcolor}`),
          description: sayMessage
    
                
                                                      
  
        }})
      console.log(sendcolor);
      console.log(color);
      console.log(lastArgument);
              ```
stiff juniper
#

oh

#

maybe its cuz you set it in the if statement

#

plus i'd use let

#

instead of var

wild tide
#

I did set it in a if statement

#

for the command

stiff juniper
#

yes but it wont be defined anywhere else

#

because of that

wild tide
#

could I move it out so it becomes a global variable?

stiff juniper
#

yes

wild tide
#

ok

stiff juniper
#

well a global var is

global.varName = thing;
#

but ik what you mean

wild tide
#

welp its still returning undefined

stiff juniper
#

(show new code)

wild tide
#

I think it's because lastArgument is defined as /app for some reason

#

//Outside of code, global variables
var lastArgument = arguments[arguments.length - 1];
if (lastArgument.startsWith("color:")) {
  var color = lastArgument.replace("color:", "");
  var sendcolor = lastArgument - color
} 

//Inside code 
var argument = message.content.trim().split(" "); // text is the input

     console.log(sendcolor);   
        
        if(color == undefined){ color = defaultcolor}
     
        var noFlags = args.filter(arg => !arg.startsWith("color:"));
const sayMessage = noFlags.join(" ");
        // Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
        message.delete().catch(O_o=>{}); 
        // And we get the bot to say the thing: 
        message.channel.send({embed: {
          color: Number(`${sendcolor}`),
          description: sayMessage
    
                
                                                      
  
        }})
      console.log(sendcolor);
      console.log(color);
      console.log(lastArgument);```
stiff juniper
#

no no

#

i mean

#

define sendcolor outside of it
as iN

var sendcolor;

outside

inside

if statement, set that sendcolor var there, etc
wild tide
#

no no no

#

im trying to remove color: from the number next to it, and putting it into the embed

#

because the syntax is +command <text> color:<color-number>

stiff juniper
#
if (lastArgument.startsWith("color:")) {
  var color = lastArgument.replace("color:", "");
  var sendcolor = lastArgument - color
} 
#

okay uhh

#

i just read this code

#

and what are you doing

#

like

#

what

wild tide
#

idek

stiff juniper
#

thats not

#

color already has it

#

without color:

#

in it

#

cuz you did .replace

wild tide
#

but color is returning undefined

stiff juniper
#

cuz you're defining it on the outside code

#

and in an if statement

#

what i mean is

#

you're CREATING

#

it

#

inside there

#

which doesnt work

wild tide
#

I moved it outside the if block

#

and it still returns undefined

#

thats my issue

stiff juniper
#

well

#

what are you using

#

wdym "outside"

#

and "inside"

wild tide
#

"inside" means inside the if block that runs when the command is entered, "outside" means outside the whole code, where it can declare itself as a global variable

stiff juniper
#

i dont think you get it

#

heres what i mean

#
//Outside of code, global variables
var lastArgument = arguments[arguments.length - 1];
var color;
if (lastArgument.startsWith("color:")) {
  color = lastArgument.replace("color:", "");
} 
#

ik it's spoonfeeding and all but this has been a while

wild tide
#

I am proper confused

#

why is this simple idea so hard

stiff juniper
#

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

#

you define color

#

outside of the if statement

#

that i did there

#

then you set that value

#

and it knows you're trying to set that

#

creating color inside the if statement doesnt work

#

as it'll delete that variable

#

as soon as the if statement ends

#

@wild tide

wild tide
#

hmm

#

you are also defining what the variable holds with the number you type in the command

stiff juniper
#

hm?

wild tide
#

doesn't work

#

if(color == undefined){ color = defaultcolor} its activating this line of code in the command if block

#

it just makes color the default color I set if you forget to enter the args

stiff juniper
#

you should just do

if (!color)
#

that basically means if its false or null or undefined

#

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

#

also use 3 equal symbols

#

@wild tide

wild tide
#

ik that

#

color is returning the default color still, so it isn't recognising the args
lastArgument is still returning /app

stiff juniper
#

well its skipping defining it them

#

if lastArgument isnt returning a string that starts with color:

wild tide
#

darn

#

I've doing this for 6 hours now im friggin tired

earnest phoenix
#

*play fuck

quiet bobcat
vale harness
#

I'm having trouble using CSS to make the upvote button say 20 Upvotes rather than 20Upvotes. Please could someone help, thx

#upvotebutton {
  background-color: #ffffff;
}

#upvotebutton:after {
  content: ' Upvotes';
  color: red;
}```
It seems like the new content gets stripped of the space at the start, I want this space to be preserved
spring ember
#

do ' upvotes ' maybe?

vale harness
#

i did

#

oh

#

a space at the end

#

i'll try that

#

spaces at the end are getting stripped as well

#

I managed to do it by using a zero-width space. Thanks for helping anyway!

cinder stratus
#

any mistake i have done

#

if (message.content === '++serverinfo') {
let server_name = message.guild.name
let Created_on = message.guild.createdAt
let server_size = message.guild.members.size
message.channel.send('Server : ' + server_name + '\nMembers : ' + server_size + 'Created At :' Created_on)
};
if (message.content === '++avatar') {
message.reply(message.author.avatarURL);
}
});

#

The Source Code Is This

quartz kindle
#

forgot a +

#

also, use code blocks when posting code : ```code here```

ruby dust
#
if (message.content === '++serverinfo') {
        let server_name = message.guild.name
        let Created_on  = message.guild.createdAt
        let server_size = message.guild.members.size
        message.channel.send('Server : ' + server_name + '\nMembers : ' + server_size + 'Created At :' Created_on)
    };
    if (message.content === '++avatar') {
  message.reply(message.author.avatarURL);
}
});
#

ah

#

much better now

#

sorry, I just couldn't look at the bolded text any longer

plucky fox
#

you can also put the lang abbreviation for highlighting

#
if (message.content === '++serverinfo') {
        let server_name = message.guild.name
        let Created_on  = message.guild.createdAt
        let server_size = message.guild.members.size
        message.channel.send('Server : ' + server_name + '\nMembers : ' + server_size + 'Created At :' Created_on)
    };
    if (message.content === '++avatar') {
  message.reply(message.author.avatarURL);
}
});```
#

oh you did

#

hm

cinder stratus
#

**if(message.content.startsWith(prefix + "++google")) {
let google = args.slice(1).join('+');
let link = https://www.google.com/search?q= + google;
message.channel.send(link);
}

if(message.content.startsWith(prefix + "++youtube")) {
let youtube = args.slice(1).join('+');
let link = https://www.youtube.com/results?search_query= + youtube;
message.channel.send(link);
}**

#

is any mistake in this

#

see the error

slender thistle
#

Could it be msg instead

cinder stratus
#

Hey Can You Fix ANd Send The Code

knotty steeple
#

you should learn to debug your code yourself

cinder stratus
#

Yes But Please Help

slender thistle
#

Can you show the rest of your code

cinder stratus
#

yes

#

but its over 2000 characters

slender thistle
#

Use Hastebin

#

and remove any API keys/token from the code

cinder stratus
#

still the code is so big

#

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

bot.on('ready', () => {
console.log("Turning On Bot")
bot.user.setActivity("TESTING", {type: 2});
});

if(message.content.startsWith(prefix + "++google")) {
let google = args.slice(1).join('+');
let link = https://www.google.com/search?q= + google;
message.channel.send(link);
}

if(message.content.startsWith(prefix + "++youtube")) {
let youtube = args.slice(1).join('+');
let link = https://www.youtube.com/results?search_query= + youtube;
message.channel.send(link);
}

#

created another file

earnest phoenix
#

did you define message?

cinder stratus
#

error

slender thistle
#

Where are you defining message, though

turbid moss
#

shivaco

#

My bot has declined because my bot was offline. Can I post again my bot? And wait for aprovate?

slender thistle
#

Yes

turbid moss
#

Ok Thanks

slender thistle
#

But first, get it online :^)

turbid moss
#

yes it is online now

cinder stratus
#

yes u can re apply

#

how i define message pls tell

#

i am confused

slender thistle
cinder stratus
#

help pls

turbid moss
#

shivaco

slender thistle
#

Yes?

turbid moss
#

How long will it take to see if you approve me or not?

slender thistle
#

It usually takes from an hour to one week

turbid moss
#

๐Ÿ˜ฆ

slender thistle
#

You will be mentioned in #logs and get a DM

turbid moss
#

Yes,

slender thistle
#

@cinder stratus I don't know js myself and I don't intend learning it, so you are on your own until someone who knows js comes here and help ya

cinder stratus
#

That is the reason why my bot never get authorized hmmm

ruby dust
#

@slender thistle it's hard to say "from an hour to a week" anymore, thanks to the new web mods and how they handle offline bots now

slender thistle
#

True

#

From an hour to... 2-3 days?

#

Not even that GWcfcThonk

ruby dust
#

from a minute to 2 days, I'd say now

turbid moss
#

minute? xd

restive silo
#

yea if you are lucky and the queue is empty your bot might get very fast approved/tested

turbid moss
#

So, i'm not lucky.

#

xD

lyric lotus
#

help

#

im on python

#

asyncio

#

whats wrong with this code

#

it only detects the name,not role

#

one sec

#

@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):

    if role is None:
        return await client.say("You haven't specified a role! ")

    if role not in ctx.message.server.roles:
        return await client.say("That role doesn't exist.")

    if role not in ctx.message.author.roles:
        await client.add_roles(ctx.userName, role)
        return await client.say("{} role has been added to {}.".format(role, ctx.userName.mention))

    if role in ctx.user.roles:
        await client.remove_roles(ctx.userName, role)
        return await client.say("{} role has been removed from {}."
                                  .format(role, ctx.userName.mention))
#

if i only put username

#

it says i havent specified a role

#

and idk how to specify the correct role

#

because it says

#

"user <userID> rolename not found"

slender thistle
#

Probably put role param as a string and use discord.utils.get() on it

#

And if nothing was found, then output the string var "role"

lyric lotus
#

could you give an example

#

of how the code would look

#

im preety bad at programming

#

just the line that needs to be fixed

slender thistle
#

async def role(ctx, userName: discord.User, role: str = None):

#

And docs should have examples on discord.utils.get()

lyric lotus
#

ok

#

ill try

onyx summit
#

how to add a Field on a embed without a title?

#

node

ruby dust
#

you can't?

#

if you add a field, you must use both name and value

spring ember
#

a promise you made was not caching errors or was not in a try catch block, I assume your bot doesn't have message write permission

lyric lotus
#

im still confused

#

i kinda fixed it

#

from @client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):

#

its not

#

@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: str = None):

#

but now what>

#

its still the exact same

#

if it's someone else there,my problem is that when i use the command it sees both arguements as 1

#

the username

#

the one i put first

#

if i take out the * after ctx

#

it says that role doesnt exist

spring ember
#

umm what code?

lyric lotus
#

@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: str = None):

#

it has more to it

#

this is the part im trying to fix

#

when i use the command

#

it says i didnt specify a role

#

if i specify a role

#

it takes it as part of username

spring ember
#

tbh you don't need to tell python the type

lyric lotus
#

yeah

#

async

spring ember
#

it has type inferring

#

async is not related to type inferring

lyric lotus
#

what?

#

i dont get it

#

from @client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):

#

so this is the same code

spring ember
#

oh oh I get it wait

lyric lotus
#

?

#

i am really confused at this point,i have tried serveal ways

#

if i remove the * after ctx it says role doesnt exist

#

what is it

spring ember
#

where does it say?

lyric lotus
#

oh

#

its like

#

a thing i added

#

in the code

#

it sends a message

#

that the role doesnt exist

#

or i didnt specify one

#

if its wrong

#

@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):

    if role is None:
        return await client.say("You haven't specified a role! ")

    if role not in ctx.message.server.roles:
        return await client.say("That role doesn't exist.")

    if role not in ctx.message.author.roles:
        await client.add_roles(ctx.userName, role)
        return await client.say("{} role has been added to {}.".format(role, ctx.userName.mention))

    if role in ctx.user.roles:
        await client.remove_roles(ctx.userName, role)
        return await client.say("{} role has been removed from {}."
                                  .format(role, ctx.userName.mention))
#

full code

#

oh wait

#

ctx.message.author needs to change

#

let me see if i did

#

it might fix it

#

lets try

slender thistle
#

@lyric lotus remove the *

lyric lotus
#

i did

#

but all it does

#

is cannot let the role be specified

#

i put a role

#

and it cant find it

#

lets try again

slender thistle
#

What is your current code

lyric lotus
#

currently

#

@client.command(pass_context=True)
async def role(ctx, userName: discord.User, role: discord.Role = None):

    if role is None:
        return await client.say("You haven't specified a role! ")

    if role not in ctx.message.server.roles:
        return await client.say("That role doesn't exist.")

    if role not in ctx.userName.roles:
        await client.add_roles(ctx.userName, role)
        return await client.say("{} role has been added to {}.".format(role, ctx.userName.mention))

    if role in ctx.userName.roles:
        await client.remove_roles(ctx.userName, role)
        return await client.say("{} role has been removed from {}."
                                  .format(role, ctx.userName.mention))
#

even if i ping the role

#

it cant find it

#

like @rolename

slender thistle
#

Uhm

lyric lotus
#

i do j!role @nameoftheuser @role or just put role itself

#

idk

slender thistle
#

ctx.userName?

lyric lotus
#

idk

slender thistle
#

It is just userName

lyric lotus
#

oh

#

oof

#

thanks

slender thistle
#

Remove ctx from there

lyric lotus
#

imstoopid

lyric lotus
#

im new to programming so

slender thistle
#

And everywhere else where ctx.UserName is a thing

lyric lotus
#

ok

#

thanks

slender thistle
lyric lotus
#

lets try

#

before it could only give me roles

#

thats why i changed it

#

still

#

same problem

#

the role doesnt exist

#

its sth about

#

either

#

the 1st line

#

or the 4th

slender thistle
#

I am not even sure, maybe replace discord.User with discord.Member

lyric lotus
#

ok

#

its i think about the 4th line

#

which says

#

if role not in ctx.message.server.roles:
return await client.say("That role doesn't exist.")

#

because it always gets me this result

slender thistle
#

Probably...

for server_role in ctx.message.server.roles:
    if server_role.id == role.id:
        # do stuff```
#

I wish I had my eval command available rn

lyric lotus
#

where

#

oh

#

hm

#

so i put this like

#

where

#

(im too new to programming i know)

slender thistle
#

Well, you can put your stuff under that if statement

#

Just not the "if role not in ctx.message.server.roles"

lyric lotus
#

hm

#

let me see

#

so i put this

#

over the one which says

#

hm

#

if role not in userName.roles

slender thistle
#

Basically, yeah

lyric lotus
#

ok

slender thistle
#

And don't forget the indentation

lyric lotus
#

and switch out all ctx.message.server.roles

#

oh yeah

#

tab

#

thing

#

do i replace those

slender thistle
#

Replace what

lyric lotus
#

the ctx.message.server.roles

#

forserver_role

#

or not

#

no

#

i get invalid syntax

#

awat client.add_roles(userName, role)

#

await

#

what

#

whats wrong with that

#

hm

#

oh got it

#

nop

#

i didnt

abstract crystal
#

please stop writing like this, thx

lyric lotus
#

jok sorry

#

ok*

ruby dust
#

so I've realized that "printing ascii characters" issue is not related to python or it's version, but rather an OS, since the same ascii can be easily printed on windows cmd, just not on linux terminal

lyric lotus
#

ok

ruby dust
#

I don't remember the actual error message, but it's about failing to encode those characters

#

any ideas?

slender thistle
#

UnicodeError?

runic cloud
#

as I define the text that the user writes

#

in js

ruby dust
#

yes, unicode error

#

I think

runic cloud
#

as I define the text that the user writes

#

in js

raven socket
#

Why is discord api printing: `(node:359) UnhandledPromiseRejectionWarning: DiscordAPIError

at item.request.gen.end (/rbd/pnpm-volume/9fd7e761-dc73-4c63-b85b-3e9e850038ca/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)

at then (/rbd/pnpm-volume/9fd7e761-dc73-4c63-b85b-3e9e850038ca/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

at <anonymous>

at process._tickCallback (internal/process/next_tick.js:188:7)

(node:359) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

(node:359) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

inner jewel
#

missing a .catch

sour perch
#

how do i run a file in index? i tried doing ```css
var file = require(./file.js)
file.run(client, message, args)

but then message is undefined
#

i do that in the client.on('ready', () => event

sick cloud
#

I mean, you'd need to add quotes around the file name, and have a run function in the file. What does your file.js look like, or whichever?

sour perch
#

yea i just wrote that real quick

#

now not much, but i want to add so that it "remembers to remind" after it has been shut down

#

i managed to save the info from the reminder in a json file

sick cloud
#

Just remember JSON can corrupt easily.

ruby dust
#

can anyone help me with the issue I posted above ๐Ÿ‘€

sour perch
#

ik, but my bot isnt used by anybody so for now thats not an issue ๐Ÿ‘

#

what alternatives are there?

restive silo
#

a real Database

#

SQL or NoSQL

#

for SQL i would recommend Postgres since its really fast, reliable and low RAM usage aswell as it supports NoSQL types like JSON and Arrays, for NoSQL i know MongoDB or Rethink are common used

sour perch
#

Thanks!

restive silo
tawdry fox
#

I use mysql ๐Ÿคท

restive silo
#

MySQL is very slow compared to Postgres and has less features while using more ram ๐Ÿ‘€

#

but yea

#

it surely works as DB

sour perch
#

so SQL makes like a database?

restive silo
#

SQL is a language what is kinda the "Syntax" for working with the Database

#
SQL

SQL ( ( listen) S-Q-L, "sequel"; Structured Query Language) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS...

sour perch
#

๐Ÿค” this will be interesting

#

never done that before ๐Ÿ˜„

restive silo
sour perch
#

i use js

restive silo
sour perch
#

pretty new to coding in general so my experience is quite limited

restive silo
#

oh well yea you wanna take time and look some examples/references up then

#

take time and experiment a lot thats how you get experience in general for Programming jynEHEH

#

and read docs aswell, this helps a lot while developing/testing

ruby dust
#

personaly, to me SQLite3 looked hard af at first cause of false expectations, but it's way easier than you think xd

sour perch
#

๐Ÿ‘ thanks for your time! ill work on this ๐Ÿ˜„

restive silo
sour perch
#

how do i install this?

#

no npm ?

restive silo
#

see here

sour perch
#

ah ic

#

thanks again

simple bramble
#

how do i start making a c#/,net database

#

i saw the js db conversation after i scrolled up but i was wondering how to .net it

restive silo
#

first off you dont "make" a database im sure because that would be a lot of work, you maybe wanna use one

#

and you can use any db what has a library/driver for .Net

simple bramble
#

ok

#

do u know any examples

restive silo
#

Postgres as example has a .Net driver called Npgsql

#

you maybe wanna look into that

simple bramble
#

ok

restive silo
#

but its a library not a ORM like Squelize

simple bramble
#

ok

restive silo
#

means you still need to write your own SQL queries

simple bramble
#

yeah

#

im kinda new to the database coding so it might take me a bit

restive silo
#

thats normal, learning always need time

simple bramble
#

๐Ÿ‘

flint river
#

how long does approval normally take?

ornate raft
#

t i m e

flint river
#

oo

#

hours, days, or weeks generally?

sour perch
#

usually about 24 hrs

flint river
#

ok, thanks

sour perch
#

well from my expirience

flint river
#

thanks for the info

sour perch
#

np ๐Ÿ˜„

slim heart
#

How would one break a forEach loop..

#
            const words = swears.var
            
            const arrays = byp
            

        arg.forEach(arg => {
            words.forEach(words => {
                gogo(arg, words, arrays, stopped);
                
            })
        })```
#

Its a censor bot and it goes thru an array of words but if their are two words that match it runs "gogo" twice

#

Id like it to stop once its done it once

restive silo
#

switch to a for loop and use the break keyword ๐Ÿ‘€

slim heart
#

Idek how to do that honestly

#

Cause all of these tutorials show all this crap. but i cant seem to find any that take any use of an array

restive silo
#

look here

#

they show a example for arrays

slim heart
#

im still really confused

#

Are you saying itd be like

    for(let i in words) {
    gogo(arg, words, arrays, stopped);
}
}```
quartz kindle
#

to break out just put a return after you find a match

#

also the for in loop only returns keys, not values. you need to access the value on each iteration

#

if you're using objects

slim heart
#

@quartz kindle If i put a return it still keeps going

#

It stops that one part of the array from forEach

flint river
#

so, im back after a bit, doing some bug fixes and optimization for my bot, the only issue im having is the slowness to "await client.send_message" each lineor that's what i assume it is from because it prints in python console lightning fast; is one of the only ways to make it faster is to do a compressed post instead of each line indivisually?

slim heart
#

But continues on the rest of it

quartz kindle
#

what does the gogo function do?

#

the function is always being fired without any check

#

do an if arg = word in the second loop to check if there is a swear word in the message

#

if found: gogo then return

#

also you need a different pointer in each loop, you cant use i in both of them if you're going to compare them

#

something like for a in arg for w in words if a === w gogo return

#

also use toUpperCase() for case insensitive matches

flint river
#

sorry for interrupting, but is embed text the best way to go for posting large datasets?(such as Name. Hobbies, and Description/Bio)

quartz kindle
#

there's no "best way", it simply is the most elegant/beautiful way

#

specially if you need titles, fields, columns, etc

#

the only down side of embeds, is that they dont work is the person has embeds turned off

flint river
#

gotcha. i have a program set to scrape data off a website with about 4k lines in that section, and it goes and sifts through each line, sets all the valid lines into list, then makes sed lists available via a search function which returns all the matches and their matches' corresponding columns/data

#

and it totals to 784 object/ sets of data

#

but when the search function goes, it takes like 5 minutes just for one search post

quartz kindle
#

5 minutes? thats way too long

flint river
#

well,

#

for like 20 to 30 sets

#

each set being a few sentences

quartz kindle
#

even with a data set of about 10mb in size would be searched through in less than a second

flint river
#

ya, in the console it gets done extremely quick, just through the "await client.ssend_message()" function does it take so long

quartz kindle
#

so the problem is when sending the message to discord?

#

then the problem is with your internet's upload speed / response time

#

when my bot was self hosted, it would take anywhere from 2 seconds to 15 seconds to send messages

#

now with a vps all messages take less than 1 second to send

flint river
#

oo

#

ill definitely note that, it has a decent chance of being the root of the issue, i assumed it was just a limiter set either on the server, the bot, or the program module to limit spam

quartz kindle
#

the only limits discord has are attachment size limit, text character limit, and consecutive messages limit

#

is your data being sent in only one message or more than one?

flint river
#

yes

#

every line of each set, with each set having 11 posts

#

having from 5 to about 30 posts

#

i mean 5 to 30 sets

quartz kindle
#

so your bot sends 5-30 consecutive messages?

flint river
#

yup

quartz kindle
#

the rate limit is 5 messages per 5 seconds

flint river
#

that would definitly do it

quartz kindle
#

so sending 30 messages will take a minimum of 30 seconds total

flint river
#

thanks for the help, it would try to send around 55 to 330 lines of code per search, so that's 99% the issue, either way, doing each set in an embed post would be much more efficient

quartz kindle
#

try to reduce the amount of data you post, and join it as much as possible in a single message

flint river
#

will do

#

i mean, considering i learned data scraping yesterday, and discord bot modules today, i couldve done worse xd

quartz kindle
#

good job :D

#

the main performance bottlenecks are always external data transfers, either network (http requests) or hard disk (loading files)

#

if you keep those to a minimum, everything else should be fine

earnest phoenix
#

๐Ÿ“ก Pong! 778ms.

#

Oh no

#

It's coming back

#

cedric wont stop writing

#

still writing

#

Hi, I want to translate my bot in 4 languages, what's the best way to do it plz ? I though about copy my command file (that contain all commands scripts) in 3 other files that will be translated and use the adaptated file by it's language (so 12 commands files in total for normal commands and games commands).

I thing it's a bad solution but the other solution i've found its by using a json where I will put all trads for all commands it will be somethinglike that:

if (msg == "command"){
creating embed
   .setAuthor(commandTrans.Author)
   .addField(commandtrans.msgtitle, commandtrans.msg, true) } ```

But json files take a little time so, what's is the better solution ? Do you have an alternative ?
#

database

#

Yeah writing a lot but it's because i'm not good in english

#

oh np

#

database ? ok i will look for that thx for your ansew

sick cloud
#

@earnest phoenix, I keep files like lang_en.json, then depending on my servers config setting (en, etc..) I require lang_{langname}.json and use the presets and such.

earnest phoenix
#

Do it in differents jsons ? Is that not better to use multiples js files with a translated copy of the original command ?

#

I would recommend different jsons

#

oh ? Because it's faster or take less memory ?

#

Less confusing...

#

ok then I will do that

old swallow
#

Whats wrong with my bot? I installed ffmpeg, though when I try playing music it says cannot find FFMPEG??

coral lichen
#

@old swallow hosting on pc?

#

or vps

old swallow
#

@coral lichen, VPS.

coral lichen
#

did you try restarting your vps

sick cloud
#

What's this mean? ๐Ÿ‘€

(node:7955) UnhandledPromiseRejectionWarning: TypeError: fn.bind is not a function

Its erroring w/ that when I try making a channel.

abstract mango
#

@old swallow have you tried installing the ffmpeg-binaries package

#

from npm

#

(if you use d.js/eris)

earnest phoenix
#

anyone know how to repeat music with ytdl-core?

#

?help

#

Ok i should never do that again

knotty steeple
#

@sick cloud you know what line is causing that error?

earnest phoenix
#

@sick cloud are you on master? this was caused in d.js by passing incorrect parameters in collection functions like .filter

#

for example on master, .filter no longer accepts key, value parameters but a function instead, so calling it the old way would cause the fn.bind error

#

its thrown as unhandled promise rejection in your case because its coming off a promise or an async function that you're not catching / nor catching rejected promises globally

earnest phoenix
#

@sick cloud discord.js master doesnt accept strings for functions like filter anymore

sick cloud
#

darn ok i get it

#

thanks ^

#

i was using roles.find('name', 'something')

flint river
#

if im trying to get my bot approved, should i be running it constantly?

drowsy lily
#

thats.....a weird question.

#

are you planning for it to have extensive downtime after getting it approved?

flint river
#

well, more of i was unsure whether i would be running it locally, or it would be run through the coding desc, as well as i was unsure as to whether they tested the bot

#

essentially just being unsure about the process

drowsy lily
#

coding desc?

flint river
#

Detailed description of your bot *
HTML & Markdown allowed, minimum 300 characters

#

ok re-reading that, i might just be retarded

drowsy lily
#

lol

#

can happen to anyone ๐Ÿ˜‰

flint river
#

it was late, i was coding for the past 8 to 10 hours

#

i read "html" and said: Welp, ill just copy and paste ma code here

drowsy lily
ruby dust
#

dbl doesn't care about your bot's uptime after it got approved, but it does need to be online while it is being tested by website moderators @flint river

flint river
#

kk ty, and someone said approval process tends to take around 24hr?

ruby dust
#

well there's a queue of bots that are also waiting for approval

#

and mods don't get payed for that

#

they are volunteering

flint river
#

gotcha

onyx summit
#

on another server your bot gets autokicked if it has a poor uptime

ruby dust
#

we don't talk about other bot lists

onyx summit
#

I know just saying

ruby dust
#

all bot lists have their own rules, and dbl works the way I just described

onyx summit
#

also a bot that isnt online doesnt make sense to me thonkku

flint river
#

i was originally unsure about how the bot would be host, whether it was locally or i had to run it globally

onyx summit
#

what you mean with run it globally?

flint river
#

uh, run it locally on my computer, streaming to each bot

ruby dust
#

specifically this bot list doesn't care about uptime at all, but they do decline bots if they are offline during their testing phase, and you never know when it will be your bot's turn

onyx summit
#

streaming to each bot I dont get that

#

maybe iam stooopid

#

excuse me

#

nvm I wouldnt use your local pc to host it, maybe some free like glitch.com (not really a long term solution) or a vps (assuming you use node)

ruby dust
#

skysilk needs more promotion

#

barely anyone knows about it, yet it's in free beta

flint river
#

ya, that's why i was wondering about runtime(srry if i used incorrect terminology), is skysilk able to host Discord Bot programs/Python Script

ruby dust
#

discord is an actual vps

#

if you don't know what vps is you might want to google it

#

wait

#

what

#

I meant skysilk is an actual vps

onyx summit
#

wasnt it that website you need a cc for verification?

ruby dust
#

oh, well skysilk is a free host, yet you need to be accepted into their program in order to use it

onyx summit
#

not a problem with that, but I aint got a cc

ruby dust
#

what's a cc?

onyx summit
#

credit card

ruby dust
#

don't you need that for all vps'?

onyx summit
#

someone also said I should visit a website with beta free vps, but you needed a cc for verification, but dunno if that was skysilk

#

sry cc for verification

ruby dust
#

skysilk is in free beta yes, but you still need a credit card to verify your identity, so like if you use it for illegal shit or something they'll know who to blame

onyx summit
#

Yes I understand that, iam okay with that, but thats not really an option for me, no cc

ruby dust
#

basically any plan you choose gives you 100% discount

#

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

onyx summit
#

but too late anyways, already got a vps and iam good with it

onyx summit
#

xD

sullen path
#

I saw that

slim heart
#

No u didnt

sullen path
#

I think I did

slim heart
#

Idk what your talking about

earnest phoenix
flint river
#

if it says that i edited "@invalid-user" instead of my bot's name, what does that mean? it hasnt had approval yet or that its approval has been denied?

earnest phoenix
#

how can i make my bot make a invite on the servers its on and then send me the invite link

jolly mist
#

What's wrong?

String.prototype.toAlternatingCase = function () {
    tmp = this.toLowerCase(); (this[0] == this[0].toLowerCase() ? i = 1 : i = 0); for(i; i < tmp.length; i = i+2) { tmp = tmp.substr(0,i) + tmp[i].toUpperCase() + tmp.substr(i+1); } return tmp;
}
ruby dust
#

@flint river it's a discord thing, technically it mentioned your bot but since your client didn't cache data about your bot it says invalid-user instead

#

@earnest phoenix I would tell you, but I'm afraid it breaks server privacy, and possibly even discord tos

earnest phoenix
#

WHERE THE FUCK IS THE LOGIC BOIII

ruby dust
#

you have to have pip installed in order to install pip

earnest phoenix
#

yea

#

@jolly mist whats the issue

#

@ruby dust
i know, but i just wanna know how

ruby dust
#

what library?

jolly mist
#

discord.js

earnest phoenix
#

discord.js

ruby dust
#

in your library there should be documented how to create an invite to a channel, just loop through all servers and create an invite from each one of them

#

but don't say I didn't warn you if you get in trouble

earnest phoenix
#

@ruby dust can we talk in dms

ruby dust
#

no thanks, I'd rather keep them locked from randoms

earnest phoenix
#

ko

ruby dust
#

ko

earnest phoenix
#

thanks for the help i did it and i got the invite ๐Ÿ˜„

slim heart
#

๐Ÿ‘

earnest phoenix
#

But im gonna remove the code for it now

ruby dust
#

can one python file have more than one while loop going on? or should I make separate files for them?

tidal parrot
#

Why do you need two different loops?

#

Just different conditions for it to run?

ruby dust
#

2 different uses

#

like I currently have 1 loop to post server count on 2 different sites

#

and I kinda want to separate them

tidal parrot
#

Why seperate them

#

Because I don't know python that well and I'm not sure if u can have 2 at once

#

But if u want it to run under different conditions

#

you could do smth like

#
while True:
  if condition1
  //Whatever

  if condition2
  //Whatever
#

It would be in the same loop but different conditions

ruby dust
#

I don't need ifs thonkku

#

the fact that I'm opening an aiohttp session, I can't use it again to post another server count stat even if I close it

#

so I have to wait at least 10-15 seconds and open it again

#

so I need 2 different loops

tidal parrot
#

Hmm

#

I can't help u bc I'm shit with python sorry

uncut slate
#

@jolly mist are you trying to dO tHiS?

#

note that whatever that code is supposed to do is creating globals

#

you don't want globals

raven socket
#

yo, how would I like add two files together? so in my index.js it would be ``` const discord = require('discord.js');
require('dotenv').config()

const token = process.env.botToken;
const prefix = "s!";

const cmds = require("./commands.js");

var client = new discord.Client();

client.on('ready', function(message) {

});

client.on('message', function(message) {

if(message.author.equals(client.user)) return;
if(!message.content.startsWith(prefix)) return;

switch (args[0].toLowerCase()) {

    case "help":
    //send help command from cmds ("./commands.js")
    break;

}

});

client.login(token) ```

jolly mist
#

@uncut slate no

uncut slate
#

so what are you trying to do

jolly mist
#

Just a bot for discord

flint river
#

@ruby dust if you still have the issue, you could do 2 or 3 programs, with either a parent program starting 2 different child programs, each with a while loop, or 1 parent with 1 while that spawned another child with a while (before it initiated its own while ofcourse)

sour perch
#

hey,so i made a command where i used a loop, is there a way to make a command that stops the same loop in js?

sour perch
#

i use a var x = setInterval(function() { loop

quartz kindle
#

clearInterval(x) ?

sour perch
#

yea, but i want to make it do that on demand

#

so if i do -command stop

#

it does clearInterval(x)

tidal parrot
#

@Rubikscraft#4079

uncut slate
#

@sour perch you'd have to store a reference to the interval

#

e.g.

let interval;

exports.run = function someCommand (client, msg, args) {
  switch (args[0]) {
    case 'start':
      interval = setInterval(() => console.log('hi!'), 1000);
      return 'I started';
  
    case 'stop':
      clearInterval(interval);
      return 'I stopped';
  }
}
earnest phoenix
#
if (message.content.startsWith('ยฟCรณmo hago un rol?')) {
     message.channel.send({embed: {
      color: 0x8dff94,
      description: "๐Ÿ” Buscando pregunta"
    }})
    setInterval({ m.edit(
             ({embed: {
             color: 0x8dff94,
             description: "Ajustes del servidor -> Roles -> Dar click en el signo de `+`"
    }})  
  )}), 2000);
#

Unexpected token . (in m.edit)

sour perch
#

so i put that in an own file or add it to the command with the loop? @uncut slate

uncut slate
#

that's nothing more than an example for you to understand and adapt

sour perch
#

sorry, im new to coding so i need a little extra explanation

#

yea i get that

uncut slate
#

do you have seperate files for all of your commands or is it all just bunched up in one file?

sour perch
#

but i dont understand how it works

#

seperate files

uncut slate
#

show me the simplest one

sour perch
#
module.exports.run = async (client, message, args) => {
    if (!args || args < 1)return message.channel.send('Just type your suggestion here and it will be sent to the devs :smile:');

    message.reply('Your suggestion was sent to the Developers, Thank you! if you want updates on your suggestion, join our devserver')

    const Discord = require('discord.js')
    const embed = new Discord.MessageEmbed()
    .setColor(746215)
    .setFooter(`ยฉR3mind3r by Hab, Suggestion by ${message.author.tag} `, 'https://i.imgur.com/GH1Omx2.png')
    .setTimestamp()
    .setThumbnail(message.guild.iconURL())
    .addField(`Server: ${message.guild.name}`, args.join(" "), true)
    
    client.channels.get("454242855179780096").send({embed})

    console.log(`${message.author.tag} Sent a suggestion!`)
}
#

idk if its the simplest, but i just picked it

ruby dust
#

why do I feel like you either poorly copied the code or it's actually a bad code

sour perch
#

idk

#

i did it myself so probably the last one

ruby dust
#

you somehow made your variables into strings, and strings into variables

earnest phoenix
#

No one answered my question xd

sour perch
#

what do you mean my variables are strings?

#
module.exports.run = async (client, message, args) => {
    if (!args || args < 1)return message.channel.send('Just type your suggestion here and it will be sent to the devs :smile:');

    message.reply('Your suggestion was sent to the Developers, Thank you! if you want updates on your suggestion, join our devserver')

    const Discord = require('discord.js')
    const embed = new Discord.MessageEmbed()
    .setColor(746215)
    .setFooter(`ยฉR3mind3r by Hab, Suggestion by ${message.author.tag} `, 'https://i.imgur.com/GH1Omx2.png')
    .setTimestamp()
    .setThumbnail(message.guild.iconURL())
    .addField(`Server: ${message.guild.name}`, args.join(" "), true)
    
    client.channels.get("454242855179780096").send({embed})

    console.log(`${message.author.tag} Sent a suggestion!`)
}
#

thats the right markdown

ruby dust
#

oh yes

sour perch
#

?

#

@uncut slate ^^

uncut slate
#

yeah

#

so like

#

module.exports.run is a function

#

the bit of code inside of the function is what gets ran whenever someone runs the command

#

you understand so far?

sour perch
#

yea

uncut slate
#

so, code that's outside of that function is NOT ran whenever someone runs the command

#

that's where you can store references

#

play around with this:

let counter = 0;

module.exports.run = async (client, message, args) {
  msg.channel.send(counter.toString());
  counter++;
}
#

and you'll see that the counter variable is "shared" and gets increased every time you run the command

sour perch
#

ok, thanks

uncut slate
#

just like the counter, you can store an interval variable outside of the function

sour perch
#

but how do i run it when someone does another command then?

uncut slate
#

if they're in seperate files, you'll have to share it on an object

#

like client

sour perch
#

well, they dont have to. do they?

uncut slate
#

if you have a command structure where one file = one command and you're talking about two different commands, they will be in seperate files

#

if you're talking about the same command with different arguments, like my first example, they can be in one file

native narwhal
#

Good developer :pat:

sour perch
#

ok, ill do it in one file then

#

thanks a lot for your time!

uncut slate
#

๐Ÿ‘

#

@native narwhal no u

native narwhal
#

No both of us

earnest phoenix
#

help

#

every time i use a command

#

it puts here the command i used

#

and i want to remove that

sullen path
#

What lib

earnest phoenix
#

python

#
        e = discord.Embed()
        e.set_author(name="Add HQ|Music", url="https://discordapp.com/oauth2/authorize?client_id=467400879763357697&scope=bot&permissions=70380544")
        e.colour = 638064
        e.set_footer(text='HQ|Music|[v{}]'.format(BOTVERSION), icon_url='https://cdn.discordapp.com/attachments/467402459946680330/467402502334054410/NEWMUSIC-BOT-LOGO-3.gif')
        return e```
#

thats my embed

#

mention me when you got an answer

sullen path
#

I donโ€™t have one

quartz kindle
#

the help is being set somewhere else, not in that code

earnest phoenix
#

i will double check then

earnest phoenix
#

So you know how some bots give you something when you upvote. Pokecord given you credits when you upvote, but it's not working for someone.

wild tide
#

can you elaborate on that? What do you mean?

earnest phoenix
#

Well, when upvote the bot, youd type in a command and get credits. But it's not working. They upvote, it says thank you, but the bot seems to think they didn't. They tried voting again, it said come back in 24 hours. They've tried logging in and out, but that's about it. they don't have other devices

quartz kindle
#

if its an issue with a specific bot, you have to contact the bot developer or their support server

earnest phoenix
#

They said it was something the developer couldn't control

#

And to contact discord bots

quartz kindle
#

then the developer should be the one to seek help here

#

most likely he needs to change some code in his bot

earnest phoenix
#

Okay, I'll see into it

#

It's not a thing that happens to everyone, just this one person

earnest phoenix
#

Hey, so I'm able to do basic discord features such as message.channel.send but using embeds and other things I get an error saying client is undefined, and yes it is defined in my main js file.

const Discord = require('discord.js');

exports.run = (client, message, args) => {

    const myEmbed = new Discord.RichEmbed()
        .setTitle(`${message.guild.name} Info`)
        .setColor("#C61E84")
        .setDescription(`unfinished`)
        .addField("unfinished")

    message.channel.send({ embed: myEmbed });

}
wild tide
#

can you send how you defined client in you main js file? dont have to send all you code, just the client const

earnest phoenix
#

const client = new Discord.Client();

wild tide
#

In the file with your embed, define your client under Discord

#

You cannot declare a variable that is in another file I believe, I mean, every time I have done that it hasn't worked

earnest phoenix
#

Oh thanks

#

I can totally see where I went wrong and now I look stupid haha

wild tide
#

lmao

keen anvil
#

@restive silo hi, can you explain something to me.

#

oh probably asleep

#

big rip

#

Am I missing something insane and simple?? Because it seems that I'm looing at stats.clusters so how is it undefined

cinder stratus
#

**bot.on('ready', () => {
console.log("Turning On Bot");
bot.user.setActivity("TESTING", {type: 2});
})
bot.on('message', function (message) {
const args = message.content.slice(prefix.length).trim().split(/ +/g);

client.on("guildMemberAdd", (member) => {
const guild = member.guild;
if (!newUsers[guild.id]) newUsers[guild.id] = new Discord.Collection();
newUsers[guild.id].set(member.id, member.user);

if (newUsers[guild.id].size > 10) {
const userlist = newUsers[guild.id].map(u => u.toString()).join(" ");
guild.channels.get(guild.id).send("Welcome our new users!\n" + userlist);
newUsers[guild.id].clear();
}
})

client.on("guildMemberRemove", (member) => {
const guild = member.guild;
if (newUsers[guild.id].has(member.id)) newUsers.delete(member.id);
});**

#

is any mistake of

cinder stratus
#

hey help

jovial sigil
#

@keen anvil Maybe try using stats["clusters"] ?

neon schooner
#

@cinder stratus error?

cinder stratus
#

if(message.content.startsWith(prefix + "help")) {
message.channel.send({embed: {
color: 3447003,
author:
"name" (client.user.username)
"icon_url" (client.user.avatarURL)
}
title: "My Commands Are",
description: "This Is The Commands Of LITHIUM Bot.",
fields: [{
'name': "++serverinfo",
'value': "By These Command You Can Get Info About Your Server."
},
{
'name': "++avatar",
'value': "By These Command You Can See Your Profile Picture ."
},
{
'name': "++invite",
'value': "By These Command You Can Join The Support Server Of LITHIUM."
},
{
'name': "++youtube",
'value': "By These Command You Can Search Anything On Youtube."
},
],
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "ยฉ LITHIUM"
}
}
});
'name': "++invite",
'value': "By These Command You Can Join The Support Server Of LITHIUM."
},
{
'name': "++youtube",
'value': "By These Command You Can Search Anything On Youtube."
},
],
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "ยฉ LITHIUM"
}
}
});

#

see this

#

leave that

neon schooner
#

code blocks are infinitely more useful

#

than just pasting the code.

cinder stratus
#

for this code error is error is unexpected end of input

sick cloud
#

It means your missing a ) or } or such somewhere in your code usually.

cinder stratus
#

Hmm Let Me Find

#

I didnt find

restive silo
#

@keen anvil no i actuall dont know why that would ever happen, and yea sorry was sleeping

earnest phoenix
#

i need sum help with sqlite

#

if anyone could help me dm pls

sick cloud
#

Does anyone have any experience with Level/LevelDB?

earnest phoenix
#

Is it against TOS to have a chat logger if the server owner specifies to log their chat and dump it at a later date?

ruby dust
#

if you are about to log these events in a private channel it's fine, but if you want log onto your machine then make sure you either keep the database as secure as possible or encrypt it so no one can read it

uncut slate
#

@sick cloud a little, whats up

earnest phoenix
#

why do bots message me 24/7

native narwhal
#

What bot messaged you?

earnest phoenix
#

i think i will need a multiple command in one file, (in file serverinfo) and examples server emojis but idk how ๐Ÿ˜น
any example for me?

#

4 bots from a different discord

#

owo

#

there's no way 4 users would be online at the same time, play the same "game" (link) and message me at the same time\

prisma bluff
#

there was this bot messaged me out of no where.

#

like... just messaged me saying "ez"

#

checked mutual server... but no mutual servers with it. :/

earnest phoenix
#

a bot

#

an actual bot bot

#

or user bot

#

@prisma bluff

prisma bluff
#

i have a screenshot

#

not even sure if its an actual bot or userbot

sullen path
#

Itโ€™s a real bot

#

Pretty sure it got deleted for mass DMs via open eval

earnest phoenix
#

@prisma bluff a bot bot had a bot tag

#

obviously

#

bot bots don't show mutal guilds

prisma bluff
#

the more i know

#

havent actually seen a user bot...

#

xD

earnest phoenix
#

wanna see one?

#

4*

#

lol

prisma bluff
#

lmao

earnest phoenix
#

async def cmd_clear(self, player, author, server): await self.disconnect_voice_client(server) player.playlist.clear() return Response("test")

gilded thunder
#

Code

# find channel to send welcome message too
async def find_channel(server):
    for c in server.channels:
        if not c.permissions_for(server.me).send_messages:
            continue
        return c

# server join handler
@bot.event
async def on_server_join(server):
    channel = await find_channel(server)
    embed=discord.Embed(title="Hi, I'm Arc", description="Thanks for inviting me. If you need help with anything, [join here](https://discord.gg/) and for the command list, [check here](https://gitlab.com/Joshek/discordarc/blob/master/commands.md). Hope you enjoy using me!", color=0x176cd5)
    await bot.send_message(channel, embed=embed)

Error

Ignoring exception in on_server_join
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "bot.py", line 661, in on_server_join
    await bot.send_message(channel, embed=embed)
  File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "/usr/local/lib/python3.6/site-packages/discord/http.py", line 200, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400): Cannot send messages in a non-text channel```
earnest phoenix
#

why

gilded thunder
#

ah crap

earnest phoenix
#

@quiet bobcat

#

good

gilded thunder
#

Yeah, I sent the code

#

Dipshit

earnest phoenix
#

^^ toxic

gilded thunder
#

Didn't mean to do it on purpose

earnest phoenix
#

alright but dont be rude

#

man

#

what the hell

gilded thunder
#

Anyway

#

Can't define text_channels so I'm not sure how I'll find the default channel.

#

The server I tested on's hierachy only has text channels too.

quiet bobcat
#

why did you ping me?

#

@earnest phoenix

earnest phoenix
#

@quiet bobcat umm he posted an invite ac

#

so dw

gilded thunder
#

I posted my bots code and it had the support server invite embedded.

#

And discord sends invite embeds even if it's in a block.

earnest phoenix
#

ooooooh i thought you put it in there

quiet bobcat
#

that's fine

gilded thunder
#

Which I completely overlooked

quiet bobcat
#

i think

earnest phoenix
#

async def cmd_clear(self, player, author, server): await self.disconnect_voice_client(server) player.playlist.clear() return Response("test") shouldnt this work???????????????

gilded thunder
#

Well if it doesn't then it won't.

#

Check your traceback.

earnest phoenix
#

i dont get an error message

#

tho

#

but it doesnt work

#

it does disconnect

#

but it doesnt clear the playlist

#

When adding a detected description for a bot on discordbots.org - is it possible to include stylesheets from an alternative source?

#

If linking a stylesheet is not permitted, mind me asking why? <@&264889767072628742>

native narwhal
#

You did not have to mention all of us

quiet bobcat
#

you don't haev to ping every web mod

austere meadow
#

@earnest phoenix it is possible?

earnest phoenix
#

I'm unsure, that's why I'm asking the team.

quasi marsh
#

You can also just ask one of them

earnest phoenix
#

My bad for mentioning the whole crew ๐Ÿ˜ฎ

#

So, is that a yes or no to allowing external stylesheets?

native narwhal
#

Should probably work, otherwise you can just copy paste it in to a style tag

earnest phoenix
#

Will do, thank you. @native narwhal

gilded thunder
#

@earnest phoenix Check your terminal

slender thistle
#

@gilded thunder Use text_channels

#

Instead of channels

#

Oh wait

gilded thunder
slender thistle
#

Add an if s.type is discord.ChannelType.text: or if isinstance(s, discord.ChannelType.text):

gilded thunder
#

Okay, thanks

#

I'll try that

slender thistle
#

The bot is most likely grabbing a voice channel

gilded thunder
#

There's no voice channels in my test server

#

So it can't really be that

slender thistle
gilded thunder
slender thistle
#

Try print(c) and see what you really are getting

gilded thunder
#

okay

slender thistle
#

It could somehow be a category (but I doubt since async doesn't support those, I guess?)

gilded thunder
slender thistle
#

Not in eval

#

I am talking about your find_channel function

gilded thunder
#

Ah, gotcha

#

Sorry

slender thistle
#

Np

gilded thunder
#
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "bot.py", line 663, in on_server_join
    await bot.send_message(channel, embed=embed)
  File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "/usr/local/lib/python3.6/site-packages/discord/http.py", line 200, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400): Cannot send messages in a non-text channel```
#

Didn't print

#

Must be fidning catergories

#

Lemme try delete them

#

Aha, sent now

#

Was an issue with the catergories

#

@slender thistle thanks for helping

slender thistle
#

๐Ÿ‘

onyx summit
#

can someone tell me a good guide to start with image modification in node?

#

Iam okay with node,but never did image modifications

waxen quest
restive totem
#

Your library should be providing it

onyx summit
#

@waxen quest on node its:


        client.user.setActivity( "Thats custom", {
     type: "WATCHING"
     });
waxen quest
#

Thank you

earnest phoenix
#

just use setPresence instead

#
"status": "online",
"game": {
"name": "Discord API"
}})```
#

this is for nodejs

#

using djs

slender thistle
neon schooner
#

Yea, need to use setActivity for that, sorry.

sour perch
#

hi, so i made a command that use a loop, and i want to make people able to stop that loop by doing for example -command stop, so i did this:

let interval;

exports.run = async (client, message, args) => {
  switch (args[0]) {
    case 'start':
      interval = setInterval(() => console.log('hi!'), 1000);
      console.log('I started');
  
    case 'stop':
      clearInterval(interval);
      console.log('I stopped');
  }
}
#

but it only returns 'i started' then right after 'i stopped'

#

never mentions 'hi!'

#

i got this from someone here yesterday

gilded thunder
#

Don't take code from here then?

sour perch
#

i changed some off it though

#

this is the original XD ```js
let interval;

exports.run = function someCommand (client, msg, args) {
switch (args[0]) {
case 'start':
interval = setInterval(() => console.log('hi!'), 1000);
return 'I started';

case 'stop':
  clearInterval(interval);
  return 'I stopped';

}
}

gilded thunder
#

I don't do d.js or eris or whatever lang, so I can't help.

sour perch
#

and it worked Thonk

#

๐Ÿคฆ

#

sorry im stupid lmao

#

i removed return

plucky fox
#

Is there a c++ api for discord

#

;/

slender thistle
plucky fox
#

Ooh

kind garnet
#
body {
    background: url("https://i.giphy.com/media/6R3boOvvH0IMw/giphy.webp") no-repeat;
    background-size: auto;
}
.bot-description {
    color: white;
}
.is-flex {
    color: grey;
}
.lib {
    color: grey;
}

</style>```
#

Any idea why this is only changing the bot description?

#

is-flex is another classs

#

class*

quartz kindle
#

open it in the element inspector