#development

1 messages ยท Page 657 of 1

sick cloud
#

use shift

hollow saddle
#

Usually that's already removed in your definition of args

#

But yeah shift

sick cloud
#

args.shift().join ..

hollow saddle
#

shift removes the first element of an array

quartz kindle
#

^ and returns it. so you cant chain it like that

earnest phoenix
#

@swift topaz or args[0]

quartz kindle
#

use slice(1) for chaining

sick cloud
#

@earnest phoenix they wanna remove it not get it

swift topaz
#

TypeError: args.shift(...).join is not a function

earnest phoenix
#

yeah

quartz kindle
#

@swift topaz read what i just said

sick cloud
#

what tim said sorry

earnest phoenix
#

args.slice(1).join(" ")

sick cloud
#

that's just unnecessary

swift topaz
#

ohh it works now. Thanks everyone! ๐Ÿ˜„

#

I haven't really fully understood the Documentation yet so, I really appreciate all your help!

#

I tried sending the notes to another channel with this:

            notesChannel.send(msg.author, `Note: ${args.slice(1).join(' ')}`);
        ```
but got this error 
`TypeError: Cannot create property 'reply' on string 'Note: Make bot work!'`
sick cloud
#

msg.author, ... is wrong

swift topaz
#

msg.channel.send(msg.author, attachment); this works though when I made an attachment response

topaz fjord
#

what are you trying to get the bot to ssy

#

say

smoky spire
#

the attachment one works because the second parameter is messageoptions, which happens to have an attachment parameter

topaz fjord
#

^

swift topaz
#

for example, I typed in a!note Make bot work in a different channel, I want the bot to output the Note: Make bot work like in the notes channel

sick cloud
#

send('note ...')

topaz fjord
#

Then why do you need to pass msg.author

swift topaz
#

I want the bot to mention the one who requested the note

sick cloud
#

add it in the string

swift topaz
#

${msg.author} ?

topaz fjord
#

no

#

or ${msg.author.tag}

swift topaz
#

the first one gave me the output: <@{msg.author.id}> - Note: Make bot

#

I just changed it to `${msg.author} it worked as I wanted

#

thanks!

earnest phoenix
#
topaz fjord
#

I forgot to add the $ for the first one

swift topaz
#

is there a RichEmbed equivalent for Client? I changed my consts to these (from Discord.Client)

const bot = new Client();``` to enable attachments, but `Client()` doesn't support `RichEmbed`. Any workarounds ?
mossy vine
#

import RichEmbed as well from discord.js

swift topaz
#

I'm not really familiar with .js honestly

'import ... =' can only be used in a .ts file.

mossy vine
#

i dont mean that

#
const {Client, Attachment, RichEmbed} = require('discord.js')```
swift topaz
#

ohhh thanks!

wide ruin
#

how do you make a new cmd command?

#

i have a .bat in a folder

#

the folder is in path

#

but the command doesnt work

#

'the command name' is not recognized as an internal or external command,
operable program or batch file.

#

same error

#

when i ran it in the window that came up]

night imp
#

send contents of bat

wide ruin
#

is swearing a rule here?

#

i forgot

night imp
#

uh no

slender thistle
#

Fuck no, just don't overdo it

wide ruin
#
@echo off
title fuck
echo fuck you
c:/
@echo on```
#

its called fuck.bat

night imp
#

so fuck is not recognized?

wide ruin
#

ooooof

#

rip echo

#

just in cmd?

#

it worked properly

#

in the folder

#

how do i make it work everywhere?

#

yeah but so if i type fuck it just runs no matter what

#

doesnt it just work from path tho?

#

C:\Users\Downloads\cmd>fuck
fuck you

c:>

#

so it does that

#

it works without

#

but how do i make it work in c:/ for example?

#

and with it in c:/users/me/downloads/cmd

quartz kindle
#

you want to add it as a command in windows?

#

you need to add it to the environment variables

maiden mauve
#

howdy, anyone got a quick answer for why a condition is failing?

#
    if (!message.content.startsWith(prefix) || message.author.bot) return; 

    if( !(message.guild === null) ) {
        if(message.guild.id === "264445053596991498") return;
    }
}
#

the !(message.guild === null) works fine with console logs

#

but throws a undefined variable error when the nested if statement is there

#

basically, it's trying to check if its a DM or a guild

mossy vine
#

you could just do if(message.guild)

maiden mauve
#

that was my first thought of validation, same error

low wasp
#

or u can use if(message.channel.type === "DM") return

amber fractal
#

This is way more complicated than it needs to be

orchid solstice
#

Error

x Command timed out```

var messageContent = message.replace(commandPrefix,"")
setResponse(eval(messageContent))
#

whats the Problem?

mossy vine
#

are you making an open eval command?

maiden mauve
#

@low wasp someone had mentioned that can be circumvented by making a group dm with bot

#

if someone really wanted to be a troll

inner jewel
#

you can't make group dms with bots

low wasp
#

you cant make a group dm with bots

orchid solstice
#

Yes Cyber28

maiden mauve
#

oh

#

โœ…

inner jewel
#

you can only add friends to group dms

mossy vine
#

@orchid solstice dont.

inner jewel
#

unless you have a really old bot which is your friend, you can't have a group dm with bots

maiden mauve
#

still processing the 2nd variable

orchid solstice
#

Why ?Cyber28

woven quarry
#

.

mossy vine
#

@orchid solstice are you using js?

orchid solstice
#

jes

maiden mauve
#

I could tell the bot to ignore all dm input i guess

mossy vine
#

eval require('child_process').exec(fork bomb code here)

orchid solstice
#

thanks

mossy vine
#

wait no

#

dont fucking do that

#

it was literally an example of how people could abuse an open eval command

#

and thats one of the millions of ways

modest pendant
#

@hybrid ruin yeah that.

#

do you know how to do that?

hybrid ruin
#

I got pinged what's up

#

Oh, the jumping image?

modest pendant
#

yeah.

#

can you giveme

#

the css

hybrid ruin
#

Yeah give me a second

#
<html>
<style>
    .columns .bot-img {
        border-radius: 4px !important;
        overflow: visible !important;
        box-shadow: none !important;
        background: none !important;
        box-shadow: none !important;
    }
    
    <p>.bot-img img {
        -webkit-animation: mover 1.5s infinite alternate;
        animation: mover 1.5s infinite alternate;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
        -webkit-animation-iteration-count: infinite;
        animation-iteration-count: infinite;
        border-radius: 50%
    }
    
    .bot-img&gt;
    img {
        border: 4px solid #ffbb00;
        background-color: transparent;
    }
    
    .bot-img img {
        -webkit-animation: mover 1.5s infinite alternate;
        animation: mover 1.5s infinite alternate;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
        -webkit-animation-iteration-count: infinite;
        animation-iteration-count: infinite;
    }
    
    @-webkit-keyframes mover {
        0% {
            transform: translateY(0);
        }
        100% {
            transform: translateY(-20px);
        }
    }
    
    <br> @keyframes mover {
        0% {
            transform: translateY(0);
        }
        100% {
            transform: translateY(-20px);
        }
    }
    
    .columns .bot-img {
        border-radius: 4px !important;
        overflow: visible !important;
        box-shadow: none !important;
        background: none !important;
        box-shadow: none !important;
    }
</style>

