#development

1 messages Β· Page 664 of 1

hybrid ruin
#

Haha yeah

#
repositories {
    jcenter()
    maven { url 'https://jitpack.io' }
}```
late hill
#

How would you prevent this if / else if hell

if (x < 3) return a;
else if (x < 5) return b;
else if (x < 10) return c;
else if (x < 15) return d;
...```
west spoke
#

that's a hard one tbh

wheat carbon
#

Hello?

#

Nevermind

abstract crow
#

Does anyone know how I can align text to the right side of a picture in HTML and CSS?

hybrid ruin
#

I guess that's exactly what you're looking for

abstract crow
#

Well not in the picture but like outside of it

hybrid ruin
#

Oh

mossy vine
#

use a table?

abstract crow
#

I thought you didn't need to

inner jewel
#

@late hill ```js
things = [
{value: 3, ret: a},
{value: 5, ret: b},
{value: 10, ret: c},
{value: 15, ret: d},
];
...

for(const {value, ret} of things) {
if(x < value) {
return ret;
}
}```

mossy vine
#

theres probably a way without tables

hybrid ruin
#

Did you look into the float attribute?

abstract crow
#

I I Text goes here

inner jewel
#

you can also make massive switches if that's your thing

#

otherwise it's if-else or something like that

#

or a massive lookup table if you don't care about memory

hybrid ruin
#

If you have

img {
    float: left;
}

p {
    float: right;
}```
#

And use these attributes, the image will remain left, text will stick to the right side

abstract crow
#

But do they both have to be in a div alone?

#

So a div for just the img and p

hybrid ruin
#

I don't think so

abstract crow
#

How does it know then what to float against? Like how does it know not to float to the left of something else?

hybrid ruin
#

Because you tell it to float to the right? πŸ‘€

#

The margins and divs are all up to you

#

It'd make things a lot better obviously

late hill
#

hm

#

I guess I could put the array in a json and avoid having all that in my main code

abstract crow
#

How can I center it though?

#

Wait I did float left and right and then did some padding, is that correct?

hybrid ruin
#

Should be fine

amber cobalt
hybrid ruin
#

You can use padding into any direction and could eventually use 50% to make sure it's always in the middle

#

padding-top on 50% should work

amber cobalt
#

oh wat, the java home is still jre-9

hybrid ruin
abstract crow
#

Puts the facebook like icon to the top left of the navbar instead of the bottom

opaque eagle
#

Ik this conversation ended a while ago

#

but about that if/else hell

#

that's why languages that are actually good have match statements and stuff for that

#

The only good JS solution I can think of are nested ternaries, but they get complicated quickly...

#
function foo(x) {
   return x < 3 ? a : x < 5 ? b : x < 10 ? c : d;
}```
inner jewel
#

an if-else chain is better than nesting ternaries

#

it's way more readable

opaque eagle
#

yeah but he wanted a "better" solution

mossy vine
#

i find if return way more readable

opaque eagle
#

i assumed he meant "shorter", since that was already pretty readable

valid frigate
#

i think for simplicity's sake you should just use if/else over multiple ternary operators

#

since x ? y : z is not restricted to a simple equation but that's what makes it easier to read

#

also vinnie your like button is floating to the right because you probably put it inside the same div which is floating right

abstract crow
ripe gyro
#

Can anyone make me a logo for free. If so dm me

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

west spoke
#

you want a logo? Make one.

#

Idfk how asking for a logo has anything to do with bot development

abstract crow
indigo geyser
#
await ctx.add_reaction('πŸ‡©')
```why this works on the on_message and no in commands (`AttributeError`)
#

resolved doing ctx.message.add......

valid frigate
#

vinnie

#

may i recommend uh trying to move the like button to the left by placing its element above your title, then floating it left

#

it's a really loose answer but it might work

opaque eagle
#

Ik this is a long shot but does anyone happen to have written css to produce a result like this:

#

I want to make a page look like a discord message, but i want it to be as close enough to discord as possible

earnest phoenix
#

look around in the DOM? \o/

sick cloud
#

i've done that @opaque eagle

stone dust
#

flex it

opaque eagle
#

it has a gazillion different css selectors and properties, and there must be a simpler way @earnest phoenix

#

@sick cloud GitHub/CodePen/JSFiddle?

sick cloud
#

i can dm you it

#

it's private ish

opaque eagle
#

oh ok, that's fine

stone dust
#

fonts are off but

#

it's "vague"

sick cloud
#

i could improve that a bit

stone dust
#

you probably could

sick cloud
#

do you know what font discord uses

stone dust
#

whitney

#

"Whitney,Helvetica Neue,Helvetica,Arial,sans-serif"

#

(i think)

sick cloud
#

yeah

mossy vine
#

isnt whitney like a private one or smth

stone dust
#

200 dollars from typography dot com

#

fontsgeek has it for "free" :-)

west spoke
#

um

#

this is development

sick cloud
#

you didn't see my switcher fail

#

ok

west spoke
#

:v

sick cloud
#

anyways i have a question
i have a lot of images to show in the bot that people can browse through then buy

what's the best way to display them

west spoke
#

Embed

#

Using a pager of sorts, that would work

tulip solar
#

Discord.js bots intensive on CPU or ram?

sick cloud
#

discord.js caches everything and uses a lot of memory

#

cpu usage depends on what you do

earnest phoenix
#

def cpu

#

try running a bot on an rpi you'll see it jumps from 1% to 50%

#

i mean you can do it on any computer

#

and see a spike

#

probably

#

idk

inner jewel
#

spikes when starting/etc are to be expected

#

what you should look at is the value after starting

tulip solar
#

thanks lovehug

covert tartan
#

make sure if youre using d.js, that youre using the optional libs as they make it use significantly less cpu

#

you can optimize ram usage a lot too in d.js (clientoptions + clearing the cache for stuff you dont use)

tulip solar
#

thank youuuu

restive night
#

may i ask about discord.js?
let say i have 5 chance to answer question, but when i do loop with for it send 5 message at the same time.
how to send it one by one with loop after answer message is collected?

quartz kindle
#

you have 3 options:
for loop with async/await
recursive function
setTimeouts with multiplicative values

jolly nova
#
async def kick(ctx, member: discord.Member,  *, reason=None):
      await member.kick(reason=reason)```
#

the kick cmd

normal raft
#

lol u need more

jolly nova
#

Nope i don't

#

This used to work

earnest phoenix
#

yes you do

normal raft
#

try that

earnest phoenix
#

they're not using d.js

#

and don't spoonfeed code

jolly nova
#

Thatz not the rewitten version

normal raft
#

conner if not using js then no help

jolly nova
#

lol

normal raft
#

