#development

1 messages · Page 663 of 1

pallid zinc
#

What

smoky mica
#

What's your question

pallid zinc
#

Why bot responsing ever prefix

smoky mica
#

every prefix?

pallid zinc
#

Yup

smoky mica
#

idk whats your prefix

pallid zinc
#

It's k.

#

And bot responding to same length prefix

smoky mica
#

whats ur bot

#

there are other bots with the same prefix as well

pallid zinc
#

@smoky mica thanks but I solved it

smoky mica
#

nice

earnest phoenix
#

when you send a webhook test does the "user" return the bot owner id?

#

just curious 🤔

quartz kindle
#

should return your user id

#

as the "tester"

slender thistle
#

user = ID of user who voted/tested
bot = your bot's ID

pallid zinc
#

    at Map.[check] (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/enmap/src/index.js:947:31)

    at Map.get (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/enmap/src/index.js:229:19)```
#
 if(client.guildSettings.get(message.guild.id,"deletemessage")) message.delete()```
earnest phoenix
#

have you thought of the fact that you never insert data into the enmap

#

refer to enmap docs

pallid zinc
#

nope

indigo geyser
#
@client.event
async def on_reaction_add(reaction, user):
  message = reaction.message
  
  if reaction.message.author == client.user:
    
    if user.id != client.user.id:
      
      if message.content == 'React with:':
        role = discord.utils.get(message.guild.roles, name="Destiny-join")
        await user.add_roles(role)
``````AttributeError: 'NoneType' object has no attribute 'id'``` pls help
slender thistle
#

Role not found

uneven pond
#

What is bot prefix CSS code

earnest phoenix
#

wat

stray garnet
#

@uneven pond wym

quartz kindle
earnest phoenix
#
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
                .token("TOKEN")
                .botId("ID")
                .build();
        api.setStats(jda.getGuilds().size());

It throws ClassNotFoundException, why?

#

Class is imported: import org.discordbots.api.client.DiscordBotListAPI;

mossy vine
#

is the class file in the right place

earnest phoenix
#

It's in my main-class

#

But I've registered the token with JDA before.

halcyon nymph
#

@indigo geyser I think you've incorrectly defined client, make sure you have this somewhere in your code

Client = discord.Client()
client = commands.Bot(command_prefix = "prefix")
#

and, also that the client you are running your token in is the same that you define your prefix in

smoky mica
#

how can i map regions? discord.js

slender thistle
#

@halcyon nymph Hold the f up

#

Why would you create Client AND Bot instances

indigo geyser
#

@Just_Allexx#8095 I resolved

#

@Just_Allexx#8095 and no

#

It isn't the error

#

Rip

#

@slender thistle yes

#

Sorry

#

It was j and not J

#

The role name

slender thistle
#

utils.get/find returns None if nothing was found by given conditions

#

Might wanna note that

halcyon nymph
#

Mine doesn't return None when i do that

#

it works fine

slender thistle
#

Because it finds something

halcyon nymph
#

thanks

slender thistle
#

Reset your token

#

Congrats

halcyon nymph
#

left my token in

indigo geyser
#

Lel

halcyon nymph
#

anyway

#
import discord
import random
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import time

Client = discord.Client()
client = commands.Bot(command_prefix = "")
       
@client.event
async def on_ready():
    print('ready')
    exit()

client.run("token")
#

Works fine

#

NO errors

slender thistle
#

Yes but why would you have Client and client

indigo geyser
#

And when you will add something on the on_message, commands will stop work

halcyon nymph
#

idk

slender thistle
#

Which are also different

halcyon nymph
#

the tutorial i used when i started had it

#

so i kept it

#

and it hasn't not worked

slender thistle
#

Congrats, you were following a shitty tutorial

indigo geyser
#

@halcyon nymph ush, copy and past isn't a good thing

halcyon nymph
#

I was learning!!!

indigo geyser
#

Mission failed

halcyon nymph
#

all the code in my bots are mine

#

I promise

indigo geyser
#

Oke

halcyon nymph
#

i just copied over the skeleton, and when i made new bots copied over the imports the clients and the run

slender thistle
#

Anyway I suggest you remove what you don't need

halcyon nymph
#

what do i not need?

slender thistle
#

Whatever you don't use

indigo geyser
#

discord.Client

slender thistle
#

In your case, Client

indigo geyser
#

But there isnt' a prefix

#

In command_prefix

#

What the freak

halcyon nymph
#

idk

#

i just manually check for the prefix

#

it's not that much extra effort

#

I feel like I'm exposing myself as a really bad programmer rn

slender thistle
#

You only show yourself as a bad coder only if you don't listen to advices

halcyon nymph
#

okay, well I've gotten rid of Client and nothings broken

slender thistle
#

Why would you not use command_prefix though hyperawoo

halcyon nymph
#

I'm pretty sure i tried, but it'd run on_message regardless so it was kinda redundant

slender thistle
#

That's kinda stupid imo

#

Why reinvent the wheel when you get what you need

halcyon nymph
#

wdym

#

having

if message.content.startswith('prefix'):
    message.content = message.content.splice('prefix')

works

slender thistle
#

It's just plain weird to check prefix in on_message but define it as empty string in commands.Bot init

halcyon nymph
#

It doesn't do anything though, the only reason i kept it defined in commands.Bot was because that's the only way it'd work

slender thistle
#

Are you also using on_message with ifs for commands

halcyon nymph
#

yeah, python doesn't have switch's like node.js

slender thistle
#

...

#

What's the point of using commands.Bot then

halcyon nymph
#

idk

#

why fix what's not broken?

slender thistle
#

Why use commands.Bot when you don't even use its commands extension

halcyon nymph
#

idk, but i'm actually pretty confident that my bot needs on_message

#

and idk how to use the commands extension

slender thistle
#

Yes but why exactly commands.Bot when you don't use the built-in commands

halcyon nymph
#

what are the built-in commands

slender thistle
#

commands extension

halcyon nymph
#

???

#

Yeah

stone dust
#

bot class has an extension which handles commands automatically(?)

halcyon nymph
#

what does it do?

stone dust
#

so instead of writing all the if checks

slender thistle
#

Yes, hallo

stone dust
#

you can just kinda write functions and not worry about the if checking

halcyon nymph
#

okay

slender thistle
halcyon nymph
#

What's the point tho?

#

That's just formatting

stone dust
#

oh then don’t use it

slender thistle
#

Better looking code, better understanding of it

#

and an actual use of what commands.Bot was created for

stone dust
#

it’s entirely flexible and up to you

halcyon nymph
#

imo having all my commands in one continous if statement makes it more compact

stone dust
#

you can do whatever

slender thistle
#

Compact != Better

stone dust
#

whatever works for you though is best

#

readability may be a concern if you have several people working on it

halcyon nymph
#

i don't

slender thistle
#

Imagine all your ifs when you have more than 50 commands 👀

stone dust
#

if that works for you though then by all means

#

but definitely good to consider where you’re going

twilit rapids
#

Going through a lot of ifs does make it slower

hybrid ruin
#

Code is more than "if it works, it works" though, Alex

halcyon nymph
#

@slender thistle whats your point?

hybrid ruin
#

May you want to ask for help regarding a bigger class some time, it shouldn't scare other developers off

#

His point is that code goes from up to down, meaning it'll go through 30 if lines before it reaches the command you want, and then go through 20 more if statements to look for the right arguments and whatnot

#

It slows things down, it's not efficient and it's bothersome to read

halcyon nymph
#

yeah, but python does that in an instant

slender thistle
#
  1. Readability issues
  2. Importing commands.Bot when you don't use commands extensio
  3. Better and/or easier arguments handling
hybrid ruin
#

That's where you're wrong

stone dust
#

don’t worry about it then

slender thistle
#

Blocking is an issue there

#

If you have 100 users use one command and your code goes through all if statements at once, it's gonna be ineffective

hybrid ruin
#

Sending feedback to even 20 users at a time won't happen in an instant, I can guarantee you that

halcyon nymph
#

okay

#

I'll try it

slender thistle
#

Laziness < Better code

stone dust
#

@halcyon nymph if it’s worth the time for you to do so then definitely try it

halcyon nymph
#

Okay, i've glossed through the docs and I'm confused, if it works without on_message and doesn't need to be called by the program, I can't use it because my program recquires looping of on_message or otherwise i don't understand

indigo geyser
#

Heyo

halcyon nymph
#

hi

indigo geyser
#

What's the problem?

slender thistle
#

Why would you need to loop in on_message

halcyon nymph
#

I'm trying to fix my janky ass code so that it doesn't have to run through loads of if statements but I ain't sure if it even works with what I need

indigo geyser
#

If you use the on_message scommands doesen't work?

stone dust
#

@halcyon nymph how does it work currently? You mentioned the if checks but is there anything else on top of that

halcyon nymph
#

@slender thistle For the purposes of my bot, at the end of a succesful game the program would run

await client.on_message(message)
slender thistle
#

Uhh

#

Have another function to handle it?

halcyon nymph
#

@stone dust it just makes sure the message startswith my prefix otherwise returns and then yeah, a couple of if and elif statements

stone dust
#

yeah you may just want to write a different function to handle it

halcyon nymph
#

idk what that means?

stone dust
#

on_message is primarily reserved for handling incoming messages

#

so right now the bot is going to call on_message behind the scenes whenever a message is sent

#

(via web magic)

slender thistle
#

via websocket magic in this case

indigo geyser
#

This remindme the process command problem

#
await <>.process_commands(message) 
slender thistle
#

process_commands

indigo geyser
#

Fixed tnks

sharp current
#

OK, so this question is really about the server, but if my bot was approved, is it in this server

stone dust
#

yeah I think*

sharp current
#

OK

#

Because I keep doing one of my commands and I am getting nothing back

stone dust
#

might not be then i guess

sharp current
#

hm

#

Thank you

slender thistle
#

It could be kicked

covert turtleBOT
#

Your bot was likely muted because it broke one of the "bot rules" listed in #rules-and-info.

To find out why your bot was muted and by who, use the search feature in #mod-logs:

sharp current
#

Last mention I had was it being approved

#

And I have the PM as well

slender thistle
#

Approved != 100% for it to be in this server

sharp current
#

Ahhhhhhh

#

I see

#

thank you

halcyon nymph
#
import discord
import random
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import time

bot = commands.Bot(command_prefix = "!")
       
@bot.event
async def on_ready():
    print('ready')

@bot.command()
async def test(ctx, arg):
    print('running')
    await ctx.send(arg)

pretty much copied and pasted from the docs and it's still not working

#

I'm not getting any errors, but nothings happening when i run it

slender thistle
#

Does your bot contain imports like this?

from discord.ext import commands
from discord.ext.commands import Bot  # this one is redundant```