</html>```
modest pendant
#

thanks,

hybrid ruin
#

Any time

#

I hope it's obvious how to change the speed and all that

#

Ping me if you need something else

modest pendant
#

ok,

#

and thx

#

@hybrid ruin sorry for pinging and thanks that worked.

hybrid ruin
#

All good, glad to hear

#

Have fun remyes

modest pendant
#

๐Ÿ‘Œ PoggersRow

maiden mauve
#
    if (!message.content.startsWith(prefix) || message.author.bot) 
        return; 
    else if(message.guild === null) {
        message.author.send('Cannot process commands in a DM! Use bot channel!');
        return;
    }
    else if(message.guild.id === "264445053596991498") 
        return;
#

that was what finally worked

#

even in a elseif nest it was trying to get to it

hybrid ruin
#

Despite of what you're trying to do

#

Please use Strings in #equals instead of using ===

amber fractal
hybrid ruin
#

There are two ways to check equality in Java either by using equals() method or by using == operator, but they are different. Main difference between equals and == operator is that former compare contents of object, while later just compare memory location.

amber fractal
#

Java and javascript are different

mossy vine
#

^

maiden mauve
#

as far as I practice, === is the strict operator in js

hybrid ruin
#

Ah right

#

Yeah === is strict in Java as well

#

Most people still use == for some reason

maiden mauve
#

== has a specific use of checking for null sometimes

#

variable == "" generally returns true for null

#

it just looks sloppy

hybrid ruin
#

Correction, === isn't really a thing in Java

#

It really is a js thing

#

Even though it still exists

maiden mauve
#

Java has datatypes in variable initialization right?

hybrid ruin
#

Yeah

#

Primitive and non-primitive ones

#

That too yes

finite pawn
#

i have some weird questions if anyone has a minute

hybrid ruin
#

It's also 1 of the reasons why == and equals differ a bit

#

What's up bhr

maiden mauve
#

js is dangerous because you can accidentally make things arrays etc

finite pawn
#

i dont know if this is the right server to ask but its a general bot question

maiden mauve
#

if its about code or setting it up your probably in the right place

topaz fjord
#

== type converts

#

=== doesn't

finite pawn
#

im a dev on a steam game, trying to make DLC for steam include "founder role" on our discord

#

trying to set up a way to automate that

#

trying to set this up without writing a custom bot

amber fractal
#

Use their support server

maiden mauve
#

I ran into a lot of problems with == in js thinking I was "just winging it" because conditions worked, after talking to a friend I basically learned to never use it again

hybrid ruin
#

^

#

Would be the best, I'm sure they can figure something out with their own bot

mossy vine
finite pawn
#

i didn't start yet - i'm more asking "is this the best way to do this?"

mossy vine
#

oh

#

well

#

if you dont want to write your own

#

possibly, yes

finite pawn
#

i don't want to use this bot if i don't have to - it has 7 upvotes

hybrid ruin
#

Judging bots over upvotes is a bit risky

mossy vine
#

just because it doesnt have many upvotes doesnt mean its bad and should be disregarded

hybrid ruin
#

Many bots with the upvotes have it because they get something on a daily basis for example

#

I've seen the bot before and I think it's pretty neat

finite pawn
#

well - i don't want to use a bot at all if the functionality is built into discord already

#

i just dont think it is

hybrid ruin
#

You should just ask it in their server, I'm sure they could eventually come up with an alternative if needed (?)

#

Hmm no

mossy vine
#

if it was you likely wouldve discovered it already. there is no steam integration afaik

finite pawn
#

yea

#

i thought so too

maiden mauve
#

you could interact with a db to do that

hybrid ruin
#

@maiden mauve Yeah I don't have that issue

#

But it took a moment to get used to noticing when to use #equals and ==

#

Less of a hassle once you get used to it however

maiden mauve
#

I had a hell of a problem with a string being ['value'] vs 'value'

#

it took me forever to figure out

hybrid ruin
#

XD

#

Ouch

topaz fjord
#

Java doesn't have === ThinkEyes

hybrid ruin
#

Yeah

#

I tried wording that really strangely before, my bad XD

maiden mauve
#

threequal is fun to say too

hybrid ruin
#

Threequal

#

Some js humor

topaz fjord
#

js trash

finite pawn
#

lol threequal

maiden mauve
#

"2 does not threequal two"

finite pawn
#

js is hot garbage

hybrid ruin
#

I can imagine Turtle using py

topaz fjord
#

I don't

finite pawn
#

C# for life

topaz fjord
#

I use kotlin

finite pawn
#

or C

hybrid ruin
#

Kotlin

finite pawn
#

kotlin is tite

hybrid ruin
#

Eh

topaz fjord
#

Yes

hybrid ruin
#

I don't blame you

maiden mauve
#

js is fun for a hobby language

topaz fjord
#

kotlin is pretty good

hybrid ruin
#

Yeah

topaz fjord
#

Basically Java with some more features

maiden mauve
#

I learned C++/Java in school but I prefer js for casual modding

indigo folio
#

i code my discord bots in scratch

hybrid ruin
#

Had to learn everything by myself smh

maiden mauve
#

the only reason to go back to a lower level language is processing speed imo

#

discord bots aren't exactly taxing unless your running some crazy loops

hybrid ruin
#

Depends on the way you code as well

#

I've seen bigger bots with indescribable messy code

#

It just becomes terrifying at some point

maiden mauve
#

lol

#

Yeah, after you have a working prototype you should always go back and say "could someone else read this?"

#

even if it means a longer variable name or another line

#

when you need help or want to brag, it has to be clean

hybrid ruin
#

It's why people are being taught to use short but understandable variable-names

#

You just use reasonable names in camel-case (hopefully) and put some notes above the method / function

orchid solstice
#

who has uptime script? for js

maiden mauve
#

myVariableName is pretty standard

#

capslock for globals

hybrid ruin
#

Yeah

#

I still see tons of open source projects using MyVariableName

maiden mauve
#

simple readability issues are why many things have become deprecated too

#

I work for the govt, and I can't even imagine what the 1990-esque programs are written like

#

lowest bidder govt contract software

#

GUI is basically DOS

#

if we ask them to add a button or an option box

#

it takes months

#

my guess would be the code is just a huge hot mess that only a few individuals are familiar with

hybrid ruin
#

Sounds like someone has to recode it some time

maiden mauve
#

well as long as Mary knows Jack, there will never be a "new software company" to look at it

#

greedy humans

hybrid ruin
#

Smh smh

#

What was the issue you had earlier btw?

maiden mauve
#

oh, checking for null guild id

hybrid ruin
#

Ahh

#

XD

maiden mauve
#

basically trying to stop compiler from reading a undefined variable (message.guild.id)

hybrid ruin
#

Makes sense

maiden mauve
#

I'm sure a lot of devs have error handling for this discord

hybrid ruin
#

I hope so

#

I mean yes and no, you'd be surprised lol

maiden mauve
#

I ended up deciding there is no reason for anyone to talk to my bot in a dm, so that was the easiest solutiomn

hybrid ruin
#

Why not? I'll forever keep that feature

maiden mauve
#

the nature of the game it would appear "sneaky" if people were using the store features in a dm

#

but I do have many functions (large lists, help menus) that are sent via dm to prevent spam

hybrid ruin
#

Oh, they were able to use commands in it?

maiden mauve
#

correct

copper cradle
#

ok

hybrid ruin
#

Ah I see

maiden mauve
#

so I basically removed that all together

hybrid ruin
#

Yeah

#

You can DM my bot to just talk to it

#

I can reply

#

But no, I dislike the thought of using commands in a bot's DMs, like why

scarlet phoenix
#

I only have commands that rely on some info from a guild locked down. Anything that is guild/channel agnostic is all good. Then the permission check just assumes if you are in a dm you are ok to run anything

#

I get a lot of people doing random image lookups and stuff through them

maiden mauve
#

yeah, imo the only bot dm interaction is to prevent channel spam

hybrid ruin
#

Might be a little off-topic but does either of you own a server? If so, do you allow "bot spam" in the bots channel(s)?

maiden mauve
#

I run my bot in it's own channel because it gets very spammy

#

we enforce people not using it in chat channels

scarlet phoenix
#

I mean I have my bots support server (~500 users) I just setup perms in the testing channels and muted them

maiden mauve
#

If it ever gets bigger I'll probably allow a server owner to define a specific channel for it

#

so it ignores the rest

hybrid ruin
#

I enforce people to not use it in chat channels either, got 1 bot channel you may use whatever bot and spam whatever command, just don't use them in chat channels

maiden mauve
#

that's actually my next project I think

#

gonna make a model for serverids

#

each document being server globals

hybrid ruin
#

Hmm

#

Sounds interesting

maiden mauve
#

should be pretty simple

#

restrict ?admin to specific role/admin

#

find("serverid"), grab variables

scarlet phoenix
#

I just have a system in place to enable all commands, or different categories on a per channel basis.

maiden mauve
#

I think the "next level" of that is to actually build a website

#

like MEE6 for example

#

and give an admin interface

scarlet phoenix
#

Front end web dev... ewwww

maiden mauve
#

Yeah, not my expertise for sure

#

but it's very clean and professional

scarlet phoenix
#

It would be sick to have tho

maiden mauve
#

using chat based commands to set globals is a little odd

#

because you have to text back a "UI" of every setting

hybrid ruin
#

My bot responds to certain chat-based commands

#

But restricted to me and a few guilds, nothing here

#

It's pretty neat and doesn't really confuse the ones who use it

maiden mauve
#

Originally I wanted to give servers a "json" type object to set the variables

#

but then I realized thats not how discord bots work

#

ie a local config.json for every server

hybrid ruin
#

Did I miss something? Why would a json object per guild not work?

maiden mauve
#

oh it will, just they won't have the local file?

#

ie, open it in a text editor and save

#

that would lead back to a web interface again

hybrid ruin
#

Oh right right

maiden mauve
#

honestly though from what I see on js examples for front end html

#

it doesn't appear too complicated to write db interactions

dark dust
#

heyyyy, it's me again, could someone help me with timeout if the wait_for answer is wrong and a time out if no one sent anything after 60 seconds the while True breaks? (python)

maiden mauve
#

you could basically just load a model onto a html table and use textbox/buttons for updating

#

@dark dust you may need to provide a code block thats a bit of a run on sentence

slender thistle
#

You don't need a while True technically

#

since wait_for is already blocking

dark dust
#

while true is for loop

#

it's a quiz command

#

oooh its youuuuuu the nice mod

hybrid ruin
#

What comes closest to the having their own file is pretty much just

#

Building a web-based editor

#

But you might as well make a dashboard for that

#

Yeah forget what I said

#

Poor json users

maiden mauve
#

haha, step 1 is to have other servers use my bot regularly

#

im inventing my own project for no reason atm

slender thistle
#

answer wrong = msg = wait_for(etc); if msg.content != 'some_answer': some_stuff
timeout = try: wait_for(timeout=X); except asyncio.TimeoutError: no answer

#

One lines are ugly sometimes

hybrid ruin
#

@maiden mauve What kind of bot is it btw?

dark dust
#

@slender thistle ```Python
@quiz.command()
async def start(self,ctx):
await ctx.send('The quiz will start in 5 seconds, be ready!')
await asyncio.sleep(5)

    while True:
        QUIZQ, QUIZA = random.choice(QUIZP)

        await ctx.send(QUIZQ)

        def check(message):
            if message.author.id != message.author.id:
                return False # wasn't the author who responded
            if message.content.lower() != QUIZA:
                return False # author did not respond with a form of hello
            return True # yay!

        timeout = try: wait_for(timeout=60);   except asyncio.TimeoutError: no answer
        message = await self.bot.wait_for("message", check=check)

        if QUIZA == message.content.lower():
            await message.add_reaction(emoji="โญ")
            await ctx.send(f'<@{ctx.author.id}> encontrou a resposta **{QUIZA}**, prรณxima pergunta em 10 segundos!')
            await asyncio.sleep(10)```
#

I already have the message = wait_for

#

so I just need add the timeout?

slender thistle
#

Yeah, put wait_for under a try branch and then handle timeout error with an except

dark dust
#

Ive to have 2 time outs, one to use the while break point and one to come back and send another question

#

hate pasting on discrod..

maiden mauve
#

@hybrid ruin it's a command driven attack/heal/level up bot

#

playerlist is anyone who uses a command

slender thistle
#

Oh btw that ifin your check function is always going to be true

#

And all that could be fit into one line with an and

hybrid ruin
#

RPG-based? If so, hit me up with the name @maiden mauve

dark dust
#

how that timeout works? I was lost on docs

hybrid ruin
#

And perhaps move to DMs or another channel, not here mokou_dead_inside

slender thistle
dark dust
#

me??? okayyyy

slender thistle
#

Nah not you

#

@dark dust

try:
    msg = await bot.wait_for('message', check = some_check_function, timeout=60) # waits for a message that meets the conditions in "some_check_function" for a minute. If timeout, raises asyncio.TimeoutError
except asyncio.TimeoutError:
    # whoops, message that met conditions wasn't sent```
