#development

1 messages Β· Page 609 of 1

west raptor
#

hmm

scarlet phoenix
#

If you cant find it just reboot, it will ensure all the processes are closed.

#

By it I mean the other process running your bot logic

winged river
#

I need some help.
My non-accepted bot is offline and its no longer online after restarting the bot and changing token and replaced it. Still offline, what to do.

lament meteor
#

does it log that it got online or not the code

winged river
#

It says that the ping recived to make it online 24/7 is recived.

lament meteor
#

no no no the bot itself

winged river
#

My Bot has loaded string to logs doesn't appear no more.

lament meteor
#

hmm show code

#

or main file

winged river
#

k.

lament meteor
#

where do u host?

winged river
#

imagine being luca

#

check dms

#

i gtg
just dm me the FILE: and what to change and ill do it tonight

south sonnet
#

Feel free to ping me with a response LoveU

mossy vine
#

@south sonnet its only for certified bots

south sonnet
#

Darn, any more info about that somewhere?

mossy vine
south sonnet
#

Thanks man, appreciate it.

#

One day... soon...

pallid zinc
#

Can you suggest me a cheap VPS

prime cliff
#

Check pins πŸ“Œ

pallid zinc
#

Need vps which is all over the world

#

Like I am from india most of the vps do not suport here.

mossy vine
#

???

#

the fuck is that supposed to mean

prime cliff
ruby dust
#

pretty sure OVH is all over the world

amber fractal
#

Confusion = max

prime cliff
#

Confusion lvl 101

grim aspen
#

@bright spear i was probably asleep by the time i was pinged, i don't know, probably just for extra measures, if you're on glitch, you do have a link to let other people see, if someone accesses that link and you don't have in an .env, they could probably see it right there

quiet topaz
#

why my bot is outputing twice?

buoyant stump
#

Hello, I am making a bot with JS where some letter are replaced but sentences between * or __ are exclude, but I can't find how to exclude the words

quiet topaz
#

wait

mossy vine
#

most likely because its running twice

quiet topaz
#

no, thats not, i run it only per glitch, not per my pc or so

mossy vine
#

2 message listeners?

quiet topaz
#

i dont think

#

i am an beginner so yeah

grim aspen
#

if you're running it on two programs

#

it's two instances

quiet topaz
#

wait, i stop the bot

#

and then i wait

grim aspen
#

just run one program

quiet topaz
#

yes

#

yes, it is running twice, but i dont now why?

grim aspen
#

because you're running two programs

#

you forced another instance to run, overlapping the first instance

quiet topaz
#

but where?

mossy vine
#

how the hell are we supposed to know that

grim aspen
#

i've done it before

quiet topaz
#

how i can know it?

#

ah, i chrashed it with my chrash cmd

#

i knew, it is a good idea to have a crash cmd

buoyant stump
#

I'm also trying to exclude uppercase letter first and then translate them excludin lowercase letters

earnest phoenix
pallid zinc
#

My avatar is not working

strange trout
#

Python is ugly

pallid zinc
#

if (message.content === `${prefix}avatar`) { message.reply(message.author.displayAvatarURL()); } });

#

Not work

earnest phoenix
#

Python is better than JS

mossy vine
#

in javascript how do i get a Map object to store an object and not return '[object Object]'

late hill
#

@pallid zinc displayAvatarURL is not a function

mossy vine
#

i found a workaround with JSON.stringify and JSON.parse so it sends and gets the object as a json string and parses it, but is there any other way?

slender thistle
#

@earnest phoenix print(e) on Exception

#

Please

#

Why do you assign it to a variable and never use it

earnest phoenix
#

Where?

slender thistle
#

I can see your load command delete ctx.message but you are not returning from that point and still trying to delete ctx.message again

#

Anywhere you load or unload an extension

earnest phoenix
#

So just remove the code ctx.message.delete()

slender thistle
#

Do you want the command invocation message to be deleted all the time?

earnest phoenix
#

I just need it to load my extensions, i was on the Python community hub and that is what they told me to put

slender thistle
#

I advice put return before that ctx.message.delete under your if chain

earnest phoenix
slender thistle
#

Yep

#

And that pass is pointless

earnest phoenix
#

Still doesn't load the Extensions..

#

@pallid zinc delete the ()

#

On displayAvatarURL

slender thistle
#

print error when loading outside of a command

#

See what happens

earnest phoenix
slender thistle
#

str(error)

#

I suggest reading more about python formatting, especially on 3.6+ versions

#

Your life will be easier if you use f-strings, honestly

earnest phoenix
#

How to make cooldown on commands :c

slender thistle
#

What lib

earnest phoenix
#

js

#