python not as good

earnest phoenix
#

that statement is ridiculous

#

js is arguably worse than python

cursive dagger
#

^ i use python aswell. So i can help you @jolly nova

jolly nova
#

I mentioned the code above

cursive dagger
#

what is the error?

jolly nova
#

It sometimes returns nothing

#

I added has_permissions()

cursive dagger
#

so i dont kick the user?

jolly nova
#

Nope

cursive dagger
#

hm so no error

jolly nova
#

Ya

#

I have CheckFailure too

earnest phoenix
#

remember that it needs to respect the hierarchy

#

the bot's highest role needs to be above the user's highest role in order to kick them

jolly nova
#

Roles?

#

Ya i know that

earnest phoenix
#

a bot also can't kick the server owner

jolly nova
#

Yup i know that too noone can kick owner

stray garnet
#

Any Ideas how i could make an Shop System?

earnest phoenix
#

by writing code

hybrid ruin
#

Cry jumping in with the 40000 IQ

earnest phoenix
#

they asked a question with no detail, i provided an answer with no detail wesmart

hybrid ruin
#

@stray garnet Do you have a currency system?

stray garnet
#

Yes @hybrid ruin

#

im using d.js

hybrid ruin
#

Ah. I don't code in js so I can help you with the steps but nothing code-specific

#

You could start off by storing the shop items in a database of some sort. Make sure you give them an easy name as well, so you can search by both name and ID perhaps

#

Then you just want to make a command which displays all that (for loop) and depending on how you want them to be able to buy items, you can identify it by name or ID

slender thistle
#

@jolly nova Do you have an error handler in your code

split hazel
#

What would be the best method of making a small giveaway "timer" that edits every once a while?

#

I'd just want a concept because my current one is very buggy

#

And it speeds up a little after it passes a specific time

twilit rapids
#

Get the timestamp for when the giveaway should be ended, check once every minute or so if that time stamp has passed, if not return and check again in a minute. If it is then edit the message

split hazel
#

What could I do to make the timer edit "faster" after a specific time

#

I wanna do something close to giveaway bots timer

stray garnet
#

how to list all members in an role? im using d.js

earnest phoenix
#

what have you tried

stray garnet
#

nothing yet

hybrid ruin
#

Anything but googling

broken elm
#

hey uh

#

cant seem to access the things i want

#

i havent slept in like 24 to 26 hours

#

and arrays confuse me anyways... because theres so much going on

#

im trying to access avatarURL

#

data.metadata.avatarUrl is correct?

stray garnet
#

so in js it is message.author.avatarURL

#

if u mean that

shut wolf
#

hey

stray garnet
abstract crow
#

Does anyone know how I can setup express.js so that I can gave my directories like this

main_folder(website)

server.js, pages, images, etc.
And then when I type in url.com/page it will go to the pages directory and find that page name?

quartz kindle
#

you want to serve static files or you want to serve an express-controlled page/ejs/etc?

abstract crow
#

static files

quartz kindle
abstract crow
#

I tried that already

#

And it doesn't seem to work

#

I tried ./

#
      app.use(express.static('./'))
      app.set('views', path.join(__dirname, './pages'));
      app.set('view engine', 'ejs');
      app.get('/', function (reg, res) {
      })
sick cloud
#

use a folder

abstract crow
#

I don't want to though

#

That is why I am having the issues. I don't want to have github_repo_folder > public > files

sick cloud
#

express seems to shit itself with the root

abstract crow
#

Oooo ok

sick cloud
#

i wouldn't recommend using the root anyways

abstract crow
#

So then if I had public, then what would I do for the pages folder?

sick cloud
#

people can open your config and all

#

uh

#

pages is totally separate

abstract crow
#

Right but what do I do for my code

#

If everything but the server.js is in the public folder, andI have a pages folder inside of the public folder

#

app.use(express.static('./')) app.set('views', path.join(__dirname, './pages'));

sick cloud
#

remove the . from the 2nd line

abstract crow
#

Ok so just /pages

sick cloud
#

and set the static to assets or something

#

yes

abstract crow
#

assets?

#

Wdym

sick cloud
#

the folder you want static files to be served from

abstract crow
#

Ooo ok. So public in my case

sick cloud
#

yeah

abstract crow
#

And the pages folder will work being inside of the public folder?

sick cloud
#

but no ./

#

yeah

pallid zinc
#
 if (!args.slice(1).join(' ')) return message.channel.send('❌ please input a calculation.'); 
let resp;

try{

resp = math.evaluate(args.slice(1).join(' '));

} catch (e) {

console.log(args.slice(1).join(' ')) return message.channel.send('there was an ' + e);
 }
 const mathembed = new Discord.RichEmbed()
 .setColor('#7289DA') 
.setTitle('Math calculation')
 .addField('input', `\`\`\`js\n${args.slice(1).join(' ')}\`\`\``)
 .addField('Output', `\`\`\`js\n${resp}\`\`\``) message.channel.send(mathembed) 
break;```
sick cloud
#

you'll need /public/pages though

pallid zinc
#

Always send please enter calculation

abstract crow
#

Ok so for the views then do /public/pages?

sick cloud
#

yes

#

@pallid zinc args is undefined or your slicing it off, learn how js arrays work then look back at your code

abstract crow
sick cloud
#

because that's not how it works

#

add a route for that

abstract crow
#

It always worked for me though

pallid zinc
#

Don't talk like mad

#

How can other code with args work then

sick cloud
#
app.get'/pages/about', (req, res) => {

});
abstract crow
#

I never needed to do that

#

It always just worked

#

I also have app.get('public') if that does anything

sick cloud
#

that'll do nothing

#

and idk how because express just doesn't work like that

abstract crow
#

I just did it again. It works without the pages folder

full sparrow
#

4:38 PM

 TypeError: msge.awaitReactions is not a function

4:38 PM

    at Object.exports.run (./commands/helperino.js:66:6)

4:38 PM

    at Client.bot.on (./index.js:199:31)

4:38 PM

    at Client.emit (events.js:194:15)

4:38 PM

    at MessageCreateHandler.handle (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)

4:38 PM

    at WebSocketPacketManager.handle (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)

4:38 PM

    at WebSocketConnection.onPacket (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)

4:38 PM

    at WebSocketConnection.onMessage (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)

4:38 PM

    at WebSocket.onMessage (/rbd/pnpm-volume/e30f7175-fe1e-4630-912d-98d4c74e8aff/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:120:16)

4:38 PM

    at WebSocket.emit (events.js:189:13)

4:38 PM```

^  how do i fix this
#

discordjs btw

earnest phoenix
#

have you tried reading the error

full sparrow
#

it says its not a function