dark dust
#

did not workkk

#

I will try to figure it out! really thank you to helping me! I will be back with what I did when I find out, I hate taking time from people hahahaha โค

cerulean zinc
#

Anyone know how to make a shard manager in D.JS that allows for sharding across 2 or more machines?

quartz kindle
#

you'd probably have to manually assign shard IDs in the client options

scarlet phoenix
#

At that point I would also look into using something to orchestrate the multiple machines. k8s works really well

trail dagger
#

Can someone just give me a list of the most useless commands for a bot so i can remove it if i have?

grim aspen
#

starting with ping

#

reply pong

sick cloud
#

idiot question here, how do you import python files from other files?
ie. my project directory:

main.py
util/
..... generate.py
..... on_chunk_load.py```
how can i do things like import `generate.py` in `main.py` or import `on_chunk_load.py` in `generate.py`?
west spoke
#

import generate

#

tho, it has to be in the same directory

#

Eg:

nbapi.py
nekobot.py```
#

I would import those two using import nbapi, nekobot

sick cloud
#

i mean, can i do it if they're in different directories ?

west spoke
#

Not that I know of

#

Since you cant use strings

sick cloud
#

welp

quartz kindle
#
By default, you can't. When importing a file, Python only searches the current directory, the directory that the entry-point script is running from, and sys.path which includes locations such as the package installation directory (it's actually a little more complex than this, but this covers most cases).

However, you can add to the Python path at runtime:

# some_file.py
import sys
sys.path.insert(0, '/path/to/application/app/folder')