@pallid zinc if(message.content.startsWith(prefix + 'avatar' ) { message.reply(message.author.displayAvatarURL) } Use handler is better

buoyant stump
#

Is patient

slender thistle
#

Welp, I'm of no help in js

buoyant stump
#

I can see you're better with Python

slender thistle
#

Yep

buoyant stump
#

I'm just waiting ahah

earnest phoenix
#

@earnest phoenix global cooldown or per command?

#

per

#

If its per command you need to export cooldown on every command (with handler)

#

wht

#

?

#

ok

earnest phoenix
#

I'm losing my marbles, all i need is for my extensions to load but i can't work out why they won't

slender thistle
#

What errors are you currently getting?

wheat orbit
#

does anyone know the code for making the bot listen when you @ it

earnest phoenix
#

I think i found it

slender thistle
#

@wheat orbit depends on your library

wheat orbit
#

oof

#

at the moment it only listens to the prefix

#

which is .

slender thistle
#

Honestly, a bot mention is literally just <@bot_id> or <@!bot_id> if it has a nickname

late hill
#

@!

slender thistle
#

Well fuck, my bad

late hill
#

It's ok I had to check

buoyant stump
#

Okay so I managed for uppercases and lower cases now I'm trying to find out how to exclude sentences between * and __

earnest phoenix
slender thistle
#

I can't help without any traceback, and you are not outputting any

earnest phoenix
#
@bot.command(pass_context = True)
async def load(ctx):
    user_roles = [r.name.lower() for r in ctx.message.author.roles]
    if "bot developer" not in user_roles:
        await ctx.send("You do not have permission to do that!")
        return ctx.message.delete()
    await ctx.message.delete()
    for extension in extensions:
        try:
            bot.load_extension("\cogs"+extensions)
        except Exception as error:
            await ctx.send(extension + "could not be loaded...\n" +error)
            print(extension + " could not be loaded...")
            print(error)

@bot.command(pass_context = True)
async def unload(ctx):
    user_roles = [r.name.lower() for r in ctx.message.author.roles]
    if "bot developer" not in user_roles:
        await ctx.send("You do not have permission to do that!")
        return ctx.message.delete()
    await ctx.message.delete()
    for extension in extensions:
        try:
            bot.unload_extension("\cogs"+extensions)
        except Exception as error:
            print(extension + " could not be unloaded...")
            print(error)

for extension in extensions:
    try:
        bot.load_extension("\cogs"+extensions)
    except Exception as error:
        print(extension + " could not be loaded...")```
slender thistle
#

The one on the very bottom

inner jewel
#

don't use role names for permission checks

earnest phoenix
#

That is not the issue

#

That all works

inner jewel
#

the issue isn't whether or not it works, the issue is anyone being able to run the commands

earnest phoenix
#

It just doesn't load the external files Extensions

#

The command can run it just doesn't load at start in which it should

#

And if the bot won't run it at start it throws a error when using the command

#
Ignoring exception in command load:
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\extensions\main.py", line 56, in load
    bot.load_extension("\cogs"+extensions)
TypeError: can only concatenate str (not "list") to str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 63, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Administrator\Desktop\extensions\main.py", line 58, in load
    await ctx.send(extension + "could not be loaded...\n" +error)
TypeError: can only concatenate str (not "TypeError") to str

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

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\bot.py", line 860, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 698, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 72, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can only concatenate str (not "TypeError") to str```
inner jewel
#

for extension in extensions:
bot.load_extension("\cogs"+extensions)

earnest phoenix
#

same error 😭

#

Is there a better way to load extensions ?

slender thistle
#

str() whatever that is not a string

#

Or, even better, use f-strings

opaque eagle
#

How can I get the innerHTML of the h1 using jQuery/cheerio?html <div id="info"> <h1>Hello</h1> </div>

vague coral
#

Is there a list of Discord bot best practices you would recommend?

opaque eagle
vague coral
#

@opaque eagle Just what I was after. Cheers!

opaque eagle
#

Np

earnest phoenix
#

@slender thistle Could you map out the Data for me, as I am struggling with this.

Sorry for ping

slender thistle
#

Literally +str(error) instead of error and there, you will get an actual error

earnest phoenix
#

Gives me the same error as before

slender thistle
#

Send your code

earnest phoenix
#

@bot.command(pass_context = True)
async def load(ctx):
    user_roles = [r.name.lower() for r in ctx.message.author.roles]
    if "bot developer" not in user_roles:
        await ctx.send("You do not have permission to do that!")
        return ctx.message.delete()
    await ctx.message.delete()
    for extension in extensions:
        try:
            bot.load_extension("cogs"+extensions)
        except Exception as error:
            await ctx.send(extension + "could not be loaded...\n" +error)
            print(extension + " could not be loaded...")
            print +str(error)

@bot.command(pass_context = True)
async def unload(ctx):
    user_roles = [r.name.lower() for r in ctx.message.author.roles]
    if "bot developer" not in user_roles:
        await ctx.send("You do not have permission to do that!")
        return ctx.message.delete()
    await ctx.message.delete()
    for extension in extensions:
        try:
            bot.unload_extension("cogs"+extensions)
        except Exception as error:
            print(extension + " could not be unloaded...")
            print +str(error)

for extension in extensions:
    try:
        bot.load_extension("\cogs"+extensions)
    except Exception as error:
        print(extension + " could not be loaded...")```
slender thistle
#

print +str(error)

#

I have a question for you

#

How much do you know Python?

earnest phoenix
#

I know a fair bit, but extensions is all new to me

slender thistle
#

This is basic Python

#

What you did isn't related to extensions

#

When I mentioned str(error), I meant to put it in your await ctx.send etc but not prints

earnest phoenix
#

I'll leave it for another day

topaz sphinx
#

i've seen some successfully change the website background on discordbots bot page, how is this done?

earnest phoenix
#

can anyone tell me what do i need to use to Enable/Disable a command (Discordjs)

#

since i want to add chat filter, but i need a way for the owners/admins of the guilds to enable/disable it

topaz sphinx
#

/* */ forsenE

#

alternatively make a .json filke

#

file

#

and call it smth smth disabledcommands

#

with like

#

{ "DiscordServerID" :
{ "bannedcommand1", "bannedcommand2", "bannedcommandN" },
"DiscordServerID2" : { "bannedcommand1", "bannedcommand2", "bannedcommandN" } }

#

then u can read the json files

#

and check if there's a matching discordserver in that list

#

and if it contains the bannedcommand

#

its as simple as that

earnest phoenix
#

thanks i will try it

topaz sphinx
#

no probs ^^

#

oh also encapsule the bannedcommands in []

#

cause {} will give errors (it need key values to use that)

knotty steeple
#

@topaz sphinx use css

#

on the website

#

well bot page

topaz sphinx
#

can i just instantly

#

shove in css

mossy vine
#

yes

topaz sphinx
#

and it will change the appearance

knotty steeple
#

just:

<style>
some css
</style>```
#

in the desc

topaz sphinx
#

alrighty

#

thanks for the info

knotty steeple
#

np

mossy vine
#

why am i getting cs.set() is not a function when it obviously is

#
class cs {
    constructor(host, auth) {
        this.auth = auth
        this.host = host
    }

    async set(key, value) {
        const a = await w(`${this.host}/${key}`, { method: 'POST' })
        .header({ 'content': value })
        .header({ 'Authorization': this.auth })
        .send();
    
        return a.parse()
    }
}

module.exports.cs = cs```
#

i create the object and use

#
cs.set('asd', JSON.stringify({a: 1, b:1}))```
#

and thats when it throws the issue

knotty steeple
#

happens to me when i do exactly that

#

so i put the function in constructor() {}

mossy vine
#

oh

#

let me try that

#

yeah no

#

doesnt work

#

just a whole bunch of syntax errors

knotty steeple
#

did u just copy it

mossy vine
#

yes

knotty steeple
#

no not like that

mossy vine
#

oh

#

then how

knotty steeple
#
this.thing = function() {
// e
}```
mossy vine
#

oh

#

same error tho

knotty steeple
#

then idk

scarlet phoenix
#

You are referencing that function as though it is static, but it is not static

#

I am not a javascript guy by any stretch of the imagination, but thats what it looks like at first glance.

#

@mossy vine

mossy vine
#

Oh

#

Uh

#

So how do i fix it?

scarlet phoenix
#

You need to make an instance of that class.

mossy vine
#

i did

#

its just not included in the code i posted

scarlet phoenix
#

named the same as the class?

#

if the variable is named the same as the class, it could think that you are trying to call the method directly from the class statically

mossy vine
#

oh

#

oh wow im stupid

fair minnow
#

Is there a ratelimit for editing a voice channel's name?

#

I can't find one on discord's official page, but perhaps there's one hidden, idk

earnest phoenix
#

there's a ratelimit for every endpoint

hushed berry
#

^

#

ratelimits arent really published since

#

they could be changed at any time, really

earnest phoenix
#

yeah, the docs tell you that you should refer to ratelimits returned in the request headers

hushed berry
#

theoretically they could temporarily increase the ratelimits if discord was under high stress

fair minnow
#

I see

hushed berry
#

let me check the ratelimit as it is rn though

fair minnow
#

I'm using a VC to count how many messages are sent by my bot

#

so should I make it count internally, then push an edit once a minute, to stay safe?

earnest phoenix
#

yup

hushed berry
#

yeah, that would be a+

fair minnow
#

okie

#

thx

#

Just checking, there's no way to do that already in discord.py is there?

hushed berry
#

to do what?

#

@fair minnow

#

edit a channel?

fair minnow
#

No, to stock up edits until a later point

#

I'll take that as a no

dusky marsh
#

You can just use like, a queue or something

buoyant stump
#

might look dumb but I'm trying to give a role when you mention someone but I have an error.

client.on('message', msg => {
    if (msg.content === config.prefix + 'give') {
        let member = msg.mentions.members.first();
        member.addRole(msg.guild.roles.find(test)).catch(console.error);
        msg.reply('gave the role.')
    }
});```
I get this error
```Cannot read property 'addRole' of undefined```
mossy vine
#

you shouldnt even be getting to that point wtf

buoyant stump
#

To that point?

mossy vine
#

your code shouldnt enter that part

#

you are checking exactly for "prefixgive"

#

so if you type

#

prefixgive @short folio

#

it shouldnt be doing anything

#

as you are checking for exact message content

#

not if it begins with

#

therefore there is no "first mention" in the message

#

therefore member is undefined

buoyant stump
#

Ooh okay

knotty steeple
#

i didnt even realize that lul

#

check if it starts with prefixgive

buoyant stump
#

even with startWith it doesn't seems to work thonk

#

I get the same error, I'm maybe wrong somewhere oof

#

I tried using what the js guide give but when I do my command I get no error but no response from the bot either?

client.on('message', msg => {
    if (msg.content.startsWith === config.prefix + 'give') {
        const role = msg.guild.roles.find(test);
        const member = msg.mentions.members.first();
        member.addRole(role);
        msg.reply('gave the role.')
    }
});```
knotty steeple
#

startswith is a function

#

not a property

buoyant stump
#

oof

#

I'm sorry

#

I read it wrong I guess lmao

#

It worked

#

Thank you for helping me >~<

knotty steeple
real portal
#

how to do welcome for server when bot joining a server?

#

dc.js

knotty steeple
#

what

#

use event guildMemberAdd

real portal
#

not user joining but my bot

indigo crane
#

guildadd event?

knotty steeple
#

^ that

#

and its guildCreate

indigo crane
#

oof yeah my bad

earnest phoenix
#

@slim heart Dude can you edit for me on web plz, sorry 😐

slim heart
#

wut

earnest phoenix
#

but my files're Turkish

#

sorry

#

I'm new on js

#

and very noob 😦

slim heart
#

ur asking me to do it for u?

earnest phoenix
#

yes, can you this?

slim heart
#

i dont do that for free, sorry. You need to learn it yourself, if you're noob then become not noob lol

earnest phoenix
#

on web for two mins?

#

😦

grim aspen
#
earnest phoenix
#

oh, ty dude ❀

thick gull
#

We need a website to activate OAuth ? I never use it ? How to install it ? Someone have a tutorial ? Thanks for answer and please ping me

earnest phoenix
#

you... dont install-

there's so many things wrong with that i-

shy rose
#

oauth is a login system

earnest phoenix
#

Where can I type css button scripts?

spring ember
#

<style></style>

#

In the long description

earnest phoenix
#

It gives error

#

Which file?

spring ember
#

What error

earnest phoenix
#

1 min plz

#

unexpected token

#

I typed in style.css

spring ember
#

Oh

#

Wait

earnest phoenix
#

you... aren't typing css in your code are you

#

okay

spring ember
#

Are you using multiple files?

earnest phoenix
#

mean ?

spring ember
#

Oh that's a normal button

#

I thought you meant in dbl

earnest phoenix
spring ember
#

That's not css

earnest phoenix
#

you can still have css link to hrefs

#

Can you come to direct message?

spring ember
#

I would recommend instead of a button use <a href="Link"></a>

earnest phoenix
#

I'm typing the script

#

Dude, I can't type direct message to you

spring ember
#

Yes you can't

fiery birch
#

why not put an anchor in a button

spring ember
#

Well I'm off to bed good luck

earnest phoenix
#

okay

#

@fiery birch

#

Can you help me online?

fiery birch
#

not really

earnest phoenix
#

why

fiery birch
#

busy

earnest phoenix
#

oh, ok

#

sorry

fiery birch
#

np

dusky bear
earnest phoenix
#

okay

dusky bear
#

Its also hard to understand your problem if you dont post code.

topaz sphinx
#

what is the CSS access for the container in discordbots user page

#

its not .content apparently

indigo crane
#

is 100seconds long enough delay between an autochanging status?

ruby dust
#

Yes

indigo crane
#
function changing_status() {
    setInterval(async () => {
        const statuslist = [
      ``
        ];
        const random = Math.floor(Math.random() * statuslist.length);
    
        try {
          await bot.user.setPresence({
            game: {
              name: `${statuslist[random]}`,
              type: "PLAYING"
            },
            status: "online"
          });
        } catch (error) {
          console.error(error);
        }
      }, 100000);
    }

bot.on("ready", async ready => {
    console.log(`${bot.user.username} is online!`)
    setInterval(changing_status, 100000);
})```

This is setup correct? Just double checking
ruby dust
#

I don't know d.js, but I guess try it and see?

tawdry turret
#

someone help me, I can not find the invite link from my bot

fiery stream
#

hi

indigo crane
#

Hey so can someone help me, I have a command that pulls an image from a sub reddit but the image dosent load at all, but the command runs fine.

buoyant wagon
#

(themonia) it depends on what permissions it needs

indigo crane
#

Wait don't worry, it works now ;-;

buoyant wagon
mystic shell
#

finally got the storage issues i was having with my bot fixed

#

i was using keyv before but that was buggy and kept erasing all user data so i had to rewrite all of the commands involving storage using sequelize

earnest phoenix
#

hi

#

one help

#

how i can add background

#

to my bot

mossy vine
earnest phoenix
#

aa

#

ok

earnest phoenix
#

can anyone help me solve this problem (i'm using ubuntu 16.04)

slender thistle
earnest phoenix
#

thanks

ruby dust
#

can the bot see a member's active voice client if it doesn't have permission to see the channel that member is connected to?

dull bobcat
#

waaaiiit..

#

python doesn't have a or operator?

slender thistle
#

condition1 or condition2

dull bobcat
#

oh i thought it was ||

#

sorry

#

but i need help with something else..

#
gbyters@Gbyters:~/programming/python/dictionary_attack/md5$ python3 main.py 
Ready or custom? (r/c): r
MD5 hash: 5f4dcc3b5aa765d61d8327deb882cf99
Traceback (most recent call last):
  File "main.py", line 10, in crackhash
    md5_f = open(md5_f, 'r')
UnboundLocalError: local variable 'md5_f' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 36, in <module>
    crackhash()
  File "main.py", line 13, in crackhash
    print("%s: No such file" % md5_f)
UnboundLocalError: local variable 'md5_f' referenced before assignment
gbyters@Gbyters:~/programming/python/dictionary_attack/md5$ 
slender thistle
#

Send code

spring ember
#

md5_f = open(md5_f, 'r')

#

you referenced it and assigned it

dull bobcat
#

oh

#

@spring ember

slender thistle
#

Using tabs and spaces at the same time

dull bobcat
#

?

slender thistle
#

Go through your indents and see where you put a tab/space instead of the other one

dull bobcat
#

well i use nano

#

i cant see a difference lmfao

#

i prob need a better text editor

slender thistle
#

Well that sucks

#

You really do

dull bobcat
#

is vim better?

slender thistle
#

Can't you get an IDE

dull bobcat
#

IDE is not a text editor

#
  • nah i want a text editor on my terminal its way faster to edit a file there
slender thistle
#

Gl coding in Python using nano/vim

earnest phoenix
#

how do you ban by ID in discord.js?

dull bobcat
#

cant i just use a text editor for pything..

earnest phoenix
#

so when i'm using my vps to host my bot the terminal closes every few hours which stops my bot. How can i make it to work without stopping?

slender thistle
#

@dull bobcat Finding where you fuck up your indentation with a text editor takes more time

dull bobcat
#

sorry.. damn

slender thistle
#

Either go through your indents, delete them and see where you went inconsistent or get an IDE and use it instead

dull bobcat
slender thistle
#

"option" is a second condition

#

So is "ready" in your first if

#

(option == "r") or ("ready") is what you are doing

dull bobcat
slim heart
#

@dull bobcat I’m pretty sure he just answered you

dull bobcat
#

@slim heart Nah the answer was wrong

slim heart
#

Not really but ok

dull bobcat
#

Yes really

#
if option in ("r", "ready"):

This solved my issue instead

slim heart
#

Yes that was your issue

#

That’s what he pointed out

slender thistle
#

Two ways of doing that

dull bobcat
#

Yeah and im thankful πŸ˜„

slim heart
#

πŸ€¦β€β™‚οΈ

#

You said no too

dull bobcat
#

Yea i did, to the solution ^

slim heart
#

He didn’t give u a solution u kinda just ignored the problem he pointed out which could’ve lead to your solution 20 minutes later lol

slender thistle
#

r == 1 or r == 2 or r in [1, 2] (can use a tuple, whatever)

slim heart
#

Smh

#

Do understand why gby

#

Probably not

trail dagger
#

I need some help with my purge command
i want my purge message to work but it doesnt
because when i delete messages with the command it just sends deleted 15 messages when i do ?purge 15 but i want it to send the number of messages it did delete not what i entered

#
    @commands.command()
    @commands.has_permissions(manage_messages=True)
    async def purge(self, ctx, amount: int=None):
      if not amount:
        await ctx.send('Please enter a valid number')
      else:
        await ctx.channel.purge(limit=amount + 1)
        await ctx.send('Deleted {} message(s)'.format())
slender thistle
#

await ctx.send('Deleted {} message(s)'.format()) Why are the params empty in format

#
Returns
The list of messages that were deleted.
#

Put that purge in a variable and use len() on it

spring surge
#

is there a way to set up rewards for voting in python?

#

and if so how would you do it?

fiery birch
#

that's a rather broad question

#

you should specify more on what kinda rewards and how they vote

spring surge
modest monolith
#

Why dosent discord use c#

spring surge
#

because c# is too cool to be used

mossy vine
#

because discord doesnt need it

#

they use better solutions

slender thistle
#

@spring surge A separate script or preferably a cog for your bot?

spring surge
#

wdym by a cog?

slender thistle
#

Separate extension with a class to sort your commands

#

Cogs are classes within extensions which are separate files from your main one

spring surge
#

perfect thats what ive been looking for!

#

thx!

trail dagger
#

I need some help with my purge command
i want my purge message to work but it doesnt
because when i delete messages with the command it just sends deleted 15 messages when i do ?purge 15 but i want it to send the number of messages it did delete not what i entered

    @commands.has_permissions(manage_messages=True)
    async def purge(self, ctx, amount: int=None):
      if not amount:
        await ctx.send('Please enter a valid number')
      else:
        await ctx.channel.purge(limit=amount + 1)
        await ctx.send('Deleted {} message(s)'.format())```

format is empty because i dont know what to put in
#

i want it so say how many messages the bot deleted not the amount i said

slender thistle
#

Did you even understand what I said to you

#

I never mentioned using amount to show how many messages you deleted

#

Make your purge a variable and in .format, use len() on your purge

trail dagger
#

so purge = WHAT

slender thistle
#

deleted_messages = purge etc
send("blah blah {}".format(len(deleted_messages)))

#

Basic Python and reading docs btw

trail dagger
#

got it

thick gull
#

Can someone can help me with OAuth2 ?

#

i want to use Guilds.join but i dont know how

#

i make a Node.js web server

grim aspen
#

oauth2 is an invite link

thick gull
#

But i want to get some more with this

#

Like Guilds he is on

#

it's for a Bot server

earnest phoenix
#

redirect them to the authorization menu, when they're done authorizing they'll be redirected back to your website with a code, use that code to exchange for an access token, you'll use that token in the Authorization headers for your requests now, e.g Bearer accesstoken

thick gull
#

But how to get the code with that kind of link ? and how to use it after ?

#

@earnest phoenix Please ping me if you answer

earnest phoenix
#

i told you

#

your user will be redirected back to your website

#

except the url will now have a ?code= parameter

thick gull
#

Yeah but how with a node.js server get the token and use it for example guilds.join

#
const https = require('https');
const express = require('express');
const app = express();
const port = 3000;
const clientId = '545651085239386143';
const redirectUri = '';
const clientSecret = 'censored';
const grantType = '';

app.get('/', (req, res) => {
    let authorizationCode = req.query.code;

    // Faut faire une requete a cet url
    let requestUrl = `https://discordapp.com/api/oauth2/token?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&client_secret=${clientSecret}&code=${authorizationCode }&grant_type=${grantType}`;
    https.post(requestUrl, (resp) => {
        let data = '';

        // A chunk of data has been recieved.
        resp.on('data', (chunk) => {
            data += chunk;
        });

        // The whole response has been received. Print out the result.
        resp.on('end', () => {
              let auth = JSON.parse(data);
            // Et la, t'as auth.token_type et auth.access_token de dispo pour faire tes requetes en tant que l'utilisateur
        });
    });
});