earnest phoenix
#

exactly

#

you're calling awaitReactions on a promise, not on the message

full sparrow
#

so like this?

                for (const r of reactions) {
                    const emoji = r;
                    const customEmote = bot.emojis.find(e => e.name === emoji);
                    
                    if (!customEmote) await m.react(emoji);
                    else await m.react(customEmote.id);
                }
    
  }).awaitReaction(filter, {time: 15000})```
earnest phoenix
#

think about it and then ask me again

#

the only difference here is that you're not storing it in a variable

earnest phoenix
#

can you rephrase everything you just said, it makes no sense

maiden mauve
#

Hmm, trying to solve a user input/object refactoring problem

#
objects = {

    object1: {
        aliases: ['o1', 'obj1'],

        test: () => {
            console.log('Object 1 found!');
        }
    },

    object2: {
        aliases: ['o2', 'obj2'],

        test: () => {
            console.log('Object 2 found!');
        }
    },
};

let userInput = "o1";

// input.test() is the goal if it exists.
#

I was looking at the "default" bot command handling

#

and thought I could mimic the concept with an object

#

I like the idea because it handles a variety of garbage inputs by simply not being apart of a collection/array

maiden mauve
#
for(let key in objects) {

    if(objects[key] === userInput || objects[key].aliases.includes(userInput) )
        return objects[key].test();
}
#

the aliases part of that works fine, but the "object name" does not, sort of making the object name pointless

#

πŸ€”

#

given that this whole experiment is to make code look prettier (a structure of objects rather than a bunch of functions from a switch tree)

#

I'm not sure im satisfied with that

inner jewel
#

you want to compare the key, not the object

maiden mauve
#

ahh that makes sense

#

ty

west spoke
#
         Integer json_2 =  Integer.parseInt(json);


        for (int i = 0; i < json_2;){
            json_2 += 1;
            String n__ = json_2.toString();
            ImageView imageView = new ImageView(null);
            imageView.setImageResource(R.drawable.ic_dashboard_black_24dp);
            LinearLayout relativeLayout = (LinearLayout) findViewById(R.id.linearLayout);


            relativeLayout.addView(imageView);
            //ImageView imageView = findViewById(R.id.PostImage);
            Picasso.get().load("http://neko-bot.net/posts/post" + n__ + ".png").into(imageView);

        }```
#

Im still fairly new to java, all strings are defined, but why does it crash. do loops not work like that?

#

oh

#

it wasnt even that

#

i fucked way the hell up

maiden mauve
#

it was not indenting the string definition in the discord code block

#

it all went down hill from there

#

πŸ˜„

west spoke
#

java doesnt need indents

#

:v

maiden mauve
#

I kid

west spoke
#

i think i may know what happened.

#

i fucked up on a icon i redid

#

and um

#

yeah

maiden mauve
#

I always laugh when people help me in here

#

and they ask "can I see what this function does?"

west spoke
#

xd

maiden mauve
#

then I reply "oh... shit.. nevermind"

west spoke
#

its supposed to display a image

#

but.. the icons for the bottom navbar were a little fucked

#

yep

#

im dumb

#

back to my problem now that it doesnt crash

maiden mauve
#

πŸ‘

west spoke
#

it doesnt even wanna load the image

#

haha

inner jewel
#

you're missing an i++

#

on the loop

#

it's an infinite loop so nothing will ever update since you lock the UI thread

maiden mauve
#

πŸ‘

inner jewel
#

also new ImageView(null)

#

you need to pass a context there

west spoke
#

yeah but i quite literally cant

inner jewel
#

you need to

#

if you can't pass a context, the code wont work

west spoke
#

its under a postexcecute

inner jewel
#

and?

#

you can just save a context in a field/whatever

west spoke
#

how would i do that?

inner jewel
#

by storing it in a field?

#

and passing the context in the constructor

west spoke
#

im sorry i dont understand that :I

#

oh

#

nevermind im dumb

#

as usual

#

whoooo now it frezes :D

tranquil drum
#

Probably because you increment json_2 and i at the same rate

#

It’ll never leave the for loop

#

As long as json_2 is initially set > 0

outer niche
maiden mauve
#

@outer niche Windows Key + Shift + S

outer niche
#

Thank you

#

That only pulls up the snipping screenshot part

maiden mauve
#

Yeah, so people can read your screenshots πŸ˜„

#

it copies it to your clipboard

outer niche
#

OkπŸ˜‚

maiden mauve
#

alternatively you can just paste code into discord

#

using " (code) "

outer niche
maiden mauve
#

much better

#

I don't know python but I'm sure someone may be able to help you

outer niche
#

Ok

weary zodiac
#

@outer niche Why are you typing this in the shell?

outer niche
#

to see what happens

weary zodiac
#

I don't recommend shell first off

#

Use command prompt or something

#

put your code in a .py file

#

and then open cmd in its directory and type python 'name of file'.py

outer niche
#

I don't know how to

weary zodiac
#

so make a new folder anywhere in ur pc

outer niche
#

All right I've got a new folder

weary zodiac
#

here lemme just call and screenshare to u what i mean

trail dagger
#

Why doesnt this save the data?

    async def setadminchannel(self, ctx,  alog: discord.TextChannel=None):
      if not ctx.author.guild_permissions.administrator:
        await ctx.send('You dont have permission to use this command')
        return
      else:
        with open("data/lockdown.json") as thefile:
          logs = json.load(thefile)
        documented =False
        for x in logs:
          if x == ctx.guild.id:
            documented = True
        if documented:
          logs[ctx.guild.id].append(alog.id)
          print(str(logs[ctx.guild.id]))
        else:
          logs[ctx.guild.id] = [alog.id]
        if not alog:
          await ctx.send(f"Admin channel removed")
        else:
          await ctx.send(f":warning: **Warning!** The data might be deleted at some point, because the bot is under development\nAdmin channel set {alog.mention}")
        with open('data/lockdown.json', 'w') as f:
          json.dump(adminlog, f, indent=4)```
slender thistle
#

Are you sure x == ctx.guild.id is ever True?

trail dagger
#

Idk

slender thistle
#

Also, do you really want to open a file on each command execution?

trail dagger
#

no

slender thistle
trail dagger
#

Do you know how to fix or not?

twilit rapids
#

If you don't want to open a file on each command execution, why did you code it to do just that. Or are you not that one who coded it but used ctrl c and v.

trail dagger
#

i didnt code it, a friend did

twilit rapids
#

Then ask your friend, they wrote the code and most likely know what's wrong.

trail dagger
#

Thats the thing, he doesnt know

#

I wouldnt ask here if he could fix it

slender thistle
twilit rapids
#

Alright then, what do you mean with not saving data. Does it store until reboot, does it not store at all, is it stored wrong?

slender thistle
#

Why don't you actually check if your if statements are true

twilit rapids
trail dagger
#

It doesnt store at all

slender thistle
#

(IDs are int, but not when you json.dump them)

#

Ans what is adminlog

trail dagger
#

a log

twilit rapids
#

Also, do you store and run everything as root shit?

#

Shiv*

#

Lmfao

slender thistle
#

shut, I know what I am doing mmulu

twilit rapids
#

I sure hope so, on thing wrong and someone bad has access to your root and can do everything meowblep

slender thistle
#

But Emil, what rxactky is adminlog? What type of object is it? Are you sure it, at the very least, exists?

trail dagger
#

It exists

slender thistle
#

Ysah dw Timo I ain't good no passwords on my VPS

trail dagger
#

async def on_ready(self):
  global adminlog
  try:
    with open('data/adminlog.json') as f:
      adminlog = json.load(f)
  except:
    adminlog = {}

def getjson():
  with open('data/adminlog.json') as rfile:
    data = json.load(rfile)
  return data```