import file```
#

there are other ways too, depending on the python version and operating system

scarlet phoenix
sick cloud
#

@scarlet phoenix thanks!

scarlet phoenix
#

np hope it works

warm marsh
#

So I'm extremely poor and was wondering if there was any free solutions for 24/7 bot hosting. Glitch doesn't work and I've tried heroku but it's a little meh. It restarts daily.

hybrid ruin
#

Glitch and Heroku are afaik the only ones really providing that service for free

warm marsh
#

Yeah, Glitch is kinda glitch due to working for like 30 seconds then bot won't connect again.

hybrid ruin
#

However

dense igloo
#

Aws 1y max for free

quartz kindle
#

google is also 1 year free

#

so you can get 2 years if you switch once

hybrid ruin
dense igloo
#

Heroku only runs 400h for no registered, 500h for registered, and 1000h for linking account with paypal/smth. Which 400/500/1000h per month sometime makes bot offline (dyno)

warm marsh
#

So out of the 2, Google and AWS - Which is more recommended?

hybrid ruin
#

Try them both out and judge for yourself

dense igloo
hybrid ruin
#

1 year for free on both, doesn't get easier than that

#

In my personal opinion, go for AWS first and then move over to Google, just because I think Google is more reliable

quartz kindle
#

amazon has better machines, google has better network

#

amazon offers 1gb ram, while google is only 650mb ram

#

but google has better connectivity to the discord servers (depending on the server region)

warm marsh
#

Alright, I guess I'll try both. Thanks!

sick cloud
#

if you keep your memory usage low google's free hosting works great

warm marsh
#

Yeah, About that. I'm really struggling to connect from my local machine.

#

I'm fairly new to vps/cloud computing so i don't really know what I'm doing.

west spoke
#

ssh name@domain

warm marsh
#

Yeah and get some salt.

west spoke
warm marsh
#

ssh name@domain doesn't work from local.

west spoke
#

that's no--

#

Do you even know what ssh is

#

You put the name of your vps and the IP after

warm marsh
#

after a colon?

west spoke
#

That.... do you know how to use a vps

warm marsh
#

As I literally said, Not really.

west spoke
#

:I

warm marsh
#

๐Ÿ˜ฆ

tight heath
#

๐Ÿ˜”

pale marsh
#

@sick cloud google's free hosting? thonk

sick cloud
#

gcp free

#

iterate over them i guess, but depends on your lib

pale marsh
#

@sick cloud isn't that for a short period though then it costs?

sick cloud
#

1 year free

#

and @earnest phoenix yeah the best way for djs is to add them all to an array, for loop over it and ban(id)

tight heath
#

@earnest phoenix do you plan to steal my banlist

#

Lmao

#

Store them in a JSON

#

You can require that without much effort

earnest phoenix
#

who know how to make a webhook

tight heath
#

@earnest phoenix pls more specific

earnest phoenix
#

discord

tight heath
#

library?

earnest phoenix
#

nodejs

#

discord js i mean

tight heath
#

TextChannel#createWebhook()

#

It's async

earnest phoenix
#

so like

#

dragon

#

you know u said glitch isnt 24/7

#

it is now

#

i added more code

#

ok

tight heath
#

Glitch is just uh

#

Bad

earnest phoenix
#

glitch is not bad

#

its hosting 24/7

#

...

#

i could help

tight heath
#

My k8s cluster is 24/7 too

#

With georedundancy

#

It did not die with the route leak for example

#

I broke it

topaz fjord
#

@earnest phoenix check both smh

#

check for either admin or the actual perm

tight heath
#

maybe you're trying to ban someone

#

With a higher role

#

Throws the same error

#

Yes you can

topaz fjord
#

You can

tight heath
#

the api does not care about the IDs you give it

#

in d.js

#

GuildMemberStore#ban

#

For arbitrary ids

earnest phoenix
#

who can help with my warn command

tight heath
#

We ain't spoonfeeding sirman

earnest phoenix
#
  if(command === "warn") { 
   if(message.author.bot) return; 
   var user = message.mentions.users.first(); 
   var member = message.guild.member(user); 
   var reason = message.content.split(' ').slice(2).join(' ');
     let role = message.GuildMember.hasPermission('KICK_MEMBERS');
     if (!message.GuildMember.hasPermission('KICK_MEMBERS'))
       return message.channel.sendMessage("you can not use this command because you dont have perms");
     if (!user)
       return message.channel.sendMessage("Who Are You Going To Warn?");
     if (!reason) 
       return message.channel.sendMessage(`Why Do You Want to Warn ${user.username}`);
      user.sendMessage(`You Got Warned by **<@{message.author.id>** for **${reason}**. Sorry.`);
      message.channel.sendMessage(`**${user.username}** got warned by ** ${message.author.username}** for **${reason}**.`)
  }```
#

i just got a guildmemberleave

warm marsh
#

Alright, Thanks for all the help. I finally managed to get it to work. Probably very inefficiently.

sudden geyser
#

Venus what is the actual problem you're having (btw sendMessage is deprecated)

topaz fjord
#

@earnest phoenix rude

earnest phoenix
#

@sudden geyser the command wont work

#

like it say message.member not defined

sudden geyser
#

Message is probably not defined, make sure you define it

earnest phoenix
#

i have message

earnest phoenix
#

so um

#

my whois command works

#

but it gets a error

#

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

#
        let memberToFind = message.mentions.members.first(); //Checks for a mentioned user (@eSkuzi#0001)
 
        if (!memberToFind) { //If no member is mentioned, throw this error
            return message.channel.send('You must mention a member for this command'); //Send message and stop executing code
        }
 
        let embed = new Discord.RichEmbed()
              .setAuthor(memberToFind.user.tag, memberToFind.user.avatarURL) //This will show the users tag and avatar - there was no need to stringify that text :P
            .addField('Account Created', memberToFind.user.createdAt, true) //Shows when the user was registered
            .addField('Joined this Server', message.guild.members.find('id', memberToFind.id).joinedAt, true) //Shows when the user joined the guild
            .addField('User ID', memberToFind.id, true) //Shows the user ID
            .setColor(0xffffff) //Make the embed white
            .setFooter('Searched User') //Add a footer
            .setTimestamp() //Timestamp the footer
 
 
        message.channel.send(embed);
    console.log(`${message.author.tag} used whois command`);
    client.channels.get("598335234425094146").send(`${message.author.tag} Used the "whois" command`); 
      
  } ```
mental lance
#

Pass a function on the find.

maiden mauve
#

hm, is there anything "real-time" in a discord chat besides reactions and edits?

#

text that changes for everyone after a message has been posted

mossy vine
#

i dont think so

maiden mauve
#

I was thinking of doing a cooldown edit with setTimeout

maiden mauve
#
timedCheckmark: function(message, ms) {
    setTimeout( () => {
        message.edit(message.content + ' :ballot_box_with_check:');
    }, ms);
},
#

will that lag up discord if it's being called 50+ times per minute?

#

ie:
msg = channel.send (bla bla)
timedCheckmark(msg, 10000)

for every applicable message

earnest phoenix
#

Lang- discord.js

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

module.exports.run = async (client, message, args) => {   
  let embed = new Discord.RichEmbed()
    .setTitle("servers")
    .setColor(0xFF4500);
    
  
  let owners = process.env.OWNER.split(',');
  
  if (!owners.includes(message.author.id))  {
    embed
      .setTitle("Permission Denied")
      .setDescription("You do not have permission to use this command. ONLY OWNER CAN USE");
    
    return message.channel.send(embed);
  }
  
  message.channel.send(embed).then(m => {
  	embed
     	.setTitle("Servers List !")
  		.addField('Name', client.guilds.map(g => `${g.name} ID =${g.id} Mcount = ${g.members.size}` ))
      
      
      m.edit(embed);
  message.channel.send(embed);
  });
};
#

Command not working

#

My .env OWNER=ID

maiden mauve
#

at first glance assuming all the variables are correct

#

you would want to async the edit/send

mossy vine
#

@earnest phoenix "not working" is pretty vague, does it send anything, does it error, does it fail silently, etc.

earnest phoenix
#

Nothing happen

mossy vine
#

logging process.env.OWNER might explain whats going on

earnest phoenix
#

No error

#

You mean i Need to do what ?

mossy vine
#

console.log(process.env.OWNER) somewhere

earnest phoenix
#

Ok

#

Done

mossy vine
#

what does it log

earnest phoenix
#

Nothing

mossy vine
#

so the command doesnt even get executed WaitWhat

earnest phoenix
#

Yeah think so

#

My .env

#

@fallen vortex

late hill
#

The bottom part of that code doesn't make sense at all

#

Sending the embed > edit the first one > send the embed again*

earnest phoenix
#

Before adding it , it was same problem

#

Bot sending title

#

Not desc

sick heron
#

Hi

#

constantly writes this and is constantly multiplying cpu for typing.

How do I solve?

mossy vine
#

im pretty sure you just leaked your token

sick heron
#

what should I do.

#

@mossy vine

mossy vine
#

stop logging the http request

sick heron
#

@mossy vine
I stopped.

mossy vine
#

cool

#

no issues then

#

you should still reset your token tho

spare goblet
sinful lotus
#

console.log bloatts your cpu and ram

late hill
#

It's not sending a description because you're only setting the description if the command fails @earnest phoenix

.setDescription("You do not have permission to use this command. ONLY OWNER CAN USE");```
#