app.listen(3000);
#

This work @earnest phoenix

#

?

earnest phoenix
#

i dont know i dont do node

thick gull
#

😒

carmine echo
#

How do I make the user get redirected to the bot's website after inviting the bot

#

https://discordapp.com/api/oauth2/authorize?client_id=495496088510529556&permissions=8&scope=bot&redirect_uri=https%3A%2F%2Fantiowo.xyz
I've come up with this, but it does not work

bright spear
#

that looks right

thick gull
#

You must use an Web server if you need to add a redirect

#

same problem than me

carmine echo
#

what really

thick gull
#

Beacause Discord host Bot adding but not redirect

#

if you use redirect you are using OAuth2 and OAuth2 is LIKE A BOSS YOU CANT BEAT BUT THERE YOU CAN'T UNDERSTAND

#

Sorry

dusky marsh
#

Uuuhhh, you alright there bud?

thick gull
#

i spend my day to watch tutorials and desesperate to understand OAuth2

earnest spear
#

do you guys know how to set all values in a Map. for example, let's say i have a list of checkmarks mapped with a string, boolean

#

and i want to set all values to false using Map.set prototype

queen violet
#

you can use forEach

#

map.forEach((key, value) -> map.set(key, false));

earnest spear
#

you can use a forEach on Map?