We regret to inform you that you're the latest victim of a bad youtube tutorial.
#

Aha

halcyon nymph
#

ok

slender thistle
#

Does print(discord.__version__) return 0.16.12

halcyon nymph
#

yes

slender thistle
#

Alright, even better

#

command decorator requires pass_context if you want ctx along with it

#

and it's <Client>.send_message for you

#

(commands.Bot subclasses <Client> so it doesn't matter which one you use)

halcyon nymph
#

Nope

#

still not running

#

just checking, it is bot.command(pass_context=True)

#

the docs doesn't say you need pass_context, so...

cold canyon
#

Can someone teach me py musicbit pls

#

If u can dm me

slender thistle
#

@halcyon nymph Yes they don't because that's 1.2.3 version docs and you are only on 0.16.12

halcyon nymph
#

I thought I was on the latest version

#

Anyway, can you link me to the 0.16 one then

#

I have no idea where to look for these kind of things

slender thistle
#

0.16.12 version docs don't have help for commands extension

halcyon nymph
#

?

#

So...

slender thistle
#

They don't explain the commands extension

copper cradle
#

update

halcyon nymph
#

so it's there

#

but, im stuffed if i actually want to use it

copper cradle
#

just update your version of d.py

halcyon nymph
#

DO I LITERALLY JUST HAVE TO GUESS?

slender thistle
#

Two choices:

  1. Find outdated examples
  2. Update and migrate to new discord.py version
copper cradle
#

No

#

you can update

slender thistle
#

Most functions are the same

#

API Reference is still there though

copper cradle
#

don't make things harder

halcyon nymph
#

Migrating sounds like effort

copper cradle
#

just

update

stone dust
#

it’s not too bad

#

a couple bugs may pop up but there’s also some info on migration in the documentation

slender thistle
#

Ah right, rw+ migration has that thing

halcyon nymph
#

yeah, but like, I only have 13 commands in my bot, if i get more I'll have a look at it again

#

But rn I can't be arsed

copper cradle
#

lol

stone dust
#

it’s just a speed bump

#

odds are you’ll have to get over it at some point and it’s just gonna build up

slender thistle
#

0.16.12 is discontinued anyway so it won't work at some point if Discord stops using the same API endpoints

#

or API version

halcyon nymph
#

I'll cross that bridge when i come to it

#

tbh, the only thing I use in 0.16 that isn't in the latest is client.send_message

wanton nova
#

hey guys quick question, for this server, would DMing a user if their (example, hunger value) gets less than 0 (which they can disable, but on by default) be allowed in this server?

slender thistle
#

That'd be considered unsolicited messages which we don't tolerate

#

Your bot would just get kicked for that

cursive dagger
#

maby if they have to run a command like "startlife"

wanton nova
#

okay

#

thanks guys

halcyon nymph
#

or it could be off by default and it's an opt-in feature

earnest phoenix
#

const dbl = new DBL('Your discordbots.org token', client); where would i find the token?

late hill
#

In the edit section of your bot page

little mural
#

hi, quick question... does permissions=0 work in the bot invite link? discordbots.org sets it like that by default

#

but i was under the assumption i need the "send messages" permission plus a few others

slender thistle
#

Yep it's fine

#

and it works

indigo geyser
#

In the on_message is there any way to return bot calls?

#

For fix respond to other bots

#

I know I have to doif message.author == ????

slender thistle
#

message.author = Member
Member = subclass of User
User = Has .bot property which returns a boolean value

indigo geyser
slender thistle
#

author.bot

indigo geyser
#

Oh, I thank user.bot

#

Thanks

slender thistle
#

not literally user.bot I hope

cold canyon
#
if message.author.bot:
    return```
#

@indigo geyser

slender thistle
indigo geyser
#

Yes yes I understood thanks

cold canyon
#

Np

earnest phoenix
#

How would I make the server count appear on my bot page?

indigo geyser
#

DBL api

earnest phoenix
#

I tried so much and it wouldn't work

indigo geyser
#

Oh

little mural
#

@slender thistle thx

slender thistle
#

Don't thank me

warm marsh
#

How long can a fields value be?

slender thistle
#

1024 characters

warm marsh
#

Per value?

slender thistle
#

Yep

warm marsh
#

Thanks!

#

Can you use code blocks in field value?

mossy vine
#

yes

#

field values fully support markup

warm marsh
#

Thank you.

earnest phoenix
#

Does anyone have a working example of the dbl api in discord.js

tulip wave
#

Read the docs

#

It has examples

lusty dew
#

Promise { <pending> }
How do I fix this problem

warm marsh
#

Await?

sudden geyser
#

Resolve the output, use from there

mossy vine
#

@lusty dew either use the variable in a .then() callback or await it

lusty dew
#

I am using it in a .then()

#
.then(res => console.log(res.json(message)))
mossy vine
#

async res => console.log(await res.json(message))

lusty dew
#

Mk

amber cobalt
#

I'm awfully confused at this part. Do i just copy and paste this code somewhere in my project? Do I save this as a file and import it instead?

mossy vine
#

do you know how maven or gradle work?

amber cobalt
#

I've used them only once in eclipse and I can't exactly remember how to access them

#

I vaguely remember something about a pom.xml file

earnest phoenix
#

How do I change the color of the box at the bottom?
(Where the description is) - everything changes instead of the color of it.

#

@amber cobalt You're using maven, copy the maven one in your pom.xml file.

amber cobalt
#

okay, I'll try looking for that

sick cloud
#

@earnest phoenix inspect element

earnest phoenix
#

What?

amber cobalt
#

f12

amber fractal
#

ctrl + shift + i

#

or that

earnest phoenix
#

Does it automatically apply after I change it?

amber cobalt
#

it should yea

earnest phoenix
#

But I already changed the background-color, it still doesn't work.

sick cloud
#

of what class though

earnest phoenix
#

Oh I see, but after closing the console it disappears.

sick cloud
#

that makes no sense

#

are you clicking save

#

or are you actually entering it in the inspect element

earnest phoenix
#

Ok got it, thank you.

amber cobalt
#

Okay so would that mean i'd need to make a maven project to get a pom file up and running? @earnest phoenix

earnest phoenix
#

Are you using Gradle or Maven?

amber cobalt
#

maven but I don't know which one is easier

unreal cape
#

Hey i have a problem

#

When i test my bot with and without perms all commands work, everyday

#

But when my bot gets reviewed some commands stop working all of a sudden

#

that's the second time now idfk what is happening

amber cobalt
earnest phoenix
#

I don't know how gradle works, sorry.

amber cobalt
#

ah okay

earnest phoenix
#
.column {
  float: left;
  width: 33.33%;
  padding: 3px;
}

This causes it.

#

But why?

#

I just used it like that:

<div class="column">
    <h1>English</h1>
    <img src="IMAGE-HERE">
  </div>
#

Alright fixed, changed the name. Looks like they got a class named like that too

sick cloud
#

column is the bulma class for grids

earnest phoenix
#

?*help

grim aspen
hybrid ruin
#

A bit late but that looks fine @amber cobalt

#

Just refresh gradle and it should work

haughty rose
#

@unreal cape I would suggest building in some logging

wheat carbon
#

I'm working on a userinfo function for my bot using RichEmbed, does anyone know how I would find more stuff in the .addfield part of it?

#

Found out how to show the user name but I want more stuff like time on server, roles, ect

earnest phoenix
#

addField is a method

#

it doesnt contain any information about the user

#

check out d.js docs to see all of the props a user has

wheat carbon
#

Ok

#

Thanks

earnest phoenix
#
#

Look properties

wheat carbon
#

Ok thanks a lot

#

Also when I use message.bulkDelete and then a number, it only does 1-10 messages and no more, is there a way to make it more?

#

For when I do =clear (Number of messages)

#

Message.channel.bulkdelete*

valid frigate
#

bulkDelete means it will mass delete messages, going above 10 would probably be considered api abuse

amber cobalt
#

making some progress @hybrid ruin but came across this error when I downloaded the library

tranquil drum
#

looks like you're missing gson

#

gradle didn't resolve dependencies ?

amber cobalt
#

hm, the only dependencies i have atm are the ones I copied from the github

#

Oh yeah and when compiling it, I was also told to download this pom file along with the library

#

is that what's missing?

tranquil drum
#

yeah but dbl lib needs gson

#

wait are you using gradle or maven?

amber cobalt
#

gradle

split lantern
#

@valid frigate Therae a Discord API endpoint for bulkDelete
allows to delete 2-100 Messages in 1 request, ( kinda 2 as you need to fetch the Messages before but yea )

tranquil drum
#

that's the pom for the library

#

what does your gradle config look like

amber cobalt
tranquil drum
#

weird

amber cobalt
#

I'm gonna restart eclipse

tranquil drum
#

im using maven in my project but i would assume gradle would resolve the dependency tree for any of your dependencies too

amber cobalt
#

That's what I thought

#

I don't know why i was linked a maven file when i was setting up the project through the gradle

tranquil drum
#

yeah that's weird

random ivy
#

Do I need to download anything

random ivy
#

question how do I make a bot like mee6

#

Do I need to go to another website

#

I want it kinda like mee6 but not at same time just close enough.

cursive dagger
#

Code

earnest phoenix
#

refer to the link above

random ivy
#

Y’all no help at all you keep giving same link I looked at all ready

earnest phoenix
#

you looked it, but have you read it

#

and by read i mean actually read, not skim over it

#

if you had read it you would have already had all the info you needed about your question ergo you wouldnt be complaining

hybrid ruin
#

What's the point in trying to explain the same thing if it's written out well and in more detail in an already-existing page

#

Guy straight up left

mossy vine
#

lmaooo

hybrid ruin
#

I bet he'll become a great dev

earnest phoenix
#

he'll create mee7 watch out

hybrid ruin
#

XD

#

Poor cry just wanted to help

pallid zinc
#

``` let fetched = db.fetch(prefix_${message.guild.id});
if (fetched === null) prefix = 'k.'
else prefix = fetched


```
#

err on else prefix = fetched

earnest phoenix
#

May i ask you to help me test an API i am writing?

pallid zinc
#

Ok

pallid zinc
#

U spelled it wrong

#

I mean Watching

tulip solar
#

chucks me an error thats its unreadable and Ik its cause of formatting but idk what format or how I should put the link for the picture inside the json file

slim heart
#

Well you’re doing ${} template outside of a template string

mossy vine
#

js has encodeURI and decodeURI functions, and what berry said

tulip solar
#

fixed it lol

#

thank you

cold canyon
#

Guys, I'm requesting emergency help
My bot was shut down because the hosting service was shut down. Is there another free hosting service that you know other than Heroku?

#

DM me pls

earnest phoenix
#

there's no good free hosting; don't use free hosting

#

either selfhost or buy a vps

warm marsh
#

@cold canyon, Your PC.

plush isle
#

how do I get client id

#

I only wanted to make my friend a bot TwT

cold canyon
#

Its the user id of the bot

#

turn developer mode on

plush isle
#

first of all im loving the Splatoon pfp!

#

and thank you

cold canyon
#

Settings => Appearance

#

thx

nova heath
slender thistle
#

Incorrect token

nova heath
#

i even made a new token and put it

#

for some reason it won't work

slender thistle
#

Check if you removed/added any characters

nova heath
#

Okay fixed it

earnest phoenix
#
GreenInklingToday at 2:34 PM
Its the user id of the bot```

client ID will not always be the same as the bot ID
cold canyon
#

It is

slender thistle
#

Didn't it use to be two different things before, @earnest phoenix

earnest phoenix
#

correct

#

oauth apps which have been created a long time ago and just now create a bot for example, will not have the same id

plush isle
#

whatever I did it worked

#

so

#

¯_(ツ)_/¯

#

lol I have no clue what im doing xD

unreal cape
#

i cant install psutil on linux for some reason

#

just gives an error

granite trout
#

I have my bot in two servers, how do i make it stop sort of cross posting the join and leave messages? :/

broken shale
#

check the guild id

maiden mauve
#

quick question for js

#

if your writing an object and want to refer to a variable inside

#

is it this.property

#

or just property?

broken shale
#

this.prop

#

for ex: js something : { thing1: 'lol' } You would access thing1 with something.thing1

maiden mauve
#
sting: {
        reqLevel: 1,
        mpCost: 2,
        errorStr: "Sting requires 2 MP.",

        cast: async (player, message, target) => {

            let spellDmg = Math.floor(player.maxHP / 20);
            target.currentHP -= spellDmg;

            await message.channel.send( `${player.name} casts **STING** on ${target.name}! Damage done: ${spellDmg}! Remaining HP: ${target.currentHP}/${target.maxHP}` );


            player.currentMP -= 2;

            return true;
        }
    },
#

yeah

#

so in my case here

#

${this.mpCost}

broken shale
#

yeah

maiden mauve
#

ty

broken shale
#

np

#

@maiden mauve it's actually sting.mpCost

#

object name**

maiden mauve
#

oh even inside the block?

broken shale
#

its always objectname.property

maiden mauve
#

I'll have to test it a little bit before I kill casting on my bot 😄

#

just cleaning up code

maiden mauve
#

that's definitely how you do it outside of the db

granite trout
#

im trying to make a command that sets the bots activity, ive done it kinda

#

atm i do !set blah and it sets to listening blah

#

but im trying to make it !set listening, to blah

pallid zinc
#
TypeError: Cannot destructure property `reply` of 'undefined' or 'null'.```
#

That it mean

granite trout
#

what

#

show the bit of bot code

maiden mauve
#

?

#

[clientname].user.setActivity("string"); no?

granite trout
#

@maiden mauve yes but how can i make a command that lets me set the type of activity and the actual activity

pallid zinc
#

It's send this err when I run k.eval let d = db.get(`prefix_${message.guild.id}`) message.channel.send(d) command in eval

maiden mauve
#

oh, you want to concatenate them?

granite trout
#

yeaaaah

#

kinda wanna do like !set listening, to ur mom

#

if not i guess ill just have to have 2 separate commands

maiden mauve
#

not sure, they may be reserved for the links with spotify etc

pallid zinc
#

Can u help me

maiden mauve
#
const spells = {
    test1: {
        prop: true,
        prop2: 2,
        func: () => {// this.prop, prop, test1.prop all "undefined"
            let var1 = spells["test1"].prop;
            let var2 =  spells["test1"].prop2
            console.log("Inside the block ",var1, var2);
        }
    },

};

console.log("Outside the block ", spells["test1"].prop, spells["test1"].prop2)
spells["test1"].func();
#

@broken shale

#

I guess it's just global only way to do it 😄

#

@pallid zinc Is that the express syntax?

#

undefined message means your variable isn't populating correctly

#

I'm not sure if "eval" has a built in async method

#

but that's usually the problem

#

in mongoose syntax it would be
let d = await db.findOne( {"dbVariable" : message.guild.id} );
message.channel.send(d);

#

Also try it in console first to avoid a roundabout error through discord

amber cobalt
#

@tranquil drum I'll do what you've done then

#

Is it just a case of making a maven project in your own project and doing everything from there?

tranquil drum
#

I use IntelliJ so it sets up the maven pom and project structure for me

amber cobalt
#

Ah right

#

Think last time I used maven, when I ran the project i was given options like install, build etc

#

I imagine i install everything first try and then i can just run it normally

tranquil drum
#

I think you can just mvn package

#

Install will copy it to your local repository which probably isn’t necessary

amber cobalt
#

ah okay, I'll try that out

amber cobalt
#

Hm, is it possible that i can't use the discordbotlistapi until my bot's been verified?

prime cliff
#

@amber cobalt yup

amber cobalt
#

that'sssss whyyyyyy

#

cause I'm trying to just show my server count but downloading the libraries just ain't working on my end

wheat carbon
#

Can someone help me?

#

Wait

tranquil drum
wheat carbon
#

@tranquil drum I'm trying to make a help menu

#

So I can use =help to show a menu (That works)

#

But if I do something like =help version it still only shows the help menu

tranquil drum
#

double check your logic for figuring out which menu to display

#

also make sure you're able to figure out if they typed =help version

wheat carbon
#

Help Menu:
case 'help':
const embed = new Discord.RichEmbed().addField('Help Menu', 'This is the help menu!');
message.channel.sendEmbed(embed);
Help Version menu:
case 'help version':
message.channel.sendMessage(version)

#

Shouldn't that work or do I have to use args?

hybrid ruin
#

You really have to use args

tranquil drum
#

what are you switching on

hybrid ruin
#

Looks like he's switching on the entire message

tranquil drum
#

if hes not though that would explain why both only show the help menu

hybrid ruin
#

The "issue" with that approach is that "help version" contains "help" so the first case will always trigger

wheat carbon
#

Args work like this right?
case 'help':
if (args[1] === 'version') {
message.channel.sendMessage(version)
}

tranquil drum
#

java doesn't have strict equals i dont think

hybrid ruin
#

Java does, js doesn't

#

Could you show a few lines above as well, please?

tranquil drum
#

wait is this java

hybrid ruin
#

No, js

#

XD

#

Wait

#

No, he's using const

#

Js

tranquil drum
#

i thought this was java the whole time lmfao

hybrid ruin
#

XD

#

You got me there as well smh

amber fractal
#

=== is strict in javascript

wheat carbon
#

I used Node.js and Visual Studio Code

hybrid ruin
#

Yeah js

amber fractal
#

you dont need strict in java because types

wheat carbon
#

JS is Javascript right?

hybrid ruin
#

Yep

tranquil drum
#

you can have ambiguous types in java

weary zodiac
#

🤦

tranquil drum
#

if args[] is populated correctly then that code would probably work

#

also consider converting to lower case before checking the arg so your commands aren't case sensitive

wheat carbon
#

So would this work:
case 'help':
if (args[1] === 'version') {
message.channel.sendMessage(version)
}
if (args[1] === 'ban') {
message.channel.sendMessage('You can ban a member by using example!')
}
if (args[1] === '') {
const embed = new Discord.RichEmbed().addField('Help Menu', 'This is the help menu!');
message.channel.sendEmbed(embed);
}
break;

inner jewel
#

if you split on spaces, switching over a single element won't work for args

hybrid ruin
#

Ehm

#

Use else if statements

wheat carbon
#

How?

#

Ohhh

hybrid ruin
wheat carbon
#

So wait a moment

tranquil drum
#

i think he's switching on args[0] @inner jewel

inner jewel
#

yes

#

which means case 'something with spaces' will never work if the input is split on spaces

tranquil drum
#

yep

wheat carbon
#

So this will work?
case 'help':
if (args[1] === 'version') {
message.channel.sendMessage(version)
} else if (args[1] === 'ban') {
message.channel.sendMessage('You can ban a member by using example!')
} else if (args[1] === '') {
const embed = new Discord.RichEmbed().addField('Help Menu', 'This is the help menu!');
message.channel.sendEmbed(embed);
}
break;

inner jewel
#

yes for the first two

tranquil drum
#

if you're actually splitting on space then args[1] won't exist

inner jewel
#

the last if can be just removed

tranquil drum
#

if you only type =help

wheat carbon
#

Oh ok

hybrid ruin
#
} else if (args[1] === '')  {```?
#

Yeah

wheat carbon
#

So delete the } else if (args[1] === '') {?

tranquil drum
#

just the if part

#

you can still use else

hybrid ruin
#

I think you could just make that the else

#
            } else {
                const embed = new Discord.RichEmbed().addField('Help Menu', 'This is the help menu!');
                message.channel.sendEmbed(embed);
            }```
tranquil drum
#

although you might get an array index oob

hybrid ruin
#

If the if statements from above are false, it'll simply send the default help message

#

So things such as help ffff will still work and display your help menu

tranquil drum
#

idk what js does if you reference an array index that doesnt exist

hybrid ruin
#

I think it'll just error out as well

#

Java coder, Teemaw?

tranquil drum
#

ya i only mess with js if i have to

inner jewel
#

js has no out of bounds error

wheat carbon
#

It works, Thanks lot!!!

tranquil drum
#

neat

hybrid ruin
#

Awesome

inner jewel
#
> const arr = "some string".split(" ");
undefined
> arr
[ 'some', 'string' ]
> arr[2]
undefined```
hybrid ruin
#