slender thistle
#

Like I got some important things there anyway 02lul

twilit rapids
#

I understood close to nothing about that

halcyon nymph
#

Is there anyway to use on_message and the commands.Bot extension

slender thistle
#

Wdym

twilit rapids
#

And what about your bot token thinkderpmore

trail dagger
#

token?

halcyon nymph
#

on_message if defined anywhere means commands.Bot doesn't work

twilit rapids
#

That message was for Oswald

slender thistle
#

You know I can just delete the app or reset token

twilit rapids
#

True

halcyon nymph
#

I even updated to the the newest version and still nothing

slender thistle
#

Sigh

twilit rapids
#

Anyway, this is all python stuff bye

slender thistle
#

Do you know bot.process_commands, Allexx?

halcyon nymph
#

no

slender thistle
#

Right

halcyon nymph
#

I'm new to all of it

slender thistle
#

bot.process_commands is a function that accepts a Message object as its only argument

#

and it's a coroutine

halcyon nymph
#

so instead of on_message use process_commands

slender thistle
#

Uhhh

trail dagger
#

no

slender thistle
#

I never said it was an event

trail dagger
#

you use it at the end

#

of the on_message

slender thistle
#

It's just a function chadthonk

halcyon nymph
#

Okay

twilit rapids
#

Big brain shiv

halcyon nymph
#

I still don't get it, fam

twilit rapids
#

No coding language is easy

slender thistle
#

Okay but without the will to learn or simple knowledge of coding things it's not easy

halcyon nymph
#

I never said i was unwilling to learn

slender thistle
#

Either way, if you are sure you need on_message, use bot.process_commands in it

halcyon nymph
#

ok ty

#

nvm still broken

slender thistle
#

You can share some parts of your code ya know

halcyon nymph
#

Its ok

#

Btw, how do I have multiple or customizable prefixes with this setup

#

or is it just not possible?

slender thistle
#

Depends on how you set it up

#

if you give command_prefix argument in commands.Bot an iterable, it's multiple prefixes

halcyon nymph
#

@slender thistle

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

bot = commands.Bot(command_prefix = "s/")

@bot.command(pass_context=True)
async def msg_test(ctx, word):
    print('running')
    await ctx.send(word)
     
@bot.event
async def on_ready():
    print('ready')

@bot.event
async def on_message(message):
    if message.author.bot == True:
        return
    if message.content.lower() == '!test':
        await message.channel.send('test')
    await bot.process_commands(message)

Exluding my token on purpose

slender thistle
#

So far so good but pass_context is unnecessary

halcyon nymph
#

yeah, but i was told it's just standard

slender thistle
#

in older versions yes

halcyon nymph
#

to avoid confusion it's nice to always have it

slender thistle
#

in 1.0+ it's useless

#

as ctx will always be there for you

halcyon nymph
#

well either way, is it possible to have multiple prefixes?

#

or is it restricted to just the one?

slender thistle
#

Give command_prefix an iterable

halcyon nymph
#

a list, a dictionary?

#

or a generator object

slender thistle
#

Literally any object you can iterate through iirc

#

Let's dive into docs while we are at it

halcyon nymph
#

is there a way of making it so multiple commands call the same function in a way that isn't long-winded?

tranquil drum
#

Switch case?

#

case 1:
case 2:
case 3:
function();

halcyon nymph
#

I know how to in javascript, but more specifically python and using the commands.Bot extension

slender thistle
#

What would the func do

halcyon nymph
#

in the same way you'd call a function, say !test. but instead of !test you could also do !t and that function would hypothetically do the exact same thing as !test

slender thistle
#

There's aliases arg in command deco

halcyon nymph
#

really?

#

and you put in a list?

slender thistle
#

probably any iterable as well but I usually slap a list in

halcyon nymph
#

ok

#

ty

earnest phoenix
#

Hi, um just a java question:
I've created a filter with a few words in a database. I want to check if the message the user sents, contains just one string in the database. How can I check that?

twilit rapids
#

Java or JavaScript?

earnest phoenix
#

Java

#

done fixed

tranquil drum
#

Nice

mossy vine
#

does eris have internal sharding so i dont have to manually deal with them?

halcyon nymph
#

Does anyone know how to play sound files in discord.py? Is there a specific type of file I need? And what’s the command to run it in the latest version?

cursive dagger
#

@halcyon nymph it's in the repo, but you have to do some modifications to the example to not get it to play from only YT

halcyon nymph
#

@cursive dagger what’s the repo?

cursive dagger
halcyon nymph
#

@cursive dagger that’s for YouTube videos, i want to play audio from file

#

Do you know if it’s possible?

cursive dagger
#

@halcyon nymph discord.FFmpegPCMAudio is the thing you want

split raft
#

what's a shard

amber fractal
#

Sharding is the process of breaking up something into multiple instances

#

As to ease the load from one instance

#

A shard for a discord bot will handle a certain amount of guilds, while other shards will handle seperate guilds

slim heart
#

how can i poperly paginate through discord guilds

#

its always been a confusing thing with the before and after params like what am i meant to do

heavy spade
#

can i have some help

#

so i want to make a partner command

#

like this !partner (server name) (description) (link)

#

idk how to do that

quartz kindle
#

which language/library?

heavy spade
#

Java script

#

I am using visual studio code

quartz kindle
#

well, define how you want to delimit the fields

#

either set a delimiter like [server name] [description] [link] and use content.split() for example

#