queen violet
#

yes

earnest spear
#

very interesting let me try that...

#

i'm making an app in React + Redux

#

vc Γ© brasileiro? πŸ˜„

queen violet
#

sim

earnest spear
#

tΓ‘ muito bem ^^

queen violet
#

e eu achei q vc tava falando de java kkk

#

n sei js n

#

mas acho que da pra vc fazer

#

tipo

#

Objects.keySet(map)

#

e dai iterar todas as chaves

#

Objects.keySet(map).forEach(key => map.set(key, false))

earnest spear
#

ok vou fazer isso

#

obrigado πŸ˜„

queen violet
#

dnd

earnest spear
#

tΓ΄ aprendendo portuguΓ©s do Brasil πŸ˜„

queen violet
#

Γ© de portugal?

earnest spear
#

nao eu gosto do brasil :3

queen violet
#

ah blz

earnest spear
#

brasil is the bessst

queen violet
#

ss

earnest spear
#

kkk

zealous veldt
earnest spear
#

hey @queen violet me diz que Objects is not defined quando uso Objects.keySet(map).forEach(key => map.set(key, false))

#

ohh! funciona. tenho que usar Objects.keys no Javascipt

indigo crane
#
  client.on("error", (e) => console.error(e));
  client.on("warn", (e) => console.warn(e));
  client.on("debug", (e) => console.info(e));```

worth adding?
earnest spear
#

i have no idea Eto πŸ˜…

#

maybe it's good to put it because of debugging

#

hey guys quick question. i'm wondering why none of these value become false when I perform this code:

const myMap = new Map()

myMap.set("banana", true)
myMap.set("apple", true)

Object.keys(myMap).forEach(key => {myMap.set(key, false)})

console.log(myMap.get("banana")) // returns true but should return false
indigo crane
quartz kindle
#

Object.keys apparently doesnt work on maps

#

but you can do <map>.forEach((value,key) => { ... })

earnest spear
#

i got the solution:

const myMap = new Map();

myMap.set("banana", true);
myMap.set("apple", true);

[...myMap.keys()].forEach(key => {
  myMap.set(key, false);
})

console.log(myMap.get("banana")) // returns false
console.log(myMap.get("apple")) // returns false
quartz kindle
#

that looks kinda stupid, i have no idea if thats efficient or not tho

#

using forEach directly on the map should be better i think

inner jewel
#
> m
Map {}
> m.set("a", 123)
Map { 'a' => 123 }
> m.forEach((_, k) => m.set(k, false))
undefined
> m
Map { 'a' => false }```
earnest spear
#