I see

#

@amber cobalt I missed your ping earlier, sorry. Did you figure out your gradle issue?

latent vault
#

hello who is can help me for rols

#

discord.js

#
return message.reply("You Have To Need This Role").then(msg => msg.delete(3000));
        };```

Hello First Sorry For My English 😃 İf U Have This Role U Can Use This Command

İ Dont Have Any Problem But İ want With Name İ Dont Want With Role İd 

How Can i Do This ??

İ Say Sorry For My Bad English Again
earnest phoenix
#

If I'm correct

hybrid ruin
#

I believe js has Guild.roles.find("name", "rolename")

earnest phoenix
#

if (!message.guild.roles.find(r => r.name === "rolename"))

hybrid ruin
#

Or that

earnest phoenix
#
//Replace role is with this
message.guild.roles.find(r =>["rolename"].includes(r.name))
#

that's also an option I think....

#

But the first 2 are guaranteed

#

Try all of them and see which ones work Kerem

hybrid ruin
#

Perhaps go with Puro's solution first, it personally looks like the "best" / most efficient one to me

#

All up to you though, hope it works

amber cobalt
#

No worries mate, I believe the problem is that my bot hasn't been verified which is why some dependencies weren't loading @hybrid ruin

#

So I'm just gonna give it a bit

hybrid ruin
#

Haha that doesn't have do to with anything as far as I know

#

Could you post your gradle file again, please?

#

Ah, the discord bot list dependency

latent vault
#

THX

hybrid ruin
#

Idk much about that

#

Glad it worked, Kerem

amber cobalt
#

I'm at the pub atm but I'll get stuff posted when I'm back home

opaque eagle
#

Imo I perfer dozby's solution

#

Puro uses an array which isn't necessary at all

hybrid ruin
#

Ah, makes sense

gritty bolt
#

How do I fix this, I literally dont have any other words

  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: './commands' }
/home/ubuntu/index.js:98
    let jsfile = files.filter(f => f.split(".").pop() === "js")```
                       ^