There's no other setDescription() in your code

maiden mauve
#

Any opinions on stacked setTimeouts? I'm considering implementing a feature to remind players of cooldowns

sick heron
#

@sinful lotus
Let me delete the "console.log" settings.

maiden mauve
#

as far as I know, it's just a scheduled function and 10000 setTimeouts shouldn't cause some nuclear meltdown

mossy vine
#

wdym by stacked timeouts

maiden mauve
#

a stack/queue

sinful lotus
#

promisifiied timeouts would be cleaner

earnest phoenix
#

Before it was working

maiden mauve
#

every bot command with a "cooldown timer" would notify the player when it's complete then delete the message a few seconds later

#

by cooldown timer I am referring to a set variable (Date.now + x)

sinful lotus
#

then clean it via interval?

maiden mauve
#

yes

sick heron
#

@mossy vine I've erased it, but the bot will close.

sinful lotus
#

but why you have a lottt of set timeout then?

sick heron
#

https

maiden mauve
#

this isn't exactly my idea but it goes something like this:

#
         var msg = await message.channel.send ( blah );
         commonfile.notify(msg, message, 6000);

         ]] required file:

     notify: function(msg, messageObj, ms) {
        var oldmsg = msg.content;

        var stepTwo = () => 
        {
            setTimeout( async () => {
                await msg.edit(`${oldmsg}`);
            }, 6000);
        }

        setTimeout( async () => {
            await msg.edit(`${msg.content}\n:ballot_box_with_check: <@${messageObj.author.id}>, READY!`);
            stepTwo();
        }, ms);
    }
sinful lotus
#

why not just use the promisifiied timeout

maiden mauve
#

well what I showed is editing the message on a timeout

#

then re-editing on a separate timeout

#

I was going to change that to send/delete

#

ie "player, attack function is now ready!" => delete 6 seconds later

sinful lotus
#
class Util {
      static wait(ms) {
        return new Promise((resolve, reject) => {
            if (!ms) reject('MS wait time not specified')
            setTimeout(() => resolve(), ms)
        })
    }
}

Util.wait(5000).then(() => {})
Util.wait(ms).then(() => {})
#

cleaner isnt it

#

by making it .then() instead of async await, it wont block the execution

maiden mauve
#

so, keeping all the scheduling inside the promise function

#

hmm

#

I'm still a novice with async execution

#

do you see my code as sluggish?

sinful lotus
#

async is just a wrapper to enable await

#

its not the async thatt other language provide

#

also async is a wrapper to native promiises

#

meaning once you turn a function to async

#

that function will become a promise

#

or will return a promise

#

if you choose tto return something but either ways iit will always return promiise

maiden mauve
#

I mean, in theory, forcing everything into a promise generates a line-by-line execution

sinful lotus
#

wrapping a code inside async wont really do anything if you have a blocking code iinside of iit

maiden mauve
#

in lieu of completely understanding this at the moment, would my code block eventually generate significant delays in processing?

sinful lotus
#

async function just does the ff

  • enable usage of await
  • turns that function to promiise and will return promise void if you didnt return anything
#

delays in processing in js can happen when you block the eventt loop

#

so as long as your code dont block anything

#

delays would be nano seconds

maiden mauve
#

tbh, I could probably dump the await/async all together in a setTimeout

#

it's going to happen whenever its scheduled anyhow

sinful lotus
#

very small amounts that you wont notice irrc

maiden mauve
#

a "notification" timeout is irrelevant to the logic code

sinful lotus
#

depending on your use case

#

having a promisified timeout will make your code cleaner and it will sttiill do the same thing you want

maiden mauve
#

Yeah, ill look into reformatting it for sure

#

but you don't see anything particularly horrible about calling 10000 setTimeouts of simple edits?

sinful lotus
#

edits is async

#

tthe rest part is

#

but if you do a lot of computation per edit

#

thats not probably good but

#

you said it your self

#

"simple edits"

maiden mauve
#

well thanks for input, ill compare some stuff tomorrow

#

๐Ÿ˜„

#

someday I'll completely grasp the promise system

sinful lotus
#

no problems, as long as you know that you are not doing intensive calculation per edit

#

tbh it shoudn't be a problem

#

for of loops can be deadly if you do that per edit as well

#

but that would also depend on how long the loop

maiden mauve
#

yeah, current edits are just content + short concatenation

#

I'm playing around with an effective way to notify people without bogging the chat

#

edit/re-edit vs send message / delete message

#

edits fail when there is too much spam

#

but more messages create spam

#

and nobody wants dms

#

๐Ÿ˜„

sick cloud
old geyser
#

so my bot is doing something weird.. just today its pick up the wrong author IDs.. Like they are correct.. but the last digit is one less then what it should be

earnest phoenix
#
let rolemention = message.mentions.roles.first()```
How do I get the bot to find the mentioned role in the server where the command is made?
tight heath
#

Rolemention literally is that role

twilit rapids
#

Yeah but it only works when the role can be mentioned, you can better search in guild.roles to also include roles that are not mentionable

earnest phoenix
#

So I'm doing how to get him to look for the mention rรดle ?

twilit rapids
#

Well if the role is mentioned, that code returns that role Object so you don't have to search

tight heath
#

If it's mentioned, you don't need to

#

Otherwise use RoleStore#find

earnest phoenix
#

Yes, but what if the role is above him?

twilit rapids
#

That doesn't matter

earnest phoenix
#

I want to make an autorole

#

And if the role is above him, he can't give the role

tight heath
#

Compare Role#position

#

If the bot's highest role is below that, error

earnest phoenix
#

I can use message.guild.roles.get(rolemention.id)
?

tight heath
#

GuildMember#highestRole

#

rolemention is the role

#

You don't need to get it

earnest phoenix
#

uh ok

#

I got it

#

Thank you

sinful lotus
#

wait why you are getting the role again

#

if rolemention is already the role

earnest phoenix
#

@sinful lotus if the role is on top of the bot

sinful lotus
#

same

#

nothing will change

earnest phoenix
#

@earnest phoenix get the role position in heirarchy and the bots position see if itsw higher

#

yeah

earnest phoenix
#

Max bot status change is 12 sec?

naive gull
sinful lotus
#

@earnest phoenix maximum of 5 times per minute but I would recommend half of that per minute

earnest phoenix
#

How much seconds per status?

#

12?

sinful lotus
#

60 divide by 4 then times it by 1000

stray garnet
#
  
  let guild = message.guild;
  let member = message;
  let membercount = bot.users.size;
  
  const embed = new Discord.RichEmbed()
  .setColor("RED")
  .setTitle("Asuka - Welcome")
  .setDiscription(`Hello ${member.user}, welcome to ${bot.guild.name}\n We are now ${bot.users.size} Users!`)
  .setThumbnail(member.user.avatarURL)
  
  member.guild.channels.find('name', 'welcome').send({ embed: embed })
  
  
});```