@inner jewel that's a very elegant answer

#

i really like this

ruby dust
#

if only I knew how to map in python

indigo crane
#

can someone help me, I got my bot to log the roleCreate event, but I'm stuck on how I grab the role name

#
bot.on('roleCreate', async (message) => {
    const logs = message.guild.channels.find(ch => ch.name === 'logs');
    if (!logs) return console.log("Can't find logs channel.");
    const entry = await message.guild.fetchAuditLogs({
        type: 'ROLE_CREATE'
    }).then(audit => audit.entries.first())
    let user;

    user = entry.executor.username

    logs.send(`Role: role.name was just created!`);
})```
amber fractal
#

roleCreate doesnt pass a message

idle basalt
#

roleCreate doesnt return a message

amber fractal
#

it's a role

idle basalt
#

you have a role named message right now

#

bot.on('roleCreate', role => console.log(role.name)) would give you the roles name

indigo crane
#

How would I go about getting the role name sent to a channel?

idle basalt
#

get a channel somehow and then .send()

#

role.guild is the guild that the role is in so you can pick a channel from there however you like

fiery stream
#

ayyy

ancient fern
#

how do i make a bot?

#

this is my 1st time

lean swan
#

YouTube have that

ancient fern
#

thx

lean swan
#

Np

#

Simple to make i hope you make it well~

ancient fern
#

im making mine for rp and levels ;p

lean swan
#

Ohhj

ancient fern
#

but ill hold it off for now

bright spear
#

You need to code it

fiery stream
#

db is needed

pallid zinc
#
 { message.channel.send({ embed:
 { title: `${message.author.avatarURL}'s Profile Picture.`, 
image: { url: message.author.avatarURL }, 
color: "RANDOM" } }) }; ```
#

Not working with RANDOM color

#

${bot.users.size}

#

Tell wrong

#

It's show 374 member but I have 900+ member

lament meteor
#

@pallid zinc it doesn't count duplicates

#

so if i add the bot to 100 guilds but all the users are the same it will have very little users

pallid zinc
#

No duplicates

amber fractal
#

it's also cached users

lament meteor
#

o yea that too

pallid zinc
#

That bot is only added in one guilds

#

Hmm

#

Tarpergon make sense

flint trellis
#

@pallid zinc if you want true member size, iterate through all the guilds and add their membercount

late hill
#

^ But that could contain duplicates blobsweat

pallid zinc
#

It's ok

earnest phoenix
#

How can i get the guilds highest role???

#

in discord.js

latent oasis
earnest phoenix
#

looks generic

#

personal web pages and portfolios should be styled originally

quartz kindle
#

looks bad english

pallid zinc
#

Lol

late hill
#

Activate windows blobhypersweat

earnest phoenix
#

πŸ˜‚ πŸ˜‚

spring ember
#

I am JavaScript

latent oasis
#

Cry, it's just simple webpage, where I training

#

Taking experience

#

Nothing more

spring ember
#

@latent oasis the animation looks smooth good job

latent oasis
#

Ty

#

I used typed.js

quartz kindle
#

now do that again without using a library

mossy vine
#

imo using a library isnt bad if the end product looks good as a result

quartz kindle
#

yeah but if you do it without a library you're showing that your skill set is good

#

specially if its a website about your own work

mossy vine
#

yeah thats true

latent oasis
#

Tim ik, but I'm just getting into webdeveloping

trail dagger
#
        await ctx.send(text)
        time.sleep(2)
        await ctx.text.purge(text)```