#

npm and node have just been sptting out errors errors errors

#

that arent on the host pc

#

that are*

#

but arent on mine

twilit rapids
#

The directory you want to get is not existing

#

no such file or directory

gritty bolt
#

but then whats the second part

#

whats looking for it?

twilit rapids
#

traceback

gritty bolt
#

waiiiiiitttt I get it im an idiot

#

sorry

twilit rapids
#

Do people even read errors these days sad

gritty bolt
#

im becoming numb to them

#

it didnt make sense on there

#

and npm has been killing me with errors

#

for 4 hours\

#

gg

twilit rapids
#

If you are getting errors for 4 hours you really are great at googling

gritty bolt
#

yeah I googled it and nothing came up

#

so i freaked out lol

#

btw it was a caps error

broken shale
#

js is case sensitive

amber cobalt
#

but I removed what I had as I was under the impression that what i did was wrong

hybrid ruin
#

Okay so

amber cobalt
#

can obviously bring it back tho

hybrid ruin
#

I looked into the DBL api as I never used it before

#

And yes you indeed need a verified bot first before you can use the api

amber cobalt
#

riiight, I thought so. Thank you so much for clarifying that

hybrid ruin
#

Any time

amber cobalt
#

I was honestly blowing a fuse at this project cause it was just a simple case of downloading a library