or split it into multiple messages and use channel.awaitMessages() (assuming you're using discord.js)

heavy spade
#

I am using discord.js

#

So I want to put it in a embed format

#

What would that look like?

#

I am new to this don’t know everything

quartz kindle
#

first you need to get the data you need and split it into the appropriate fields

#

then to send it, you can use the richEmbed builder

heavy spade
#

So how would I do it so addfield and set description

#

To be filled out by the user

#

@quartz kindle

quartz kindle
#

use message

#

assuming that embed you made is being triggered by a user, his message will be available in message.content

#

you read message.content and extract information that the user wrote from there

heavy spade
#

Ok

maiden mauve
#

it's amazing how useful a second console is for testing interactions

#

just running a node compiler on a blank js

quartz kindle
#

i just run a clone of my bot in nw.js

maiden mauve
#

your little test screenshots encouraged me

quartz kindle
#

full access to the discord.js api through chrome's dev tools

maiden mauve
#

pretty lightweight testing platform

#

but it gets the job done to save other peoples time for questions

quartz kindle
#

well to test simple stuff like that i just use the browser xD

#

hit f12 and type away

maiden mauve
#

I've been on a refactor spree lately

inner jewel
#

btw you can add @echo off at the beginning of that rn.cmd file

heavy spade
#

When I type message.content

maiden mauve
#

seeing how many "neutral returns" I can get away with

inner jewel
#

so it doesn't write to the cmd window the commands it's running

heavy spade
#

It doesn’t come up with content

maiden mauve
#

ah ty again

heavy spade
#

I did

#

Says it’s not defined

quartz kindle
#

show what you did

heavy spade
#

I am just trying one thing idk if I am doing it right

#

It’s uploading

maiden mauve
#

filled out by user, where would the input come from?

quartz kindle
#

you know you can just copy/paste the code, no need to send a picture of it...

#

and even then, you could take a print screen

heavy spade
#

module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle('User Information')
.addField('Player Name', message.author.username)
.addField('Embed Version', 'version 1.0.0')
.addField('Current Server', message.guild.name)
.addField('Partner info', message.content, true)
.setColor(0xF1C40F)
.setThumbnail(message.author.avatarURL);
message.channel.send(embed);
}
};

maiden mauve
#

prior to setting the embed code you can define variables

#

then use them in the ${var} formation in embed

heavy spade
#

how would i define content?

#

const content = ??

quartz kindle
#

that message.content should work

#

the rest of the embed works?

heavy spade
#

yeah

#

i dont have message.content in them

maiden mauve
#

where do you want the users message to go?

quartz kindle
#

can you show the command you do and the response by your bot ?

heavy spade
#

i want it to go like this user types !p (title) (description) (link)

#

like that

maiden mauve
#

ok

heavy spade
#

for partner command

maiden mauve
#

so you gotta define those variables from the message

#

either by making args an array or otherwise

heavy spade
#

module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()

    message.channel.send(embed);
}

};

#

waht would i put there

maiden mauve
#

and then you can just concatenate them in your embed text

heavy spade
#

after i defined the vars

maiden mauve
#

.setTitle(args[0]);

#

.setTitle(`Your custom title: ${args[0]}`);

heavy spade
#

whats with the '

#

nvm

maiden mauve
#

just testing discord a bit hehe

heavy spade
#

lol

maiden mauve
#

` message ` in discord is markdown for a code line

#

message

heavy spade
#

oo

maiden mauve
#

but you can use backslashes as an escape character

#

\ `

heavy spade
#

hmm

#

after that

maiden mauve
#

anyhow, in js you can use ` ` to embed variables like i did

#

to avoid sloppy concatenation strings

heavy spade
#

ok

maiden mauve
#

so if the users message.content is "args", chances are "args" is an array of strings?

heavy spade
#

i am new as hell to coding so can you full out the command then go through what you did?

#

i am learning and been through tones of sights

#

but i am new to embeds

maiden mauve
#

haha the most useful thing you can do is get immediate output

#

test things in the smallest environment possible

heavy spade
#

hmm

maiden mauve
#

for example, find out exactly what is in the variables you are passing

#

console.log(message)

#

console.log(args)

#

you'd be surprised how big a message object is

#

πŸ˜‰

heavy spade
#

hu

#

so far i have this

#

module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle(args[0])
.setTitle(Your custom title: ${args[0]})
message.channel.send(embed);
}
};

#

ooooo

#

so if i do like

#

.setdesription(Your custom description: ${args[0]}

#

that means the user can set the des

maiden mauve
#

`Your custom title: ${args[0]}`; === "Your custom title " + args[0];

#

does that make sense?

#

its just a concatenation shortcut

heavy spade
#

like !p discordbotlist description then link

maiden mauve
#

you have put both titles in there πŸ˜„

#

an embed can only have 1 title

heavy spade
#

oooo

#

lmao

maiden mauve
heavy spade
#

module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle(Your custom title: ${args[0]})
message.channel.send(embed);
}
};

#

like that

maiden mauve
#

yeah that would put the first non-spaced string in title

#

you can have as many ".addField"s as you like

heavy spade
#

then i can type .setdescription(your custom description: ${args[1]}

maiden mauve
#

but the Title, etc is only 1 per

#

yes

#

it's all how you want to chop up the "args" variable

heavy spade
#

so what i typed would work?

#

so args 1 would workfor the description

maiden mauve
#

.setDescription(`Your custom description: ${args[1]}`);

heavy spade
#

ok

#

then same for link

maiden mauve
#

yup.

heavy spade
#

only .setfield

#

THANK YOU

maiden mauve
#

yeah, once you get a desirable result you'll want to re-read my link

#

it explains the rich embed in depth

#

the more you learn how it works the less stressful the smallest change is πŸ˜‰

#

Also remember it's just a variable until you send it

heavy spade
#

module.exports = {
name: 'embed',
description: 'embed',
execute(message, args) {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
.setTitle(Your custom title: ${args[0]})
.setDescription(Your custom description: ${args[1]})
.addField(Your custom link: ${args[2]})
message.channel.send(embed);
}
};

maiden mauve
#

test it out πŸ˜‰

heavy spade
#

@maiden mauve tank you

#

thank you

#

it workds

#

works

#

thank you so much

maiden mauve
#

if your new to programming js is a very forgiving language

#

make use of the console.log()

#

trial and error is very simple

#

if you are running bot through node/command prompt

#

adding " cmd /k " in the .cmd will keep the prompt open

#

so you can read why it crashed

opaque eagle
#

The forgiveness part is really true

inner jewel
#

you can just use pause

maiden mauve
#

5 characters vs 6 characters πŸ˜„

#

pause waits for enter key right?

#

I don't think I've looked up a dos command list in 10 years

#

speaking of forgiving, I'm still patting myself on the back for subtracting "false" from an integer

#

I have a variety of "Spells" that return true, false, or damage done

#

therefore,

#

if(!spell.cast()) catches all false returns

inner jewel
#

ideally you'd have a single type of return

maiden mauve
#

and playerhp - spell.cast() doesn't throw an error πŸ˜„

#

yeah, I just was looking for a single statement to work

#
        const spellReturn = await spell.cast(player,message,target);

        if(!spellReturn) // spell.cast returns false (text error sent to discord)
            return;
        
        target.currentHP -= spellReturn;
inner jewel
#

i'd add a test method to it

#

which returns whether or not it can run

maiden mauve
#

well, for example

#

that's an example of a integer return also returning false

broken elm
#

hey.. i need help with something really quick

#

completely disregard the app[worker]

#

thats hosting stuffs

#

but im trying to access the kills

#

by doing

#

well to access this array, i do data.data.stats

#

data.data.stats.metadata[1].value

#

would that work?

maiden mauve
#

everything being called metadata is confusing me

#

if your searching for something, you need to have some way to find it right?

indigo geyser
#
@teo.command()
async def unban(ctx, user: discord.Member=None):
  await user.unban(reason='No u')
```with this i can't unban because the member is not found, how can i replace that discord.Member?
shy turret
#