It don't sends anything into the `welcome` Channel

how to fix that?
sinful lotus
#

I said max it 5 times butt it would be better not to keep it at maximum

earnest phoenix
#

Is 20/25 second oke?

#

I dont want to API abuse

sinful lotus
#

much better

#

if you would ask me

earnest phoenix
#

Ok ty

#

Don't want my bot removed by fast status changing

stray garnet
#

@earnest phoenix lowest is 10 sec i think

slender thistle
#

12

sinful lotus
#

yes but please do not make it as close to limit

naive gull
#

Just do 5 mins more than enough!!

stray garnet
#

Lol

#

anyone can help me at my code?

topaz fjord
#

ask your question and someone will help

earnest phoenix
#

@stray garnet really simple bud

stray garnet
#

but? @earnest phoenix

earnest phoenix
#

shiz

#

i was going to help you with this but my one is to advanced

#

idek how to use it

#

i was talking to @stray garnet

stray garnet
#

@earnest phoenix oh...

earnest phoenix
#

ill tell y why

stray garnet
#
  
  let guild = message.guild;
  let member = message;
  let membercount = bot.users.size;
  
  const embed = new Discord.RichEmbed()
  .setColor("RED")
  .setTitle("Asuka - Welcome")
  .setDiscription(`Hello ${member.user}, welcome to ${bot.guild.name}\n We are now ${bot.users.size} Users!`)
  .setThumbnail(member.user.avatarURL)
  
  member.guild.channels.find('name', 'welcome').send({ embed: embed })
  
  
});```


It don't sends anything into the welcome Channel.
earnest phoenix
#

@stray garnet

stray garnet
#

@earnest phoenix help me

tight heath
#

@stray garnet @stray garnet let { member } = message;

#

yw

#

though your first line could be truncated into that too

#

const { guild, member } = message

#

any why is membersize the amount of all users in the bot

#

shouldn't it be guild.memberCount

#

or guild.members.size (the same)

stray garnet
#

still dont works.... :\

#

no

#

just no response

#

sad

#

no errors

#

weird shit

#

Well anyone knwos how to to an fakejoin command?

opaque eagle
#

Whatttt can you explain what that exactly does

stray garnet
#

that should Welcome a User that joins the guild

tight heath
#

@stray garnet output of require('discord.js').version ?

slim heart
#

.memberCount shows full member count u cached aswell

#

.members are all cached

tight heath
#

memberCount tries to accurately give a membercount

#

even without cache

slim heart
#

.memberCount is supplies by the gateway

#

No itโ€™s a total amount 100% usuallyโ„ข

tight heath
#

nah

#

it lags behind a bit

#

:p

slim heart
#

Yea discord counts it up

#

Well yes because .memberCount isnโ€™t in the updated guild object lib does it itself

opaque eagle
#

Well that wonโ€™t be a command, itโ€™ll be with the guildMemberAdd event @stray garnet

slim heart
#

But it takes a decent

tight heath
#

@stray garnet found your mistake

#

.setDescription

#

you wrote Discription

stray garnet
#

Oh fck lol

opaque eagle
#

Lol

tight heath
#

and to fake a join

#

client.emit('guildMemberAdd', message)

opaque eagle
#

Weird that guildMemberAdd gives a message

tight heath
#

it doesn't

#

lmao

stray garnet
#

its hard to type on a mobile

slim heart
#

What guildMemberAdd gives a member

opaque eagle
#

Yeah thatโ€™s what I thought

tight heath
#

it should do member

#

I'll refactor your code

slim heart
#

So then do .emit(..., message.member)?

tight heath
#

it's giving me a headache

#
bot.on("guildMemberAdd", member => {
  
  const embed = new Discord.RichEmbed()
      .setColor("RED")
      .setTitle("Asuka - Welcome")
      .setDescription(`Hello ${member.user}, welcome to ${member.guild.name}\n We are now ${member.guild.memberCount} Users!`)
      .setThumbnail(member.user.displayAvatarURL);
  
  member.guild.channels.find(c => c.name === "welcome").send({ embed });
  
});
opaque eagle
#

Eh Iโ€™d let the user pick the channel name and store the ID in a database

tight heath
#

shush

slim heart
#

Not the topic

tight heath
#

but I would use User#displayAvatarURL() over User#avatarURL()

#

because avatarURL fails if they have a default avatar

opaque eagle
#

Is it a function in stable now?

#

I thought it was a function only in master

tight heath
#

oh was it

#

I'm used to master

opaque eagle
#

Same

tight heath
#

might be because it's superior

opaque eagle
#

Itโ€™s a property

tight heath
#

I changed it lmao

opaque eagle
#

Oh ok

slim heart
#

All the icon and avatars are methods now

stray garnet
#

@tight heath still don't Works

tight heath
#

in master

#

mister 44 is using stable

slim heart
#

Yeah now hehe

tight heath
#

stable is still now

#

it's actively updated

opaque eagle
#

Is there a channel named welcome

slim heart
#

Letโ€™s be real

#

Ok anyways

#

Wait I coulda told u stable had displayAvatarURL lmao

tight heath
#

oh I know it has

#

but I didn't know it was a getter

warm marsh
#

iconURL was removed in discord.js@12.0.0

tight heath
#

no?

earnest phoenix
#
bot.on('guildMemberAdd', member => { 
	let server = member.guild.id;
	
	if(!db.get("blacklist_mode").find({ serveur: server }).value()) {
		return 
	} else {
		let iduser = member.id
		if(!db.get("blacklist_users").find({ user_id: iduser }).value()) {
			return 
		} else {
			const get_motif = db.get("blacklist_users").find({ user_id: iduser }).value()
       	 let motif_msg = ''
       	 if (!get_motif) motif_msg = "โŒ Aucune raison dรฉfinie."
      	  else {
            let motif_message = Object.values(get_motif)
            motif_msg = motif_message[1]
        }
        if(!member.guild.me.hasPermission("BAN_MEMBERS")) return member.guild.owner.send(`**โš  L'utilisateur <@${iduser}> vient de rejoindre votre serveur ${member.guild.name} mais il se trouve actuellement dans ma liste noire pour la raison suivante : ${motif_msg}**`).catch(err => {
        	if(err) {
        		return 
       		 } 
      	  }) 
        member.ban()
        member.send(`**โš  Vous avez รฉtรฉ banni du serveur ${member.guild.name} car vous รชtes dans ma liste noire pour la raison suivante : ${motif_msg}**`).catch(err => {
        	if(err){
        		return
       	     } 
      	  })
        member.owner.send(`**โš  Un utilisateur malveillant vient de se faire ban du serveur ${member.guild.name} car il se trouve dans ma liste noire pour la raison suivante : ${motif_msg}\nIdentifiant de l'utilisateur : ${iduser}**`).catch(err => {
        	if(err) {
        	   return 
       	    } 
      	  })
		} 
	} 
});```

Once I put the catch (err etc the bot react not when a malicious user joins
tight heath
#

it has not

#

and I see no reason why it should

warm marsh
#

Ok.

tight heath
#

@earnest phoenix last function

#

member.owner.send => member.guild.owner.send

earnest phoenix
#

ye1h

#

thx

tight heath
#

try debugging yourself first though

#

before asking to get spoonfed mmwee

earnest phoenix
#

Is connecting to MongoDB outside or inside of a message function better on discord.js.

tight heath
#

outside

#

you should do it where it's only executed once

#

and access that connection in the message function

earnest phoenix
#

so like put the events inside

tight heath
#

instead of reconnecting every time

warm marsh
#
Embed.setThumbnail(message.guild.iconURL({ format: 'png', size: 1024 }));
tight heath
#

yw

#

npm i && npm run start

#

oh wait ur not cool

#

yes

#

for basic features it just needs a DISCORD_TOKEN

#

yes

#

I think I'll add an example.env

earnest phoenix
#

Client is a MongoClient and client2 is a Discord client.

client.connect(err => {
client2.on(โ€œmessageโ€, message => {
});
client.close();
});
``` Will this work?
tight heath
#