hybrid ruin
#

XD

#

Happens to the best of us

#

Feel free to ping me if you need anything else. Would love to help out a fellow Java coder

amber cobalt
#

It does, but at least I know I can wait a few days and know my bot will hopefully be verified

hybrid ruin
#

I hope so too

amber cobalt
#

but thanks again, I'm glad I'm not the only java coder here but I'll try and avoid spamming your inbox lol

hybrid ruin
#

What does it do so far?

#

Ah it's okay, I don't mind being "spammed"

#

Not a lot of people seem to code in Java. Most people crawl to Js / Python

amber cobalt
#

Both languages I have no idea how they work lol

#

but yeah the bot

hybrid ruin
#

XD

amber cobalt
hybrid ruin
#

Ohh

amber cobalt
#

it was the first time making a bot so I definitely needed more than a week

hybrid ruin
#

Already looking great

amber cobalt
#

but it seems to be all sorted

#

thanks man

hybrid ruin
amber cobalt
#

pitched the idea to r/vexillology and gonna see if they'll take it onboard

mossy vine
#

thats honestly a pretty cool bot

#

i like it

hybrid ruin
#

^

amber cobalt
#

aw thanks

#

the actual process of inputting each flag was a bit tedious

#

like it got to a point where I went over the class byte limit and had to completely restructure my program lol