how do you create a server invite in a server a bot is in using server id? discord.js

hollow saddle
#

guild.createInvite iirc

grim aspen
shy turret
#

k

hollow saddle
#

Yeah channel.createInvite

#

my bad

shy turret
#
var serverid = "0000000000"
var server = client.guilds.get(serverid).id;
server.channel.createInvite()
  .then(invite => message.channel.send(invite.code))
  .catch(console.error);
#

am i right?

hollow saddle
#

channel would be undefined

shy turret
#

how do you get the default channel?

#

.defaultChannel

hollow saddle
#

That's depreciated

shy turret
#

oh opps

hollow saddle
#

It seems that you're getting the invite for the current server so can't you just do message.channel.createInvite?

earnest phoenix
#

yo

hollow saddle
#

Or is it a specific server

shy turret
#

specific server by id

hollow saddle
#

Ah alright

shy turret
#

how do u get the default channel (why am i such a bad coder)

#

well

#

first channel

hollow saddle
#

could use guild.channels.first() to get the first channel in the channel collection

#

So it would be const channel = client.guilds.get('id').channels.first()

#

and then channel.createInvite()

shy turret
#
var serverid = "0000000000"
var server = client.guilds.get(serverid).id;
var channel = client.guilds.get(serverid).channels.first()
server.channel.createInvite()
  .then(invite => message.channel.send(invite.code))
  .catch(console.error);
#

^ so this? ^

hollow saddle
#

channel would still be undefined

shy turret
#

why?

hollow saddle
#

you don;t need your server variable anywhere

#

Because if you use channel in that sense, it trys to get a channel from the guild object which doesn;t exist

shy turret
#

im kinda confused. what's the difference between "var variable = stuff" and just "variable = stuff"

#

nothing?

#
var serverid = "0000000000"
var channel = client.guilds.get(serverid).channels.first()
channel.createInvite()
  .then(invite => message.channel.send(invite.code))
  .catch(console.error);
hollow saddle
#

Well in that sense, var vaiable = stuff would be defining a variable and setting its value to stuff but variable = stuff would be nothing because you did not define it unless it was previously defined via let or var

shy turret
#

gonna test

hollow saddle
#

Yes

#

That's correct

shy turret
#

yah i saw and i realized ".get"

earnest phoenix
#

Help mi

shy turret
#

(yes i prob messed up my bot a lot)

earnest phoenix
#

Δ°am From Turkey

hollow saddle
#

Just ask

#

oh and he's gone