#

i just ask what am i doing wrong

#

oof

slender thistle
#

ctx.text?

trail dagger
#

yea

#

i know that is wrong

slender thistle
#

Also, don't use time.sleep

trail dagger
#

asynco

#

asyncio ik

#

but the last line is wrong

slender thistle
#

Are you doing purge twice

trail dagger
#

πŸ˜ƒ

#

it is for the purge command

#

idk what to change it to

#

too*

slender thistle
#

Send your full command

trail dagger
#

dm

latent valve
#

pleas how to add my bot

trail dagger
#

add it there

indigo crane
#

🀦

velvet chasm
#

Can I apply Rich Presence to bots?

low bolt
#

Guys if i use ${client.emojis.get("572030198124511243")} code, it says "undefined"

#

JavaScript

opaque eagle
#

Make sure that's the actual ID of the emoji

low bolt
#

Yes

#

i look with \:emoji:

peak quail
#

what if you use the emoji name also ![thonkku](https://cdn.discordapp.com/emojis/356833797804916737.webp?size=128 "thonkku")

opaque eagle
#

It's better if you do this, so we can make sure that the emoji exists. js const emoji = client.emojis.get("572030198124511243"); console.log(emoji);

low bolt
#

okay

knotty steeple
#

if its undefined we already know it doesnt exist

#

no need to log mmLol

opaque eagle
#

dumb me

low bolt
#

${emoji}

#

so i will use this?

#

yes

knotty steeple
#

why are you getting the emoji

late hill
#

@velvet chasm No

low bolt
#

@knotty steeple i want show owner list

#

And, doesn't work again. I use this code:

knotty steeple
#

owner list?

low bolt
#
const online = client.emojis.get("572030353146118174");
c.send(`${online}`)
#

Discord Server Admin list

#

Like:

  • SedatTR | State: Idle emoji
mossy vine
#

thats not how you do an emoji

#

client.emojis.get() returns an Emoji object

low bolt
#

So, what will i use?

quartz kindle
#

you should be able to use it like that according to the v11 docs

mossy vine
#

wait what

#

oh but that is .toString()

#

he didnt do that

spring ember
#

well it was overriden

quartz kindle
#

toString is automattic

mossy vine
quartz kindle
#

when concatenated

earnest phoenix
#

What is the bug of ) .?

#
bot.on('ready',() => {
	console.log("I'm ready")
	)}
slender thistle
#

})

earnest phoenix
#

thx

safe pumice
#

Hello all, can i rewrite !help command for something more personnal in python ?

slender thistle
#

Sure

#

bot.remove_command('help') and go crazy with your creativity

safe pumice
#

ok thank @slender thistle

unique nimbus
#

A good tip for your help command, make it easy to read

safe pumice
#

it's something that i don't notice before and when i use the help command, that was not helpfull and unreadable (like my english πŸ˜„ )

earnest phoenix
#

I use a paginator for mine

unique nimbus
#

using a paginator and what is written is different things

earnest phoenix
#

hi

#

HI

safe pumice
#

hi, it's possible to set some information to an user with a specific command ?

west spoke
#

Yeah

#

.txt files, .json files, databases, etc.

#

I use json for posts (=post create <text>) and has data on the message.

indigo crane
#

Hey so how do I make it, so when my bot is pinged it sends a message to that channel.

proven surge
#

what language (dont say english)

safe pumice
#

@west spoke ok thank

west spoke
#

...

earnest phoenix
#

check if the message content equals to your bot's mention

#

<@id>

#

or

#

<@!id>

idle basalt
#

pretty sure a message example is on the front page of the docs of every lib

west spoke
#

Yeh

knotty steeple
#

basically

#
if(message.content is mention) {
send message
}```
west spoke
#

Or

earnest phoenix
#

or use dbm for no hassle bot making mmLol

west spoke
#

if message.content == client.user.mention

inner jewel
#

there are two mention types

#

<@id> and <@!id>

knotty steeple
#

second is with nick first is without

buoyant wagon
#
if (message.content.includes(`<@${client.user.id}>`) || message.content.includes(`<@!${client.user.id}>`)) {
    //send message
}```
earnest phoenix
#

r!weather

#

!weather

#

!ban

west spoke
mossy vine
#

im having some issues with mongodb, anyone able to help out?
running mongo says "connection refused"
running mongod throws this error https://pastebin.com/wNdDFyvF

winged mango
#

hum ... I am following the guide on "how do i code a bot" in #502193464054644737 ... and i have a little problem, the "npm init -y" command doesn't work (and why is it putting me in system32, i'm scared)

zealous veldt
west spoke
winged mango
#

😭

grim aspen
#

joose what the fuck

west spoke
#

Peak dbl

winged mango
#

i just want to code and i'm stuck with weird things

spring ember
#

@mossy vine maybe mongo has a connection limit like Postgres and redis

winged mango
#

"peak dbl" ... what ?

west spoke
#

Meme

winged mango
#

arf

mossy vine
#

@spring ember what do you mean connection limit? i havent used it in days and its not been running

spring ember
#

Oh

wraith cipher
#

@mossy vine are you using mongo Atlas ?

spring ember
#

Are you sure mongo is running?

earnest phoenix
#

set the connection limit to -1 <o/

mossy vine
#

my issue is that its not running lmao

#

@wraith cipher nope

#

im having problem with starting it

#

look at my message above

spring ember
#

mongod

#

I think is the command

mossy vine
#

yes

#

in the message i linked to a pastebin containing the error that throws

spring ember
#

Yeah yeah I saw

#

Can you try

ps aux | grep mongo
mossy vine
#

thats the output

spring ember
#

Nah ok

#

No dead process

#

Umm that's weird

inner jewel
#

sudo mongod?

spring ember
#

Oh yeah that might be it

mossy vine
#

different error but still not working, lemme paste it here