hybrid ruin
#

Poor guy just wants to show some flags NotLikeThis

amber cobalt
#

I know 😢

#

at least that hard work is over now

hybrid ruin
amber cobalt
#

Don't even get me started on nepal's flag

#

scrapped that the moment it was done

granite trout
#

can someone help me making my bot work on multiple servers and not being retarded

#

i dont want it posting welcome messages in server1 if it was from server2

hybrid ruin
#

That flag though

#

Show code

amber cobalt
#

with what you want, that can be just by specifying the server id before hand

#

but if you want your bot to work on multiple servers in general, hashmaps are proper useful

granite trout
#

ooo what are hashmaps

amber cobalt
#

what language you working with again?

granite trout
#

js

hybrid ruin
#

Eh

amber cobalt
#

ah, then you would have a dictionary then

hybrid ruin
#

I don't think storing data of even 50 servers in a hashmap would be ideal, especially for this

amber cobalt
#

for welcome messages yea, you're right

hybrid ruin
#

I just save it in a database, but I don't know how complicated Modo wants to make this

granite trout
#

like super non complicated

#

its just welcome and leave messages

#

im thinking just serverid

hybrid ruin
#

Do you know the welcome message of both? You can easily hardcode this

#

Unless you have a way for server owners to change welcome channels and such

granite trout
#

nah the welcome message is the same

#

the only issue is that server2 joins are posting inthe server1 channel and its annoying

hybrid ruin
#

Do you know the channel IDs?

granite trout
#

yeah i did that but it still posts in that specific channel

#

with the joins and leaves of the other server

hybrid ruin
#

Well, show code perhaps

granite trout
#
// when a user leaves the server, announce it
bot.on('guildMemberRemove', member => {
  console.log('User has left the server!');
  let byemsg = `@${member.user.username} has left the server, what a pussy.`;
  bot.channels.get("563724381646487xxx").send(byemsg)
});```
amber cobalt
#

yeah, that's what happens with persistant data, it can get annoying

#

hm

hybrid ruin
#

Well, you're not checking which server it's from, and you're only sending it to 1 channel

granite trout
#

yus

amber cobalt
#

can't you just have bot.channels.get(event.getChanne()).send(....)

sick cloud
#

event.getChannel

#

java

hybrid ruin
#

Check if the guild's ID is x1

  • If it is:

Send welcome message in channel y1

  • If it isn't (else if)

Check if server ID is x2
Send welcome message in channel y2

amber cobalt
#

hehe, i can't write pseudo code okay

sick cloud
#

@granite trout that code can fail so much

amber cobalt
#

what thana said is good

#

but if you ever deal with storing server data in the future, have a look at dictionaries

mossy vine
#

@amber cobalt dictionary is python, not js

hybrid ruin
#

I can read js better than I can write it so I have no clue on what to tell you

amber cobalt
#

oh right, what's the js equivalent then?

mossy vine
#

objects maybe

amber cobalt
#

your guess is good as mine

hybrid ruin
#

XD

amber cobalt
#

man i should really have a look at js

sick cloud
#

js has maps and shit too

amber cobalt
#

oh, then there we go

hybrid ruin
#

But you get the point. You really just wanna check which server it's coming from and send a welcome message to the that specific server's welcome channel according to the server ID

mossy vine
#

plenty of shit

sick cloud
#
const things = new Map();

things.set('bob', 'meme');

things.get('bob');
// => 'meme'
amber cobalt
#

open bob show vagana

hybrid ruin
#

I love how Js sometimes looks so similar to Java, but then someone brings up const and shows the code after that and you just back off

amber cobalt
#

mhm, that's where the stuff becomes illegible

#

I feel the same when people use lambda expressions in their java code

sick cloud
#

lol

amber cobalt
#

those arrows just give me nightmares from C

hybrid ruin
#

Just be glad not every dev post their code on github

#

Saw someone who's here as well with just the messiest code. The more we went through the classes, the worse it got

mossy vine
#

roeesip my early code is pretty damn cursed

normal epoch
#

Hi there was a command to upload an image on a server glitch does anyone know you have it

hybrid ruin
#

Oh boy

amber cobalt
#

I know there was a random gif floating round on discord that crashed everyone on mobile

hybrid ruin
#

I swear I just can't code if I can't format my code properly

amber cobalt
#

Yeah, I even refused to skip one step of my bot because it was making my code so much messier

hybrid ruin
#

Wasn't that media crash issue fixed a while back?

#

Which step?

amber cobalt
#

Basically someone recommended i should combine the step where i randomly generate a country and the step which reveals the first emojis

#

sounds better in hindsight but it didn't work as well, but more importantly it was messy af

#

and hopefully that issue was fixed, probably not gonna test if it did

granite trout
#

when they leave the guildID is undefined 😦

hybrid ruin
#

Show code, please

#

As the event holds the guild id

granite trout
#

so event.guild?

hybrid ruin
#

Yeah, and get the ID from there

granite trout
#

i can't see that on the js docs and ive not heard/seen of event before

hybrid ruin
#

I'm not a Js coder but try event.guild.id?

amber cobalt
#

haha perhaps event is only java specific syntax

#

I'll look for the equivalent

hybrid ruin
#

Oh

#

Forgive me

#

Try if guild.id == whateverID:

amber cobalt
#

might be
if bot.guilds.get(id) == serverID

#

I'm not a js dev so don't quote me on it

mossy vine
#

thats.. not how js if statements work

sick cloud
#

you guys shouldn't be trying to help if you don't know yourself

granite trout
#

if im trying to post a message to a channel based on the channel name, does it work if the channel has emojis in it?

sick cloud
#

yeah you just need to provide the emojis in the name

#

ie. for #👍-votes it'd be channels.find((channel) => channel.name === '👍-votes');

amber cobalt
#

I said don't quote me lol

#

But you're right, sticking to java from now on

hybrid ruin
#

XD

#

I like your effort

amber cobalt
#

I mean if it works, it works

#

which it probably doesn't in this case 😂

tranquil drum
#

JDA devs poggers

amber cobalt
#

woop woop

#

will the real java programmers please stand up

sick cloud
#

any of you used canvas-constructor before and know how to fix this

#

(tiny images)

tight heath
#

make larger

sick cloud
#

how sad

valid frigate
#

upscale

tight heath
#

@sick cloud image.makeLarger()

#

can you hastebin your code

sick cloud
#

really

#

and sure

tight heath
#

no ofc not

#

and thanks

sick cloud
#

it's crap code

#

@tight heath pong

valid frigate
#

i thought that was py for a sec just bc of ctx

sick cloud
#

lol

valid frigate
#

you could just edit the message instead of deleting then sending another one imo

#

on line 59, just call m.edit and remove m.delete

sick cloud
#

you can't edit an attachment into a message

#

discord doesn't allow it

valid frigate
#

oh right

#

im dumb

sick cloud
#

yes mmLol

tight heath
#

no pong needed

#

I have no clue either

#

mmlul

valid frigate
#

ah

#

why are you using an http client to get the user's avatar lol

sick cloud
#

to get the buffer of the avatar

#

i can't remember any other ways

valid frigate
#

oh makes sense

#

well im not sure, sorry mmulu

topaz fjord
#

.displayAvatarURL returns a url with ?size=128

#

you have to use regex to change the 128 to whatever size in intervals of 64

amber fractal
#

On master you have options

sick cloud
#

@topaz fjord did nothing lmao

#

turns out its the radius

#

had to set it higher

copper cradle
#

that's confusing, I would still be stuck lol

pallid zinc
#
TypeError: Cannot destructure property `reply` of 'undefined' or 'null'.

It's send me this when I run
k.eval let d = db.get(`prefix_${message.guild.id}`) message.channel.send(d)

#

But only is some guild

#

Why no one is any server know the answer

full sparrow
#

its about reply?

#

i dont see .reply

#

@pallid zinc

pallid zinc
#

Yup

#

It only give this err in some guild

full sparrow
#

are you sure you're looking at the right line?

pallid zinc
#

Yup

#

It's a eval command

#

I check this with eval

full sparrow
#

well idk

pallid zinc
#

Lol

full sparrow
#

have you tried asking in plexi development?

pallid zinc
#

No one know

#

Yup

#

There also know one reply

full sparrow
#

they dont always reply

#

btw

#

do you know how .splitMessage works?

pallid zinc
#

Lol

#

Nah

mossy vine
#

your eval command is likely 🅱roke

full sparrow
#

ye

#

can anyone explain me how .splitMessage works?

pallid zinc
#

Nope

mossy vine
#

d.js?

full sparrow
#

ye

pallid zinc
#

I then tried this in my server it work fine

mossy vine
#

.splitMessage WaitWhat

#

what object

full sparrow
#

Util#splitMessage

mossy vine
#

oh

pallid zinc
#

Even in this guild it work

full sparrow
#

ye ik

#

but idk how to get it to work

mossy vine
#

it has everything you need to know

#

look at the return type roeesip

full sparrow
#

i tried split from messageOptions already

#

but that didnt work

pallid zinc
#

Does my question don't have answer

full sparrow
#

its broken

pallid zinc
#

How it work in this guild perfectly

#

Even in some guild it work

#

Only in some guild it give err

full sparrow
#

idk

pallid zinc
#

(node:5595) UnhandledPromiseRejectionWarning: TypeError: Assignment to constant variable.

#

One more err

#

```let fetched = db.fetch(prefix_${message.guild.id});