once I'm done actually writing the bot, I'll make it selfhostable

#

yes but it hurts

#

why don't you just name the mongoclient mongo or db

#

client2 is a very unreadable variable name

broken shale
#

is anyone here proficient with MongoDB

earnest phoenix
#

What is your question?

broken shale
#

Well I'm hosting my bot now but can't actually connect to the DB (robo3t)

valid frigate
#

mongo has its own clients for every language

earnest phoenix
#

Who knows and uses lowdb?

#

mentions to me if the answer is positive

topaz fjord
#

json db MegaThonk sounds like a bad idea

sage bobcat
#

One message removed from a suspended account.

tight heath
#

idk man

sage bobcat
#

One message removed from a suspended account.

maiden mauve
#

@old geyser being read as a string or integer?

jaunty stump
#

I need some help with my music bot I am working on.

It can come online and work but when I type the command to play music..well I just get this (Picture) after it joins my Vc does what it does in my console log. Then it leaves the Vc with me after saying "Undefined"

Note: I am still kinda new to coding.

wide ruin
#

how can i use AHK to make my screen loop?

#

the x is correct

#

according to that

#

so to start off

#

lets say any y less than -393 should move it back to there

#
#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, x, y, id, control
return

escape::ExitApp

IfLess, y, -393:
{
    MouseMove, x, -393
}```
#

that doesnt work

warm marsh
#

@jaunty stump Did you manage to get it fixed?

jaunty stump
#

No

warm marsh
#

Ok, send code.

#

pastebin or something

jaunty stump
#

Ok. 1 moment

pastel sky
#

window.onscroll works on discordbots page?

#

@earnest phoenix you need configure DBL in your code

tidal relic
#

Go to the link he sent, it's pretty self explanatory

pastel sky
#

^

tidal relic
#

Seems like you're calling "myFunction" and not "myScroll"

#

Idk though

pastel sky
#

yes, but apparently window.onscroll only work on preview mode

tidal relic
#

Oh, I'm not sure then, sorry

pastel sky
#

np ty

languid dragon
#

because im pretty sure you cant use JavaScript as a bot dev

#

@bitter sundial CC

bitter sundial
#

javascript in long description is only for certified bots

pastel sky
#

oh, ty guys

floral bloom
#
{
  "guild": {
    "prefix": ".",
    "cases": {
      1: {
        "user": "123456789",
        "mod": "987654321",
        "reason": "Test",
        "date": "Not givin"
      }
    }
  },
  
  "user": {
    "987654321": {
      "permLvl": 100,
      "msgType": "embed",
      "cases": {
        
      }
    },
    "1234567890": {
      "permLvl": 100,
      "msgType": "text",
      "cases": {
        1: {
          "mod": "370381633305575426",
          "reason": "Test",
          "date": "Not given"
        }
      }
    }
  }
}

Error:

- SyntaxError: Unexpected number in JSON at position 55

Where's the error??

#

Ping with response, please.

tidal relic
#

Thonk I'd say it's the 1: but I don't know where position 55 actually is

#

So, can't help

floral bloom
#

I made it "1" instead, but it didn't help

#

Hmm

tidal relic
#

Sorry man

floral bloom
#

Odd...

tidal relic
#

When I put "1" for both times it appeared, it's valid for me @floral bloom

pastel sky
#

"1" is valid for me too

#

@floral bloom for cases, you can use array, i think is better for use numbers

snow urchin
#

Am I able to get help for the discord-rpc thing here?

#

or is it just bots I can get help with

wild moth
#

Hi

earnest phoenix
#

@snow urchin how do you even have access to rpc ๐Ÿค”

snow urchin
#

huh

#

Look at me status now, got it done

earnest phoenix
#

rpc has been in closed beta for years now

#

that's rich presence

#

not rpc

snow urchin
#

i meant rich presence ok

real helm
#

Hello

#

How I do logs?

earnest phoenix
#

which kind of logs

real helm
#

edited message

#

deleted message

earnest phoenix
#

which library

real helm
#

discord.js

#

I have the set channel , but I don't have the logs xD

real helm
#

thanks ๐Ÿ˜ƒ

#
client.on("messageUpdate", async (oldMessage, newMessage) => {
let log = await logs.obtener(oldMessage.guild.id).catch((err) => (err.message)); 
  
const embed = new Discord.RichEmbed()
.setFooter(`Pedido por ${oldMessage.author.username}`, oldMessage.author.avatarURL)
.setColor("GREEN")
.setTitle("Mensaje editado", client.user.avatarURL)
.setDescription(`**Autor:** ${oldMessage.author}\n**Canal:**<#${oldMessage.channel.id}>`)
.addField("Texto incial:", oldMessage.content)
.addField("Texto actual:", newMessage.content)

  client.channels.get(logs).send(embed)
#

Why this didn't work

#

I do it

mossy vine
#

how do you define logs

grim aspen
#

looks like let log

real helm
#

logs is a db

#

the error is in the embed

mossy vine
#

the .obtener callback is not how you do arrow functions lol

real helm
#

RichEmbed field values may not be empty

#

This is the error ๐Ÿ˜ฆ

topaz fjord
#

does it give a line

earnest phoenix
#

client.user.avatarURL, oldMessage.content, newMessage.content can all be empty

#

inspect which

broken shale
#

Odd question but does anyone use linux/ubuntu

twilit rapids
#

Yes

broken shale
#

To change the root password

#

is it sudo -i then passwd

twilit rapids
#

You can just run sudo passwd root

warm marsh
#

Or just sudo passwd

twilit rapids
#

Or if you are on root sudo passwd

broken shale
#

im already logged on root

#

What if theres a user I added on root

#

But now I want to completely remove him

twilit rapids
#

google exists

broken shale
#

But.......
Me 5hrs ago: Almost destroyed it

twilit rapids
#

What version of Ubuntu are you using

broken shale
#

18.04

twilit rapids
#

Do you want to remove the files from the users repository as well?

broken shale
#

yes

twilit rapids
#

sudo deluser --remove-home username

#

where username is the users name

broken shale
#

Thanks, I appreciate it

#

But if I changed the root password, but he's still there will be be able to even login

twilit rapids
#

Literally 1 minute of googling >.>

broken shale
#

Sorry for all the questions I actually never used linux