#
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] MongoDB starting : pid=2205 port=27017 dbpath=/data/db 64-bit host=cyber28-linux
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] db version v4.0.9
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] git version: fc525e2d9b0e4bceff5c2201457e564362909765
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] allocator: tcmalloc
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] modules: none
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] build environment:
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten]     distmod: ubuntu1804
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten]     distarch: x86_64
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten]     target_arch: x86_64
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] options: {}
2019-04-28T21:41:58.557+0200 I STORAGE  [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2019-04-28T21:41:58.557+0200 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2019-04-28T21:41:58.557+0200 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] now exiting
2019-04-28T21:41:58.557+0200 I CONTROL  [initandlisten] shutting down with code:100```
inner jewel
#

2019-04-28T21:41:58.557+0200 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db

mossy vine
#

where do i create that directory tho

spring ember
#

sudo mkdir -p /data/db

#

It's supposed to be on root probably

mossy vine
spring ember
#

Also give mongo ownership

winged mango
spring ember
#

sudo chown -R mongod:mongod /data/db

mossy vine
#

invalid user mongo

spring ember
#

I edited

mossy vine
#

oh

#

invalid user mongod:mongod

spring ember
#

sudo chmod 0755 /data/db

#

Just give it permissions without changing ownership

mossy vine
#

same exact error

#

i mean

#

mongod throws the same error

spring ember
mossy vine
#

same

spring ember
#

Can you check the permissions for the folder?

#

ls should do the job

mossy vine
spring ember
#

You might need the l flag

#

Oh

#

It has write permissions

mossy vine
#

ls -l "total 0"

spring ember
#

What the actual fuck

wraith cipher
#

-a ?

spring ember
#

-a isn't needed

#

sudo chown -R mongodb:mongodb /data/db

#

@mossy vine

mossy vine
#

still complains about how its read-only

winged mango
#

is it possible to code a bot in an other language than javascript ?

mossy vine
#

of course

#

@spring ember okay, ill try completely reinstalling it tomorrow. thanks for helping, cya

winged mango
#

hummm, what languages are "available", if i can say that ?

#

java ?

mossy vine
#

literally anything

spring ember
#

Sad @mossy vine

mossy vine
#

python, java, lua, dart, anything that can send http requests really

grim aspen
#

@winged mango Python, Javascript, Ruby

winged mango
#

niice ... and how do i do it, then ... i tried with js but it doesn't want to work

wraith cipher
#

Yea your bot is just communicating with the API

winged mango
#

niice

wraith cipher
#

It's the wrappers you should look for

spring ember
#

It's not js that's the problem

#

I recommend learning a language and sticking with it

winged mango
#

i know java

#

and python

wraith cipher
#

Try python

winged mango
#

and a little bit of js

grim aspen
#

like dondish said

#

learn one language and stick only to that language for your bot

spring ember
#

Both Java and Python have amazing wrappers

#

Choose one

#

My favorited are Discord.py for Python
And JDA for Java

winged mango
#

it is my first bot, and i don't really know what i will make him do, what is the best language, i mean that can do the most things ?

spring ember
#

If you want to use the vertx framework for Java then catnip is a great alternative too

winged mango
#

wait

#

i'm already lost

spring ember
#

There is no best language

#

What language do you want to use

winged mango
#

java to start i think

#

i mean, java

#

now ... how do i put code on my bot ?

#

heyyyy 😦

#

not funny 😦

buoyant wagon
#

you make a file

spring ember
#

Gradle and JDA should do the job

dusty cipher
#

ask a better question madara

#

which what code ?

spring ember
#

Learn how to use Gradle, I find it really fun to work with and then learn the concepts of JDA they have it all in their wiki

winged mango
spring ember
winged mango
#

so i don't know at all what i will do

dusty cipher
#

that is js?

winged mango
#

thx

buoyant wagon
#

command prompt

winged mango
#

it was for js, yes

spring ember
#

@winged mango you wanted Java right?

dusty cipher
#

u wanna keep going js?

spring ember
#

Check out the link I just sent

winged mango
#

yes thx

dusty cipher
#

then u do next step which is npm install discord.js --save

winged mango
#

no, i want to do it in java actually

dusty cipher
#

thats another story

#

i dont speak java sorry

winged mango
#

np thx

spring ember
winged mango
#

x)

spring ember
#

Oops

winged mango
#

actually, what really are gradle and dv8 (or JDA i don't know) ?

spring ember
#

dv8 is the creator

#

Gradle is a build tool that helps you manage dependencies

#

For example JDA

#

JDA is the library that helps you interact with the Discord API

winged mango
#

so grable is more or less like sublime text or netbeans for exemple ?

#

i see

spring ember
#

No

winged mango
#

arf

spring ember
#

Gradle is like npm

#

Or pip for Python

winged mango
#

i don't know what npm is x)

spring ember
#

It's the node.js package manager

slim heart
spring ember
#

Gradle helps you build your Java application

#

@slim heart it's basically attr = true

winged mango
#

hum ... ok

#

i guess

#

so, i have my bot in the developer portal

#

i mean the application with the bot

#

what do i do now ?

spring ember
#

You start a new Gradle project by installing gradle and running gradle init in cmd

#

Then add the required dependencies to your build.gradle file and start coding!

#

Enjoy

winged mango
#

and it is in java, right ?

#

like pure java or a weird gradle java ?

spring ember
#

Pure Java

winged mango
#

nice

#

thx ^^

#

hoping it will work

spring ember
#

Here are some links to help you start

winged mango
#

and i'm already lost GWqlabsHyperRage

#

i'm so pissed

spring ember
#

Take your time and try to

#

There are never shortcuts

winged mango
#

ok, i found a french tutoriel (cause i'm french), it will helps me a bit more for the start

spring ember
winged mango
#

i think

#

i'll take that too

#

damn 1h

spring ember
#

Yep

#

I like webinars

#

They show real life examples

#

I haven't seen this one but it's by Gradle

winged mango
#

what are webinars ?

#

people who are doing code in videos ?

spring ember
#

Online seminar

winged mango
#

okay

grim aspen
#

just like a podcast where people can learn

opaque eagle
#

Let's say that in a project, I have foo.txt and bar.txt. And in that project, I have two branches: master and stable. The only difference between those two branches is in bar.txt. But now, I want to make changes to foo.txt in both branches. Is there a way besides having to make the changes in both branches separately?

spring ember
#

stash pull pop

#

should do the job

willow sparrow
#

.

#

@spring ember

#

What’s a stash pull pop

spring ember
#

git commands

willow sparrow
#

Ah

spring ember
#

git stash backs up current changes that haven't been staged and commited yet

#

git pull pulls new information

opaque eagle
#

Hmm

spring ember
#

git pop pops out the last stash

opaque eagle
#

I made a new branch to make all the changes on and then just merged them

spring ember
#

git pull has some flags for handling congestions

grim aspen
#

i thought that was detectivehuman for a second

spring ember
#

same

opaque eagle
#

So let's say... while messing around with Git, I accidentally leaked my token and api keys... "hypothetically"... and I deleted the repo from GitHub a split second after it got pushed... how would I go about reverting back to the time when I hadn't fucked up?

#

I don't wanna get rid of all the edit history

spring ember
#

first refresh the token

opaque eagle
#

I just wanna go back to the time when it wasn't ruined

#

Yep, I refreshed my token and api keys @spring ember

spring ember
#

ok

opaque eagle
#

Refreshed everything

spring ember
#

git revert is the git command for you

opaque eagle
#

ok

spring ember
#

git revert <commit hash>

opaque eagle
#

but, couldn't people go into the commit history and see all the info?

spring ember
#

also merging conflicting branches is usually done with git rebase

#

@opaque eagle they can

#

that's why you refresh the tokens

opaque eagle
#

ohhhh right

dusky bear
#

Which databases work best with Heroku.

earnest phoenix
#

none

opaque eagle
earnest spear
#

can anyone help me with a ReactJS question

#

i can't get my app deployed on GitHub Pages 😭

soft eagle
#

anyone know a good souce to have a mute cmd that makes u type the reasson after u do a.mute [user]

earnest spear
#

hmm i'm not sure if i have a good source for that

#

are you looking for a bot that does that already?

soft eagle
#

no a way to code it

inner jewel
#

what language?

soft eagle
#

discord.js

inner jewel
#
const who = first arg
const reason = remaining args```
#