if (fetched === null){prefix = 'k.'

}else{ prefix = fetched}

full sparrow
#

Prefix is a const?

pallid zinc
#

What u mean

full sparrow
#

Did you do const prefix?

#

Or const fetched

pallid zinc
#

Fetched

#

And prefix both

granite trout
#

how can i add color to console.log (powershell console)

bright geyser
#

L

trail dagger
#

Is it even possible to overwrite the everyone role? role = discord.utils.get(ctx.author.guild.roles, name="everyone")

slender thistle
#

guild.default_role

#

Default role's name is @everyone

pallid zinc
#

```let fetched = db.fetch(prefix_${message.guild.id});

if (fetched === null){prefix = 'k.'

}else{ prefix = fetched}```

#

(node:5595) UnhandledPromiseRejectionWarning: TypeError: Assignment to constant variable.

trail dagger
#

Still didnt work well @slender thistle

pallid zinc
#

Err at }else{ prefix = fetched}

slender thistle
#

What do you even need it for

trail dagger
#

a lockdown command

pallid zinc
#

Custom prefix

#

Talking to ?

slender thistle
#

What's your code looking like currently, Emil?

trail dagger
#

its not a good code but i just started

    @commands.command(pass_context=True, name="lockdown")
    async def lockdown(self, ctx):
      role = discord.utils.get(ctx.author.guild.roles, name=ctx.guild.default_role)
      try: 
        for channel in ctx.guild.text_channel:
          await channel.set_permissions(role, overwrite=discord.PermissionOverwrite(send_messages = False))
        for channel in ctx.guild.voice_channels:
          await channel.set_permissions(role, overwrite=discord.PermissionOverwrite(speak = False))
          await ctx.send('🔒 Channel locked down. Only moderators may speak.')
      except:
        success = False
      else:
        success = True```
slender thistle
#

Uhhhh

trail dagger
#

yea uhhh

slender thistle
#

Does default_role tell you anything

trail dagger
#

does what tell me?

slender thistle
#

What do you think ctx.guild.default_role is

trail dagger
#

it is not right

#

that is what it is

slender thistle
#

have you seen what it even is

trail dagger
#

You said something about that being the everyone role

slender thistle
#

The role

#

not a name of anything

trail dagger
#

Thanks @slender thistle It works now

slender thistle
#

👌

earnest phoenix
#

Hello, I have a problem with my laptop. So this morning I decided to reinstall my pc (restore the factory) however, an error in full reinstallation occurs: We encountered an error when reinstalling your PC. However, no changes have been made.

I search the internet, but no help helps me solve my problems. How can I do it?
(For info I have a USB key to my reach but the problem is that my pc requires 8go more than I can not release)

#

is reinstalling your pc even a thing

#

reinstalling windows is

#

@earnest phoenix ok

#

I want to go back to factory, reset what @earnest phoenix

#

which os

#

i have windows 10 familly version @earnest phoenix

#

yeah

#

if that doesnt work, your drive is fucked and you need to do a clean install

#

which means you're required to have a copy of windows on a usb stick / cd drive

#

is the copy pirated

#

isn't exactly

#

but u know

#

is it, or is it not

#

It seems that I have corrupted files.

#

And in the log file (C:\$SysReset\Logs\setupact.log), i have this

#
LogSession: Reopened a log session at [C:\$SysReset\Logs]
ResetResumeLog: Reopened session logs in [C:\$SysReset\Logs]
ResetReturnToOldOS: Started
ResetReturnToOldOS: Tracing failure event
 ResetReturnToOldOS: Event traced successfully
 ResetReturnToOldOS: Tracing Boot State file [C:\WINDOWS\bootstat.dat]
Attempt to get BsdSummarize Diagnostic Information for bootstat file: \??\C:\$SysReset\Logs\ReturnToOldOS\bootstat.dat
BsdSummarize Diagnostic Information: BootLogInitCount:241
BsdSummarize Diagnostic Information: BootLogOsLaunchCount:170
BsdSummarize Diagnostic Information: BootLogErrorCount:300
 BsdSummarize Diagnostic Information: BootLogLastErrorEventCode:50
BsdSummarize Diagnostic Information: BootLogLastBootdiagErrorCode:0
BsdSummarize Diagnostic Information: HeaderPresent:1
BsdSummarize Diagnostic Information: BootId:330
BsdSummarize Diagnostic Information: LastBootSucceeded:1
BsdSummarize Diagnostic Information: FatalErrorCode:0
BsdSummarize Diagnostic Information: BootLogInitCount:0
Encrypt: Restoring original protection state
Encrypt: State file does not exist, assuming reset has not suspended protection on any volumes
ResetReturnToOldOS: Completed
#

@earnest phoenix

sterile laurel
#

Is that the blue screen of death

stray garnet
#


module.exports.run = async (bot, message, args) => {

const embed = new Discord.RichEmbed()
.addField("Username:", message.author.username)
.addField("Avatar URL", message.author.avatarURL)
.setColor('#ff9bbd')
message.channel.send(embed)

}
module.exports.help = {
  name: "avatar",
  aliases: []
}```