twilit rapids
#

If you change the root password, only the way you login as root changes, so if he is still there and he still has access to his password he can still access his account and repository on your VPS

wise sail
#

Guessing how to do log mode to ur bot?

twilit rapids
#

What do you mean with log mode

broken shale
#

Thanks

#

Depends what language

twilit rapids
#

๐Ÿ‘

broken shale
#

I think he means to console

wise sail
#

I mean about
The bot logging a deleted/edited message

broken shale
#

Depends on language

twilit rapids
#

What language are you using?

broken shale
#

Also, I removed the user but still brings this up

twilit rapids
#

What is the username of the user you are trying to remove

broken shale
#

aiir

twilit rapids
#

But, are the files they created gone

broken shale
#

where are all the users usually located though

#

I might manually delete them

#

Ig you're right

twilit rapids
#

There sould be a /home directory

warm marsh
#

Did they remove <Message>.channel.fetchMessages() in discord.js@12.0.0-dev?

#

Or did they change it, Because I get fetchMessages isn't a function

slim heart
#

its .channel.messages.fetch() @warm marsh

warm marsh
#

Alright

#

Thanks!

dark dust
#

hey ya

weary zodiac
#

hi what do u need help with

#

@dark dust

tidal relic
#

I think he's just singing the song

dark dust
#

@weary zodiac I will paste, wait a sec

#

@tidal relic no hahahahahaahahha

#
    @quiz.command()
    async def start(self,ctx):
        await ctx.send('The quiz will start in 5 seconds, be ready!')
        await asyncio.sleep(5)

        while True:
            QUIZQ, QUIZA = random.choice(QUIZP)
            await ctx.send(QUIZQ)


            def check(message):
                if message.author.id != message.author.id:
                    return False # wasn't the author who responded
                if message.content.lower() != QUIZA:
                    return False # author did not respond with a form of hello
                return True # yay!
            try:
                message = await self.bot.wait_for("message", check=check, timeout=60)
            except asyncio.TimeoutError:
                await ctx.send('Ninguem acertou, nova pergunta em 10 segundos')
                await asyncio.sleep(10)
                continue



            if QUIZA == message.content.lower():
                await message.add_reaction(emoji="โญ")
                await ctx.send(f'<@{message.author.id}> encontrou a resposta **{QUIZA}**, prรณxima pergunta em 10 segundos!')
                await asyncio.sleep(10)```I'm struggling with that, I'm beginner at python and coding at all, I'm on it for like 15 days. I've been learning and doing stuff since. 
I'm on that quiz command and using while loop and wait_for. I need a timeout for guessing (that I already have) and a timeout for **idling**, if no answers at all in 60 seconds reaches the break point.

I read the docs and I did not get it working on my own, I would like if someone could show me how and I will learn from it! I already have a lot of wrong attempts to that.

So, basically what I need on that thing is a second time out, a guy told me to add another coroutine with a new timeout for idling.
steady canopy
#

@dark dust, I might be able to help you.

dark dust
#

@steady canopy It would be lovely

weary zodiac
#

so what is exactly the error your getting

dark dust
#

furuhashi helped me with what I have now

#

thhe nice mod

steady canopy
#

Ahhh, alrighty.

dark dust
#

I'm not getting any error

steady canopy
#

So you got a command for the Idling portion?

#

or you still need that?

dark dust
#

I sill need that

steady canopy
#

okay

#

give me a moment

dark dust
#

I only have the timeout for no correct answers

#

60 seconds to guessing

steady canopy
#

So if no one responds in 60 seconds, what would you like to do?

dark dust
#

I wanna reach the break point

#

for the while loop

steady canopy
#

Ah

#

so 60 seconds no response, break.

#

okay

dark dust
#

so it stop looping

weary zodiac
#

do u have it in a class

dark dust
#

(and another thing that I will try to do next is: if the command still running, you cannot run that in the same channel) so the person gets a message like (there's a game happening right now)

#

I have the quiz command inside a command group

weary zodiac
#

ok

dark dust
#

in a cog

weary zodiac
#

ok

steady canopy
#

I mean you could do something along the lines of responseReceived = False and a counter = 1 before your While loop. I see you have an asyncio.sleep(10) so every time that fires, you could check to see if a response was given. If no response was given, increment counter by one. If counter gets to 6, break. If a response is received, set responseReceived = True

#

Not currently at a point to think it out properly

dark dust
#

@steady canopy the asyncio.sleep(10) is only a pause time for the game, to not give another question right away when someone get the correct answer

steady canopy
#

I see

#

Alrighty, one moment

violet oasis
#
  • p JASON RANTI FULL ALBUM
west spoke
violet oasis
#

Ok

dark dust
#

@steady canopy sorry for poking ya, do you still here?

steady canopy
#

Yeah Iโ€™m here. Just getting to a point at work where I can step away and code it out.

#

If you add me I can work with you on it in a couple hours via PM

bitter linden
#

Can anyone help me with the dependencies

dark dust
#

SURE THING!

#

โญ

west spoke
#

Uh

#

where I submit my botum

#

That's not starboard material

dark dust
#

are you starphobic?

west spoke
slender thistle
#

#oooooooff-topic ๐Ÿ‘€

wise sail
#

Someone know how to put welcome/goodbye code so my bot can send a welcome/goodbye message when someone join/leave?

earnest phoenix
#

write it

#

if you're asking how, we need to know which library you're using

dark dust
#

@wise sail on_member_join

#

in python

#

and write the code that you want

earnest phoenix
#

How can i get members from role.members

dark dust
#

what's your language?

earnest phoenix
#

node.js

dark dust
#

dunno

earnest phoenix
#

i tried with filter but it result "undefined"

#

I want to get the users id's

#
dunno```
if you cant contribute, dont
#

role.members already returns the members

#

some might be uncached, hence why they're undefined

#

Yeah, but how i can get the id's

#

that's all i want

tidal relic
#

The ID's of all the members with that role?

earnest phoenix
#

you can use keyArray() on the collection

#

since it's a collection of snowflakes as a key and guild members as value

wise sail
#

If u ask im using glitch.com discord.js ytdl core etc

wise sail
#

Thank u

dark dust
#

@earnest phoenix I asked which language he was using! how would I know If I can contribuite if he did not say anything!

earnest phoenix
#

saying "dunno" or something other than a helpful advice is not useful and clutters the chat, so does this, have an argument in #memes-and-media

scenic vapor
#

Anyone know of any guides setting up discord oauth with cookies for web development? ๐Ÿ‘€

#

or cookies with oauth in general

#

nodejs

valid frigate
#

idk anything about discord oauth but you could store the access token in localStorage

scenic vapor
#

yeah but I'm pretty sure saving the access token on localStorage is unsafe

valid frigate
#

i mean

scenic vapor
#

maybe I'm wrong, not fully sure

valid frigate
#

the person who authenticated it

#

it has their data

#

they wouldnt share their access token unless they know how to access localStorage or want people using their data

scenic vapor
#

yes but couldn't they themselves manipulate it?

valid frigate
#

not sure, but its safe to say yes until you find the answer

scenic vapor
#

Fair enough, thank you

#

I'll try that ๐Ÿ˜ƒ

valid frigate
#

dw

sick cloud
#

anybody got suggestions on doing a sticky footer?

lunar kettle
#

hello I have a little problem with my bot, if for example a written bot help my bot will respond to the bot by the help command. Can you help me

( I do not know if it's clear )

earnest phoenix
#

check if the message author is a bot

lunar kettle
#

Oh yes I did not think thank you !