shy turret
#
var serverid = "xxxxxxxxxxxxxxx"
var channel = client.guilds.get(serverid).channels.first()
channel.createInvite()
  .then(invite => message.channel.send(invite.code))
  .catch(console.error);
{ DiscordAPIError: Unknown Channel
    at item.request.gen.end (/rbd/pnpm-volume/6f09de16-9aa5-49a2-a56c-e6ed935704bf/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
    at then (/rbd/pnpm-volume/6f09de16-9aa5-49a2-a56c-e6ed935704bf/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  name: 'DiscordAPIError',
  message: 'Unknown Channel',
  path: '/api/v7/channels/xxxxxxxx/invites',
  code: 10003,
  method: 'POST' }
#

epic

#
client.guilds.get("yes i did set this").channels.first().createInvite()
  .then(invite => message.channel.send(invite.code))
  .catch(console.error);
#

same error

#

nvm

#

found something

topaz fjord
#

@shy turret you don't find channel by server id lmao

gritty bolt
#

Im thinking of making a web dashboard for my discord bot, does anyone have any good resources? I was thinking of using express, vue, or react, but I don't know where to start. Can anybody point me in the right direction?

#

Mainly backend stuff

lofty hamlet
#

Hi how i can reset with quick.db all of my : db.get(`Mvote_${message.author.id}.vote`)

jolly nova
#

@slender thistle yup

heavy spade
#

module.exports = {
name: 'p',
description: 'p',
execute(message, args) {
const Discord = require('discord.js');
const p = new Discord.RichEmbed()
.setTitle(Your custom title: ${args[0]})
.addField(Your custom description: ${args[1]})
.addField(Your custom link: ${args[2]})
message.channel.send(p);
}
};

#

so i have that but when i type !p dadas then a space then type something it doesnt work

#

it only types one work

#

how could i fix that

slim heart
#

Explain what’s wrong and show us too

#

Also addField takes 2 arguments

valid frigate
#

i'm considering using lavalink for djs, is it worth it?

#

what im noticing is that lavalink seems to have some positives and negatives but i don't undestand them clearly yet

slim heart
#

W-

heavy spade
#

how can i make is so the user that is typing the description can use more than one word

slim heart
#

Join the rest of the args

inner jewel
#

resource usage should be way lower with lavalink/andesite (shameless self ad mmlol) than with ffmpeg subprocesses

valid frigate
#

afaik a ton of great music bots use a lavalink fork

inner jewel
#

and you can offload music to other servers instead of having it on a single server

valid frigate
#

you mean, run lavalink on a sepeate server?

#

sounds awesome tbh

heavy spade
#

so make the args that same

inner jewel
#

the whole reason lavalink exists is to do that

heavy spade
#

like args[2] then args[2]

valid frigate
#

also, are there any downsides vs just using the stream dispatcher

heavy spade
#

like

slim heart
#

Splice the triggering args/args u don’t want then do .join

inner jewel
#

Β―_(ツ)_/Β―

heavy spade
#

(Your custom link: ${args[2]}) then (Your custom description: ${args[2]})

valid frigate
#

lol probably just extra configuration

inner jewel
#

i've always used lavaplayer directly

valid frigate
#

ah fuck isnt it for java

heavy spade
#

i am new to java

inner jewel
#

yes

#

lavalink works from any language with a websocket client

valid frigate
#

a djs lavalink fork exists gonna try that out

#

oh wait im dumb

inner jewel
#

it's not a fork

#

it's a client

#

lavalink is the server

valid frigate
#

oh yeah thats why i said i was dumb

#

it's 11:20 at night rn

#

well thanks for uh giving me the benefit list

heavy spade
#

module.exports = {
name: 'p',
description: 'p',
execute(message, args) {
const Discord = require('discord.js');
const p = new Discord.RichEmbed()
.setColor(0xec0d0d)
.setTitle(Your custom title: ${args[0]})
.setDescription(Your custom description: ${args[2]})
.addField(Your custom link: ${args[2]})
message.channel.send(p);
}
};

#

how can i get .setDescription(Your custom description: ${args[2]})

#

to let the user send more than 1 message

#

like a full description not just like 1 work

#

word

slim heart
#

I told you

#

Splice and join

heavy spade
#

how?

#

i am new to coding

slim heart
#

If you don’t know what that means you need to go off and figure it out yourself

#

You need to learn

valid frigate
#

ok so basically

broken shale
#

Well that's a template literal that's missing 2 things

valid frigate
#

ok so help on lavalink

#

am i supposed to create the playermanager for each client (assuming they are sharded) or in the master process

earnest phoenix
#

Hey, i am getting an error on VPS:
Fontconfig error: Cannot load default config file

#

When trying to use Canvas

quartz kindle
#

install fontconfig

#

on linux itself, not npm

earnest phoenix
#

how do i

#

nvm

sinful lotus
#

@valid frigate if d.js lavalink, one shard = one player manager

#

if I remember correctly

#

cause I used that a while back ago

earnest phoenix
#

how do i

#

make my bot

#

leave all servers

#

its in

sinful lotus
#

d.js

Promise.all(client.guilds.map(g => g.leave())).catch(console.error)
west spoke
#

i believe this will work

#

but ima set it here.

#

It's all the things i do to get things that are in d.py rewrite into async.

slender thistle
#

isDm

outer tulip
#

anyone know how to add polls on discordjs

slender thistle
#

Is it really that hard to check if message.server is None

sinful lotus
#

probably use reactions

#

go search reactions, addReaction on d.js docs

outer tulip
#

yea and embed messages right

#

ok thanks chief meow

west spoke
#

:v

#

maybe it is oswald.

#

I havent gotten it to work before, without getting a error.

slender thistle
#

?????

#

How do you get an error on that? WaitWhat

west spoke
#

dont judge my methods

#

if they work they work

#

the nitro thing works fine pls gimme a break ;-;

#

nitro anything doesnt exist in async

tight heath
#

imagine not having Channel#type and TextChannel#nsfw

slender thistle
#

That one idc about but I'm rather shocked how you get errors out of nowhere

tight heath
#

why don't you just do

#

channel.type

#

@west spoke

slender thistle
#

if message.server is None
vs
if message.channel.type is discord.ChannelType.text thonkku

trail dagger
#

MongoDB Command raised an exception: TypeError: 'Collection' object is not iterable

#

The collection should be 100% right

slender thistle
#

Some code would help

trail dagger
#
  for x in mydb['Channels']:
    if x['Id'] == channel.id:
      return True
  return False
slender thistle
#

What do you think mydb['Channels'] is

trail dagger
slender thistle
#

Yes

#

It's a collection

trail dagger
#

yes i know it is

slender thistle
#

But you don't iterate through a collection chadthonk

#

You iterate through documents in a collection chadthonk

trail dagger
#

I dont even know what iterate means, english isnt my first language

#

I found out what it means

slender thistle
#

Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. chadthonk

#

So basically, it looks like collection.find is what you need

earnest phoenix
#

hi, how to find a category d.js ?

#

i do this :

#

let category = message.guild.category.find(u => u.name.startsWith("⭐ Stats du serveur"))

sick cloud
#

use it's id

#

and that isn't going to work

earnest phoenix
#

ok

#

but

sick cloud
#

guilds don't have a category object

#

you're looking for channels

earnest phoenix
#

But how do I get the identifier?

#

Knowing that the code can run in any server

sick cloud
#

then allow every user to set it instead of hard coding it

#

use a database

earnest phoenix
#

uh

#

ok

#

thx u

#

@sick cloud i can use that :

#

let variable_categorie = message.guild.channels.filter((channel) => channel.type === "category").find((cate) => cate.name === "⭐ Stats du serveur");

sick cloud
#

why did you mention me for that

earnest phoenix
#

it's a question sry

tight heath
#

you can, but if someone renames it only slightly ur kinda fucked

earnest phoenix
#

i use if(!

#

or catch

tight heath
#

if (!variable_categorie) return

#

also why let

#

isn't that a constant

earnest phoenix
#

yeah

tight heath
#

let me introduce to you: "const"

indigo geyser
#
@teo.command()
async def unban(ctx, *, member: discord.Member=None):

  bans = await ctx.guild.bans()
  
  for ban_entry in bans:

    user = ban_entry.user
    
    await ctx.guild.unban(user)
      
    emb = discord.Embed(title='Unbanned!', description=f'{member.mention} has been unbanned!', colour = 0xfffb00)
    await ctx.send(embed=emb)
```it does not find the member, how can i fix?
tight heath
#

it's never defined?

#

you're using user everywhere

#

and then suddenly member.mention

#

how is it supposed to know what member is

indigo geyser
#

user.mention?

tight heath
#

probably

slender thistle
#
  bans = await ctx.guild.bans()
  
  for ban_entry in bans:

You mean unban everyone basically

pallid zinc
#

(node:160) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

#

How to fix it ^^

stray garnet
west spoke
#

@tight heath that's rewrite docs tho?

earnest phoenix
#

@pallid zinc give the bot the missing permissions or handle it

tight heath
#

@west spoke I've never used d.py in my life so

#

@pallid zinc check if you have permission before doing something

#

i.e. ban

#

or sending message

#

etc.

west spoke
#

^

#

mine doesnt but but all admin actions require you to be in a "moderator list" for that server

opaque eagle
#

But the bot still needs perms to ban

smoky mica
#

@pallid zinc ur bot doesn't have permissions to do the command you want it to do

wind shore
#

DBL oy takip sistemiyle ilgilenen olur mu? Γ–zelden yazabilirsiniz.

earnest phoenix
#

speak english

west spoke
#

They are allowed to use native languages here

peak quail
#

xd

earnest phoenix
#

the rules say to speak english awhat

vestal crystal
#

Hello, whenever I press submit, this happens

#

Is for adding server

earnest phoenix
#

the error is on dbl's side, you can't do anything about it

vestal crystal
#

Ok, I have submitted my server

#

Now what do I have to do

#

It doesnt appear

latent vault
#

Hello First Sorry For My English , My Bot Have A Giveaway Command Does Work İm Using Uptime Robot For Bot Be 7 / 24 But Uptime Robot Sometimes Restart My Bot So Dont Finish The Giveaway What Can i Do Help Me Pls Maybe İts Can With .json But İ Cant 😦 Help Me

gray epoch
#
 await message.channel.send(`Type the title:`);
            const title = await message.channel.awaitMessages(res => res.author.id === message.author.id, {
                max: 1,
                time: 300000
            });

const embed = {
  "title": `${title.content}`,
}
message.channel.send(
{ embed });

return the title [objectMap]
can anyone help me to get the message content

latent vault
#

Hello First Sorry For My English , My Bot Have A Giveaway Command Does Work İm Using Uptime Robot For Bot Be 7 / 24 But Uptime Robot Sometimes Restart My Bot So Dont Finish The Giveaway What Can i Do Help Me Pls Maybe İts Can With .json But İ Cant 😦 Help Me

tight heath
#

you wrote that already

latent vault
#

yep

#

sry

#

i need help

west spoke
#

It will restart sometimes.

tight heath
#

@gray epoch title is actually a collection of messages

west spoke
#

You can store users in a json sometimes.

tight heath
#

you'd need to do title.first().content

#

:)

latent vault
#

do u want see the code ?

#

Giveaway code

west spoke
#

you can store it in json.

#

we arent gonna spoonfeed you

latent vault
#

json

#

but HOW

tight heath
#

actually

latent vault
#

OKAY BUT Δ° DONT KNOW

tight heath
west spoke
#

do you not know how to work with json

#

or any db

tight heath
#

better than json

#

and easy to work with

#

yw

west spoke
#

^

#

but json for beginners is better imo

tight heath
#

json is prone to failure

gray epoch
#

@tight heath thank you bro it works ❀

tight heath
#

yw

west spoke
#

It is, eventually.

pallid zinc
#

Yup

#

Json is easy

west spoke
#

I make most of my json owner-only and edit it manually most of the time.

pallid zinc
#

I think without json file we can't make bot

#

I am right?

west spoke
#

no

#

you dont need json for a bot

#

it's a database of sorts

tight heath
#

@west spoke you do that until the file corrupts and your db dies mmLol

#

first hand experience

west spoke
#

I have backups

pallid zinc
#

package.json

tight heath
#

also it's slow af

west spoke
#

meh true

tight heath
#

node works without a package

#

I don't need backups, I have replicas

pallid zinc
#

What about other module

tight heath
#

to publish a module to npm you need a package.json

west spoke
#

what I mean by backups are ones literally on mh website

pallid zinc
#

it's a json file

tight heath
#

and it's generally a good practice

#

but it's not needed

west spoke
#

since it will eventually be tied into the images

#

For example

pallid zinc
#

Can I store data on discord and use any time I want

#

With bot

west spoke
#

how many nekos total are stored in /nekos/neko(number).png

#

it's a very bad idea to

tight heath
#

imagine not having a seperate api path

west spoke
#

oh I do

pallid zinc
#

It's a bad idea

west spoke
#

/info/ is for api

tight heath
#

oh ok

#

that's quite the non-standard name

west spoke
#

meh

#

The info is in /users/

#

Since the part for my bot is about the webpage

tight heath
#

ok

#

how do I get an image from your api

#

as in what request

#

GET http://neko-bot.net/nekos/neko{ID}.png

#

gotcha

#

and GET http://neko-bot.net/posts/post{ID}.png

west spoke
#

Yeah

#

mhm

tight heath
#

but that's not an api

#

that's just a file storage

#

is it

west spoke
#

for the most for a random image

tight heath
#

also neko2 and neko3 are the same

west spoke
#

ik

tight heath
#

ye I got the total counts

west spoke
#

That's why I made the python lib skip them

#

since that was testing images

tight heath
#

oof

west spoke
#

I have python start at 10

#

Same thing for anime. 2 and 3 may be the same.

tight heath
#

oof

west spoke
#

Also, what lang do you use? If I could upload it to a sort of pypi or whatever for other langs that would be g r e a t

#

ima start on a js and java one next

tight heath
#

I use node.js

#

I can write a wrapper for that

#

Β―_(ツ)_/Β―

#

and publish it to npm

maiden mauve
#
const mySchema = mongoose.Schema( {
    property: String, 
    property2: String,
    inventory: {
        item1: { type: Number, default: 0 },
        item2: { type: Number, default: 0 },
        item3: { type: Number, default: 0 }
    }
} );
#

quick syntax question for mongoose

#

that would appropriately define a nested object correct?

#

mySchemaName.inventory.item1 ?

stone dust
#

been running into some network bottlenecks (discord.py) when attempting to use minikube to run the bot locally (both with kvm and on host os). anyone run into this as well? it appears that message events are not dispatched in a timely matter, but the function calls run properly

#

had similar problems when using just a vm but assumed it was due to disk issues (old 5400rpm hdd, performance was poor generally); current machine is on a fast ssd and still running into the same problems -- another assumption was network issues but it appears to run fine outside of the container environment on the host os

maiden mauve
#

if anyone wanted the answer to my question

#

πŸ˜‰

stone dust
#

@maiden mauve thank you for the update

maiden mauve
#

πŸ˜„

sage bobcat
#

One message removed from a suspended account.

tall bobcat
#

do u get the bot dev role when ur bot gets accepted

#

lol

#

or do i apply

#

like what do i do

loud salmon
earnest phoenix
#

webhookAuth is how to get?

quartz kindle
#

in your bot edit page

tall bobcat
#

how do i get the bot dev role

#

i cant find it in faq

quartz kindle
#

you get it automatically when your bot is approved

tall bobcat
#

ohok

sage bobcat
#

One message removed from a suspended account.

late hill
#

I swear you've posted this before..

#

If gold doesn't exist you're creating newGold but continue to work with gold (which still won't exist), that's your error

#

Other than that

#

Just as I remember saying previously

#

You're mixing userId and userID

#

I also question if you have a reason for the gold to have it's own model

#

To me, it seems like it would fit very well on your Account model, but maybe you have a reason for not doing this 🀷

#

(There's also the inconsistent usage of ; and a random global variable grrr)

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.