Sends the Link of the Avatar, but not the Picture.
sudden geyser
#

setImage

uneven rover
#

yes setImage(message.author.avatarURL)

stray garnet
#

Ok

sterile laurel
#

I need commands for Moderation bots

indigo geyser
#

@sterile laurel which language

sterile laurel
#

All I need is command ideas

west spoke
#

uh

#

if it's a moderation bot then its easy

stray garnet
#

and I thought I was uninspired....

wheat carbon
#

How could I make a purge thing? Right now I use message.channel.bulkDelete and that only deletes 1-10, is there a way I can purge more messages?

broken shale
#

message.channel.bulkDelete(input amount)

#

@wheat carbon

#

max is 100

wheat carbon
#

But if I do more than 10 the bot crashes

#

Example

#

If I do =clear 5 that works

#

But if I do =clear 11 or more it doesn't

broken shale
#

show code

wheat carbon
#

Can't right now but I'll ping when I can?

#

I know I used .bulkDelete

broken shale
#

okay but Im not here in 2 hrs

wheat carbon
#

Ok

broken shale
#

just follow it from d.js docs

hollow saddle
#

You’re probably not parsing the amount argument correctly

west spoke
#

^

#

What you can do (psuedocode):
split at the first space, then whatever that is, split it again at the first space, and use the first argument

#

That's what I do for multiple args

magic pine
#

hey guys mayne anyone can help me to add this ID 537047382752362512 in my server on discord ?
I don't know much about bots (practically nothing) , but i need to find this bot =p

swift topaz
#

question

#

why do I get args.replace is not a function?

amber cobalt
#

sounds like it would only work with strings

#

a toString() might fix things

idle basalt
#

args is (most likely) an array

hybrid ruin
#

Yeah, it always is afaik

#

You want to convert it to a string first and then replace whatever you'd like

#

Also, congrats on getting the bot verified, Jappy 02yay

idle basalt
#

i mean someone can make args a string variable but 99.9% of people use arrays

amber cobalt
#

thank you!! Got the message in the middle of work and was thrilled

idle basalt
#

args.join(' ') is likely what you want vic

wheat carbon
#

Can anyone help me with bulkdelete

#

This is my code but it can only delete 1-10 messages
case 'clear':
if (!args[1]) return message.reply('Error please define a 2nd arg')
message.channel.bulkDelete(args[1]);
break;

#

I want it to delete more

indigo geyser
#

@crude stratus

#

@grj/Rossi#4655 it isn't here

#

oof

wheat carbon
#

Can anyone help?

mossy vine
#

in eris does <Client>.channelGuildMap include all channels, even possibly uncached ones? (i have no clue how caching works in eris)
if not, how could i fetch a channel?

sudden geyser
#

Cyber28 you can use the <Client>.getRESTChannel method to fetch a channel.

#

of course if you have it enabled

twin kestrel
#

Hello everyone!

I have a command to add roles to members and I have a small problem, how can I check the position of the role I want to give, with the highest position of the roles in my bot?

trail dagger
#

what lib?

twin kestrel
#

discord.js

#

I've tried checking the documentation and I get nothing

trail dagger
#

then i am usless

#

but think something with >= or <=

twin kestrel
#

I already have the role position check (but I have to specify it) and what I want is to check if a role is more or not higher than the role of my bot

#

I don't know if I explain myself well xD

wheat carbon
#

This is my code but it can only delete 1-10 messages
case 'clear':
if (!args[1]) return message.reply('Error please define a 2nd arg')
message.channel.bulkDelete(args[1]);
break;
I want it to delete more

west spoke
#

well first it cant delete things over x days old

mossy vine
#

@sudden geyser is there any way without using rest mode?

earnest phoenix
#

I believe max is 100, but it can't delete stuff over 14 days old

sudden geyser
#

I don't think so

west spoke
#

There is a limit

mossy vine
#

hnng

#

that seems unfortunate

sudden geyser
#

Flaming don't you need to pass an integer, not a string?

west spoke
#

^

#

you do

sudden geyser
#

sometimes discord just works with a string, weird or the lib does that

trail dagger
#

is it a way to fix so if a bot uses the unlock command to unlock all channels is it possible so it doesnt do it to channels that already has send_messages as false before using the lock command?

west spoke
mossy vine
#

@sudden geyser actually, it seems to be working thonkku the channel im getting hasnt been connected to any events yet it fetched it perfectly fine

open dagger
#

Hi, i search one dev for support me with a personal little bot developing. i'm italian and my english so seriuosly bad but ok..

west spoke
#

um

#

what

amber cobalt
hybrid ruin
#

I'll be with you in a few minutes buddy

amber cobalt
#

thanks man

inner jewel
#

you're missing repositories

#

add jcenter() to the repositories block

#

you're configuring gradle to only use jitpack

amber cobalt
#

Tried what you said

#

apparently it can't be done with a jre alone

inner jewel
#

obviously

#

you need a java development kit to develop in java

amber cobalt
#

swear i had that installed tho

#

apparently not

#

maybe this was back on my laptop