take a loot at Array#slice and Array#join

soft eagle
#

so that would do is a.mute user then it when i hit eb=neter allow mw o enter a rasson like luca does?

inner jewel
#

no, it'd be a.mute USER heres the mute reason

soft eagle
#

not trying to copy luca just think its cool

inner jewel
#

if you want something interactive, it's slightly harder

#

you'd need to ask for a reason and wait for a response

soft eagle
#

do u know of a site or a yt vid that would help me do it

inner jewel
soft eagle
#

is what im talking abou called message await

pliant needle
#

Redis persistence is usually automatically enabled, right?

inner jewel
#

let mut client = ...

indigo crane
#
const Discord = require('discord.js');
const client = new Discord.Client();
const token = ''

client.login(token);

client.on("ready", async ready => {
    console.log(`${client.user.username} is ready!`)
})

var prefix = " "

client.on("message", async message => {
if (message.author.bot) return;
if (message.channel.type === "dm") { 
    var args = message.content.split(" ").slice(0)
    var args = args.slice(0).join(" ") 

    if (message.content.startsWith(prefix)) return message.channel.send(":x: Please use commands in real server! :x:") 
        else if (args.length > 256) return message.reply("Your message content too many characters :/") 
    var embed = new Discord.RichEmbed()
        .setColor('RANDOM')
        .setTitle("New request in DM!")
        .addField(args, "Sent by: " + message.author.username + " with the ID: " + message.author.id)
    client.guilds.get("guild id").channels.get("channel id").send(embed)

}})

client.on("message", async message => {
    
if (message.content.startsWith(prefix + "reply")) {
    if (message.author.bot) return;
    if (message.author.id !== "owner id") return message.reply('You cannot use that!')
    var args = message.content.split(" ").slice(0)
    var Rargs = message.content.split(" ").slice(2).join(" ")
    var userID = args[1]
    if (isNaN(args[1])) return message.reply("This is not an ID!") 
    client.users.get(userID).send(Rargs)
    message.channel.send("Sent!").catch(console.error)
}})```
lament meteor
#

oh pls... don't have each cmd in its own msg event

indigo crane
#

No no. I dont. Thats not in my bot.

pliant needle
#

For discord.js, what was the obj for pulling the bot's avatarURL? Anyone know off the top of their head?

#

For the life of me, I'm not finding it

lament meteor
#

client.user.avatarURL iirc

pliant needle
#

Thank you!

grizzled glacier
#

Hello Developers

#

i am created a bot

#

at the same time as been hosted, i publish it into the Discord Server List

#

And i have a question

#

i send a screenshot

slender thistle
#

You can just post your screenshot, question, any errors you get and whatever that is related to your issue without all those greetings photoblobs

grizzled glacier
#

How to add Watch, listen, or Streaming?

#

i'm using discord.js

#

no on.bot

slender thistle
#

Check out setPresence in djs docs

grizzled glacier
#

Ah thanks

warped magnet
#

Does anyone know how to get a discordpy Bot in a webserver or something else that the Bot is always online?

slender thistle
#

Rent a VPS, connect to it through SSH and FTP (preferably SFTP), upload your bot, download needed discord.py version, run the bot

warped magnet
#

...okay thank you

west spoke
#

@warped magnet keep your computer always on lol

#

That's what I do

warped magnet
#

that's what I do until my bot is verificated .__.

west spoke
#

Mine is verified. For the very few times it crashes ( #memes-and-media ) it normally does it just fine

warped magnet
#

du you get a message when the bot is verified or is it jusrt verified?

west spoke
#

You do

#

Also why I no longer use the =neko command

#

Would crash my bot when spammed

warped magnet
#

ah, thank youu

slender thistle
#

Are you that guy who used requests module, LazyNeko?

lament meteor
#

is requests bad shiv?

#

well i heard aiohttp is better but i personally don't rlly use py so yea

west spoke
#

Wdym requests. Its needed for most python modules.

#

Specifically PIL

slender thistle
#

@lament meteor Use aiohttp if your code is async

warped magnet
#

my discordpy bot is without request module... if I remember correctly

slender thistle
#

So it's not blocking

#

requests is

lament meteor
#

o ok

#

that makes sense

slender thistle
#

I'm not saying "Delete your fucking requests module". My point is, you should use aiohttp if you don't want your bot to be blocked for a long time (it will crash at some point if your requests take too much time)

lament meteor
#

yea ik

west spoke
#

Ooo

#

The errors?

slender thistle
#

Your websocket disconnects if you do stuff that takes a long time with sync module

#

Also, while we are still at it, don't use time.sleep in your Discord bot, asyncio.sleep exists

west spoke
#

I use asyncio.sleep()

#

I'm not dumb.

slender thistle
#

I'll not calling anyone dumb for doing that, just sharing advices

west spoke
#

Ik but time.sleep can cause errors.

slender thistle
#

And it does at some point

spring ember
#

time.sleep freezes the thread

#

asyncio.sleep freezes the coroutine

heavy spade
#

:/

#

Error

grim aspen
#

what's the error and which library are you using?

heavy spade
#

Discord.js

#

I fucked up so I have to restart πŸ˜‘

#

It’s fine though

eternal mesa
#

Never use requests in a discord bot

#

aiohttp for the win

leaden cosmos
#

.help

grim aspen
pallid zinc
#

How can make a bot that send notification when I upload a video on youtube

earnest phoenix
#

Someone know how to put a canvas in a embed ?

pallid zinc
#

Is it with youtube api

#

Canvas mean

earnest phoenix
#

image

pallid zinc
#

Hmm

#

Yup I now

earnest phoenix
#

bc .setImage(canvas) return 255, 255, 255, 255, 255...

pallid zinc
#

If you want to insert a image

slender thistle
#

Wtf is that username

earnest phoenix
#

its not a image

#

its a canvas