#development

1 messages · Page 756 of 1

lusty dew
#

It’s empty cause there are no files in that folder yet

slender thistle
#

You don't need to make it an array

#

Loading cogs works the same way as python imports

lusty dew
#

I didn’t mean to make it an array

#

But how else else would i do it

#

Just a plain string?

west raptor
#

@opaque eagle you mind sharing your (neo)vim configs?

slender thistle
#

Mind not spoonfeeding

#

ty

golden raven
#

this might remove the extension

lusty dew
#

I don’t want code

#

I want to be led in the right direction

west raptor
#

@golden raven dont spoonfeed

#

thanks

slender thistle
#

If you want to load example.py cog from cogs.fun, you just load it as "cogs.fun.example"

lusty dew
#

Yes

#

How though

golden raven
#

@west raptor sorry

slender thistle
#

"how" what? How to load the cogs?

lusty dew
#

You’re saying not to save the file names as an array

slender thistle
#

No, you're just putting the []'s in strings when not needed

lusty dew
#

Okay

golden raven
#

@west raptor sorry

#

@lusty dew sorry

lusty dew
#

How do I remove the [] in the string

west raptor
#

you dont need to ping me twice

slender thistle
#
    tempList = []
    for files in os.listdir(newPath):
        file = os.path.splitext(files)[0]
        tempList.append(file)
lusty dew
#

I think he meant to ping me April

golden raven
#

sorry

lusty dew
#

Okay what about that code snippet

#

I’m assuming me appending file to an array

#

Makes the []

slender thistle
#

You're creating an empty list, iterating through files in newPath, getting the filename without extension, appending to the empty list you created before, and then append that entire list to cog_list

lusty dew
#

Yes

slender thistle
#

Is that the code you currently have

lusty dew
#
 cog_list = []
# for folder in os.listdir(defaultPath):
#     newPath = f'{defaultPath}/{folder}'
#     tempList = []
#     for files in os.listdir(newPath):
#         file = os.path.splitext(files)[0]
#         tempList.append(file)
#     cog_list.append(f'cogs.{folder}.{tempList}')
#

I have it commented out in my files

#

but that is my current code

slender thistle
#

You're adding the list itself to the last string

#

the one as arg of cog_list.append

lusty dew
#

What?

slender thistle
#

cog_list.append(f'cogs.{folder}.{tempList}')
See the {tempList} there?

lusty dew
#

Yea

slender thistle
#

You're adding the list itself

#

To be quite honest, you could just iterate over os.listdir(your_path), remove the extension, and append to cog_list directly

lusty dew
#

Wait

#

I’d only have to iterate once?

slender thistle
#

Pretty much, yes

#

You could ignore lists and loading on the go

lusty dew
#

I’m trying to figure this out myself

#

But I’m stumped

#

How would you go about doing it @slender thistle

#

Nothing I seem to try will work

slender thistle
#

GIve me a few minutes

lusty dew
#

Okay

slender thistle
#
for file in os.listdir(your_path): # iterating through cogs
  cog_name = file[:-3] # removing the file extension (".py")
  bot.load_extension(f"cogs.{cog_name}") # loading the cog
fast wagon
#

what are some cheap and good hosting stuffs

fluid basin
#

check pins

lusty dew
#

Bruh

#

Why didn’t I think of that

#

@slender thistle I don't think that would work

#

sense inside cogs is a bunch of folders containing the commands

slender thistle
#

A cog is a file that can contain multiple classes

#

In our case, we have one class but with multiple commands

lusty dew
#

No

slender thistle
#

Oh, you mean that

lusty dew
#

in my case

#

I have folders with files for each individual command

slender thistle
#

I'd really suggest putting all the commands under one class

lusty dew
#

I don't like that though

#

It seems tedious

#

if you have 30 plus commands in one file

#

and one bugs out

#

you will have a hell of a time finding that command

#

at least I would since I misread things a lot

slender thistle
#

I've been doing that since I started using cogs and never had a problem with debugging a command

lusty dew
#

I am dyslexic

stable horizon
#

Didn't you.... already ask this in 2 other servers?

lusty dew
#

I have a hard time reading things so close together

#

No @stable horizon

stable horizon
#

Hm

lusty dew
#

but it wasn't much help

#

I would ask for help and all I would get back is "Ask google" i look on google can't find what I need and ask for help again and they would tell me the same thing

stable horizon
#

Iirc we told you either to put everything in the one folder, or that you couldn't just import the subfolder, cause that isn't how python imports work

lusty dew
#

I highly doubt those are my only options

slender thistle
#

Import (python) or load (d.py)?

stable horizon
#

Misunderstood, ignore

lusty dew
#

Okay

slender thistle
#

Which imports do you mean?

lusty dew
#

I guess I will have to figure it out myself

#

🤷

slender thistle
#

Are the files named the same as the folders, DyingLight?

#

aka would it be cogs.fun.fun, cogs.mod.mod to load?

lusty dew
#

no

#

they are named after what the command does

#

why would I name them after the folder

#

🤔

stable horizon
#

You have a cog per command?

#

This seems an over complex way to do things

lusty dew
#

I am trying to basically make a command handler

#

and split the commands up related to the folders

stable horizon
#

I rest my case

earnest phoenix
#

i have a command handler not the best but works great i send it a bit

lusty dew
#

No

stable horizon
#

Just use the build in commands extension

#

Best one out there

earnest phoenix
#
bot.commands = new Collection();
bot.aliases = new Collection();

let table = new ascii("Commands");
table.setHeading("ID", "Category", "Command", "Aliases", "Load status");

let CmdID = -1

fs.readdirSync("./commands/").forEach(dir => {
  fs.readdirSync("./commands/" + dir + "/").forEach(file => {
    let cmdFile = require("./commands/" + dir + "/" + file);
    CmdID++
    if (cmdFile.name) {
      bot.commands.set(cmdFile.name, cmdFile)
      if (cmdFile.aliases.length >= 1) {
        cmdFile.aliases.forEach(alias => {
          bot.aliases.set(alias, cmdFile.name)
        });
      };
      table.addRow(CmdID, cmdFile.category, file, cmdFile.aliases, "Loaded successfully");
    } else {
      table.addRow(CmdID, dir, file, "", "Error 404 command did'nt load successfully");
    };
  });
});

console.log(table.toString());
stable horizon
#

Wrong language

#

Lol

warm marsh
#

Lmal

#

That's js not python...

earnest phoenix
#

its a command handler

stable horizon
#

For js

slender thistle
#

Pure spoonfeed at this point even if it's an unrelated language

earnest phoenix
#

i never never said this command handler is python i just said i have an command handler

stable horizon
#

But...

slender thistle
#

Well why would it be related to this conversation

stable horizon
#

We're on a python topic?

stable horizon
grave mist
#

I need those commands, donate ... to be in upper line

stable horizon
#

Well it can't be easy can it?

#

That would be too simple

earnest phoenix
#

send the css?

grave mist
#

And Why use Amazing? to be in next page more like the main content covers 1 whole screen and that goes below it

#

Wait

#

I kinda complicated maybe

#

That's html for the navbar

#

That's css for navbar

lusty dew
#

Screw it

#

I will just let my eyes suffer

#

xD

earnest phoenix
#

ok let me try to a webpage with this and try to find solusion

grave mist
#

Lol

#

display:inline; should work afaik but it isn't working

lusty dew
#
discord.ext.commands.errors.CommandNotFound: Command "kick" is not found```
#

What am I doing wrong

#

I am so close to just giving up

stable horizon
#

The command isn't found

lusty dew
#

I have relooked at the cogs example

#

I have done exactly what it says

earnest phoenix
#

How are you loading the cog?

#

@lusty dew

lusty dew
#
initial_cogs = [
    'cogs.owner',
    'cogs.mod',
    'cogs.fun',
    'cogs.general'
]

if __name__ == '__main__':
    for extensions in initial_cogs:
        client.load_extension(extensions)
earnest phoenix
#

and what are your cogs names

#

Like file names

lusty dew
#

owner, mod, fun and general

earnest phoenix
#

Can you send photos

#

And send the code of one of your cogs

lusty dew
earnest phoenix
#

Okay send code of a cog

lusty dew
#
import discord
from discord.ext import commands


class ModCommands(commands.Cog):

    @commands.command()
    @commands.guild_only()
    async def test(self, ctx, member: discord.Member):
        await ctx.send(f'{member.display_name} was kicked!')


def setup(client):
    client.add_cog(ModCommands(client))
earnest phoenix
#

Add py def __init__(self, bot): self.bot = bot self._last_member = None to the class on each cog

#

And are you using client or bot?

lusty dew
#

What does that do

#

I am using client

earnest phoenix
#

use bot

lusty dew
#

why

#

what matters if I name it client or bot

earnest phoenix
#

Bot has a built in commands framework

golden raven
#

i have one doubt, which is best
Putting all commands in cogs
or
some in main.py and some in cogs
or
all events in main.py and cmds im cogs

earnest phoenix
#

@golden raven separate them into groups of cogs

lusty dew
#
class StarClient(commands.Bot):
    async def on_ready(self):
        print('Logged on as {0}!'.format(self.user))

    async def on_message(self, message):
        print('Message {0.author}: {0.content}'.format(message))
        await self.process_commands(message)


client = StarClient(command_prefix="p$")
earnest phoenix
#

So they can be loaded and unloaded with ease

lusty dew
#

Again why does it matter if I name it client or bot

earnest phoenix
#

Ok you're doing something funky

lusty dew
#

How

golden raven
#

@earnest phoenix ok let me organise them

earnest phoenix
#

@lusty dew you should follow this tutorial it helped me alot.

golden raven
lusty dew
#

Why do I have to name it bot

golden raven
#

it has more than 200 lines

earnest phoenix
#

firstly I don't think doing a class is right

lusty dew
#

It is

earnest phoenix
#

like I don't know if it works

lusty dew
#

It legit is an example on the docs for d.py

#

😂

earnest phoenix
#

ok well I don't do it that way so idk

lusty dew
#

Okay

#

Just cause you don't do it that way doesn't mean ima change it

stable horizon
#

You need to be using commans.Bot

#

What you name it is up to you

lusty dew
#

Yea

earnest phoenix
#

But addpy def __init__(self, bot): self.bot = bot self._last_member = None

stable horizon
#

No

#

That's also optional

earnest phoenix
#

But change bot to starclient

lusty dew
#

Why not just client

#

client is set to StarClient\

#

xd

stable horizon
#

It doesn't matter what it's named

earnest phoenix
#

Ok then client

lusty dew
#

Again

#

what does that even do

#

I am not going to use something if I don't know what it does

earnest phoenix
#

Sets self.bot to bot and last member to none

#

its in the cogs exactly

stable horizon
#

You don't need last member

earnest phoenix
#

i use it

lusty dew
#

Wow thanks for explaining

#

great explaination

earnest phoenix
#

bruh I'ma be honest

stable horizon
#

So?

earnest phoenix
#

Don't know what it does

golden raven
stable horizon
#

Just cause you use it doesn't mean others need to

earnest phoenix
#

But it makes it work

stable horizon
#

Smh

lusty dew
#

Why can't I just get help

#

Actual help

earnest phoenix
#

ok fine y'all help them

slender thistle
#

Conflicting advices

stable horizon
#

I'm tryina help

lusty dew
#

Yes I know

#

Fiery is telling me things that he doesn't even understand

stable horizon
#

OK. Your command isn't found. We're still there yes?

lusty dew
#

Yes

earnest phoenix
#

did you get any other errors?

stable horizon
#

Ok. So most likely you haven't loaded the cog

earnest phoenix
#

like a reason it wasn't loaded?

lusty dew
#

Hm

#

What would make it not load?

#

Cause I am doing what the tut says

slender thistle
#

You not loading it or an error

earnest phoenix
#

did you see any other errors when loading it

lusty dew
#

only errors I get is no setup func in other cogs

#

and the no command

earnest phoenix
#

I feel like it's Todo with self

stable horizon
#

I dont

slender thistle
#

__init__ is optional

lusty dew
#

what does it even do

stable horizon
#

self?

lusty dew
#

no

#

__init__

stable horizon
#

Uh

slender thistle
#

basic Python stuff

stable horizon
#

Basic py

lusty dew
#

I know

#

but I never understood it

slender thistle
#

I suggest you Google that after this issue is solved

stable horizon
#

?rtfm py classes

#

Wait wrong server

lusty dew
#

wrong server

#

XD

stable horizon
slender thistle
#

🤣

#

Nice one

lusty dew
#

Honestly

stable horizon
#

Yeah google it

lusty dew
#

should add that bot

#

it'd be helpful

#

xd

#

anyway

stable horizon
#

Make sure you call super Init then

#

Can you show us the code for loading modules?

lusty dew
#

loading the cogs?

stable horizon
#

Yeh

lusty dew
#
initial_cogs = [
    'cogs.owner',
    'cogs.mod',
    'cogs.fun',
    'cogs.general'
]

if __name__ == '__main__':
    for extensions in initial_cogs:
        client.load_extension(extensions)
stable horizon
#

You're getting an error before you get to cogs.mod most likely

earnest phoenix
#

you do need to have a setup in each cog

stable horizon
#

I'm ignoring other cogs for now

lusty dew
#

I know this

#

I just haven't gotten to making commands for mod, fun or general

#

I am focusing on owner

stable horizon
#

You showed the code for mod tho

lusty dew
#

Oh wait yea

#

my bad

stable horizon
lusty dew
#

I haven't gotten to fun and general

#

😂

#

I am close to giving up on python

#

and going back to js

#

😂

#

This is making my brain hurt

earnest phoenix
#

How much python do you actually know

lusty dew
#

Some basics

#

Anyway I gtg

earnest phoenix
#

you should probably learn more python before continuing

lusty dew
#

🤔

#

How much python do you know

stable horizon
#

Reset here. What command are you attempting. And which module is it in. And is that module actually loading.

lusty dew
#

Can't even understand something you suggested

#

I am attempting the kick command it is in the mod cog and I am pretty sure the cog is loading

earnest phoenix
#

we do stuff differently, I haven't seen someone use a class to define the bot

stable horizon
#

You haven't?

earnest phoenix
#

so it was weird to me

stable horizon
earnest phoenix
#

no

#

I do it kinda sloppily I guess

stable horizon
#

Literally every advanced bot out there does it

lusty dew
#

Advanced py bots use classes?

#

👀

slender thistle
#

Override superclasses' methods with bot.x instead of subclassing ftw

stable horizon
#

Ban

earnest phoenix
#

most of my commands are in cogs

stable horizon
#

Yeah that's normal

lusty dew
#

a cog is a class isn't it

stable horizon
#

But subclassing bot is also normal

lusty dew
#

Okay

#

just making sure I was right xd

#

Anyway

#

I will ask again later

#

My family is watching a movie

earnest phoenix
#

my bot is littlerally defined as a variable

#

lul

lusty dew
#

🤔

#

so bot = bot

slender thistle
#

Unless you wanna go super advanced, I don't see anything wrong

earnest phoenix
#

bot=commands.Bot(prefix=prefix)

stable horizon
#

Mines a variable too. But that variable is a subclass of Bot

lusty dew
#

boring

earnest phoenix
#

im not going like dyno or anything crazy

#

Just a small bot

#

would a leveling system be considered advanced tho

stable horizon
#

If github mobile would work, I'd send a link to what mine looks like (shit). But it's not gonna, so here we are

earnest phoenix
#

I actually started my bot on mobile

stable horizon
#

Same lol

#

But quickly moved away

#

Cause dependancies

earnest phoenix
#

me and my friends were messing around so I downloaded pydroid 3 and ran it on heroku

stable horizon
#

Ree heroku

earnest phoenix
#

I used heroku only cause my dad didn't have time to get the server login for me

#

So I got that earlier and it's running on a local server

#

My level system is cross-guild :/

stable horizon
earnest phoenix
#

ye

#

I used aiosqlite to do a level system

#

codes a mess tho

#

but it works

stable horizon
#

Sqlite is fine

slender thistle
#

Isn't aiosqlite not actually async

stable horizon
#

Yes it is?

earnest phoenix
#

Aiosqlite3

slender thistle
#

I heard it just did some fucky stuff to pretend to be async

stable horizon
#

It's aio not async

slender thistle
#

Pardon my blind brain

stable horizon
#

It pretty much runs sqlite3 in an executor loop

earnest phoenix
#

i originally learnt Python to do a fortnite bot

stable horizon
earnest phoenix
#

I deleted most of that bots code but it lives on in my new bot

#

cause it was my first actually good code

#

and I thought it was good

#

I used aiohttp to get a fortnite item from a database then post it's info

slender thistle
#

You haven't been a true coder if you haven't seen yourself do ''.join([v for k,v in some_dict]) instead of some_dict[k] :^)

stable horizon
earnest phoenix
#

what~

stable horizon
#

why do this

earnest phoenix
#

did I mention I'm too lazy to learn that format stuff

#

I litterally do "some "+ variable + " is bad"

stable horizon
#

v for k,v in some_dict
error

slender thistle
#

Tbh I completely forgot about accessing dict values when I did that

stable horizon
#

you forgot .items()

slender thistle
#

Maybe it was something else

#

That happened more than an year ago

earnest phoenix
#

I wanna learn python some more because I feel my code is "bad"

stable horizon
earnest phoenix
#

ok w h a t

stable horizon
#

like i said, horror

earnest phoenix
#

this is litterally my bot

slender thistle
#

Good lord

earnest phoenix
#

The cogs are old

#

I updated them

slender thistle
#

That code needs a Bible

stable horizon
#

that code dont look like yours

earnest phoenix
#

what

stable horizon
#

its too horrifying to be yours

earnest phoenix
#

nope it's mine

stable horizon
earnest phoenix
#

I barely use comments I really need to go through and comment stuff

#

my bot isn't that bad right

stable horizon
#

i have some serious cleaning to do

earnest phoenix
stable horizon
earnest phoenix
#

it was a meme

#

guys my code isnt that horrifying right

stable horizon
#

LOL i just realized i uploaded the cpython files to github as well

earnest phoenix
#

lmao I do that

#

too lazy not too

stable horizon
#

i have uh, alot of cogs

earnest phoenix
#

ok well my code might be bad but I'm proud of it

stable horizon
#

maybe thats why it took so long to upload

earnest phoenix
#

And that's what matters

stable horizon
#

heh, tell that to vex

earnest phoenix
#

who's vex

stable horizon
#

nvm

earnest phoenix
#

why

#

legit my main command

#

if you fail

stable horizon
earnest phoenix
#

it's not bad

stable horizon
#

having a main command

earnest phoenix
#

it's a meme

#

it's probably gonna just get phased out and I'll make my bot multiput

stable horizon
#

better than i can do

#

fuck css/html

earnest phoenix
#

lmao it took me a hour at least yesterday

#

it's kinda easy once you get the swing of it

#

Wait why isn't your bot hosted here

#

Like listed

#

Is it a private bot?

stable horizon
#

in the queue

#

ive been working on it every day since june lol

#

only submitted it like 2 days ago

earnest phoenix
#

Ah

#

I started vibe bot a week or two ago

#

and submitted 2 days ago too

lusty dew
#

Wait aiosqlite

#

I’m def searching that up

#

😂

#

I was working on a js bot

#

But got bored

#

Now I’m learning py

#

Xd

earnest phoenix
#

aiosqlite3

stable horizon
#

yeah dont just use sqlite3 out of the box

#

blocking

lusty dew
#

Wait what

earnest phoenix
#

yeah I use aiosqlite3

#

I learnt my lesson when i used requests

lusty dew
#

I’m about to start using it when I get to database shit

earnest phoenix
#

mhm

lusty dew
#

How do you use aiosqlite3

stable horizon
#

same way you use sqlite3

lusty dew
#

The package page has no docs

#

Xd

stable horizon
#

but put await in front of everthing

earnest phoenix
#

it's on pythons page

stable horizon
#

the docs for it are terrible

earnest phoenix
#

Python docs

#

I had a hard time making a database cause I had all the code but that

stable horizon
#

A) theyre in japanese or something B) theyre really short and brief.

lusty dew
#

Wouldn’t this work as well

stable horizon
#

just use the python docs, and await literally everything

earnest phoenix
#

Yeah I was trying to read them they confused the hell outta me

lusty dew
#

Lol

earnest phoenix
#

Hi, can some help me

lusty dew
#

Can I have a link to said aiosqlite3

earnest phoenix
#

Sure what's the issue @earnest phoenix

lusty dew
#

@earnest phoenix state you’re problem

earnest phoenix
#

Hey, what are the max interval for changing the bot's status without getting API banned?

#

uh

stable horizon
#

20 seconds or so

#

i think

earnest phoenix
#

K

#

discord developer site should say

#

Ty

stable horizon
#

dont quote me on that

slender thistle
#

5/20s or something

lusty dew
#

Yea that sounds about right

earnest phoenix
#

Mh

lusty dew
#

@stable horizon I’ll give you a dollar to code my whole py bot 😉

stable horizon
#

id just like to point this out

#

Discord has a very loose interpretation of API abuse; as quoted by them:

American Jake01/21/2018
@Danny automating the API in that way /is/ abuse. Automatically doing "X" every N is generally not a good idea. Where X could be posting a message, changing someone's nickname, renaming a role, changing a channel topic, etc... 

Generally bots should only react to user actions... 

Although, for very large N we generally don't care. But for small N, we do care. Think rainbow bots, etc....

"N" is not really defined, as rate limits are not a good thing to try to get very close to. You're going to have to mostly use common sense here, compare how close you are the rate limit, how often you do this, etc.

lusty dew
#

Ima make a rainbow bot

stable horizon
lusty dew
#

Lol

#

I’m kidding

#

I’m not trying to get banned from discord

earnest phoenix
#

Anyone here

slate wave
#

Yessir

earnest phoenix
#

@slate wave I could not join the voice channel: Error: FFMPEG not found

#

How to fix it

#

FFMPEG IN HEROKU

slate wave
#

I have no Idea how to use heroku

stable horizon
#

by not using heroku

slate wave
#

I use aws

earnest phoenix
#

How to install it

#

Rn

#

😅

#

This

slate wave
#

Yes

vital lark
#

there is this magic place called google

slate wave
#

^

stable horizon
#

rule of thumb: if a hosting service is free, it aint good

slate wave
#

Except for aws

stable horizon
#

no

slate wave
#

?

#

I have 24/7 hosting and full linux terminal access?

grave mist
#

I want that to be a bit up so that it'll be vertically center to that image in the left side in css. How can I do that

slate wave
#

Do you have a specified location in css for the image?

grave mist
#

Yea

#

I don't want to lower the image but want to higher the selected text

slate wave
#

What is that text inside of for HTML

grave mist
#

It is a list item in an unordered list

lusty dew
#

You could try setting margin and padding to 0

#

If that doesn’t work just mess around with the top attribute

#

@grave mist

grave mist
#

I mean, you see that text right there? I want to make it go up @lusty dew

lusty dew
#

Yes

#

Why do you think I told you to mess with margin, padding and the top attribute

grave mist
#

I tried margin-bottom, padding-bottom

lusty dew
#

Just do margin and padding to 0

grave mist
#

Not working

lusty dew
#
.className {
  margin: 0;
  padding: 0
}
#

Okay

grave mist
#

Ik

lusty dew
#

Then try changing the top attribute

#

Play around with it

grave mist
#

It's because, it isn't supposed to be 0 and afaik, to make those things up, I have to change margin-bottom, padding-bottom

#

Playing around for 1.5 hours

lusty dew
#

What

grave mist
#

Still can't even do that ffs

lusty dew
#

If you did margin-bottom it wouldn’t move it upwards

grave mist
#

Why won't it

lusty dew
#

Cause

#

Not how that works

grave mist
#

It should give 10px space below if I use margin-bottm: 10px

lusty dew
#

Only time I would ever think it would work is if there was something else bellow it

#

If there’s nothing bellow it then it won’t move

grave mist
#

And the navbar is of height 60px

lusty dew
#

:shrug:

#

Try changing top

grave mist
#

There's some text below but it is not in navbar

lusty dew
#

As I’ve said for the 5th time

grave mist
#

K I'll come with failure again wait

#

Failed

lusty dew
#

Show me what you’re doing

grave mist
#

top just makes up some space from top

#

Right?

lusty dew
#

No

grave mist
#

Then?

lusty dew
#

It’s a positioning attribute

grave mist
#

Doesn't it place the element from top x position

#

Which literally leaves space of x position above the element

lusty dew
#

:shrug:

#

I don’t know why it’s not working

grave mist
#

Well, I'll just send you a website link you look on it. Can you?

lusty dew
#

It works for me when I use it

#

Mk

young jungle
#

hey guys is there anyone who writes in python and wouldn't mind helping with a bug i'm having

#

it's saying a function doesn't exist when it does

#

like it's imported and everything, but the bot can't see it I guess?

#

yeah so if anyone could help out with this please ping me

modest maple
#

Apparently you don't have that in the decorator

#

I'd say check if it actually exists in the file

#

Altho last time I checked you didn't need the () at the end of it

young jungle
#

it's in the first screenshot

#

the function is definitely there

earnest phoenix
#

@lavish shuttle if i dont reclare client i wont be able to use it.

#

ofc i could but i like it more this way

stable horizon
#

@young jungle well uh, python isn't just flat out lying to you

young jungle
#

wdym

#

@stable horizon

stable horizon
#

Right here no need to ping

young jungle
#

oh sorry

stable horizon
#

I'm saying if it's telling you it ain't there, there's a reason.

young jungle
#

yes, but I can't see what the reason could possibly be

#

🙃

stable horizon
#

Have you restarted the bot? Or simply hot reloaded the module?

young jungle
#

yep

stable horizon
young jungle
#

it worked before

stable horizon
#

That... wasn't a yes no question

young jungle
#

now it doesnt

#

oh

#

lol

#

I restarted the bot a few times

stable horizon
#

So check for circular imports

#

IE the admin cog being loaded inside an import from the checks file

young jungle
#

yeah I checked it's not that

#

admin commands is a cog

#

the decorators file cant import it anyway

stable horizon
#

Next this would be (and this shouldn't be the cause) would be to try deleting your pycache folders

#

In case for some strange reason it's not recompiling your code

#

Yes python compiles blah blah blah

young jungle
#

yeah that didnt work either

#

🤔

stable horizon
#

Right uhhh, next would be try google, cuz I need to sleep lol

#

Too late for this

young jungle
#

aight well thanks anyway

stable horizon
#

Hope you find the problem

young jungle
#

thanks

slender thistle
#

i THouGhT pYThOn wAS iNtErPrEtEd

modest maple
#

xD

#

i have no idea why his code isnt working

#

unless there is some issue with somthing during the importing

#

it should work

vital lark
#

wait

#

I thought all languages were compiled but not being shown being compiled

modest maple
#

python is Interpreted unless you convert to Exe using somthing like kivy framework or py2exe

vital lark
#

feel like you don't see the sarcasm

modest maple
#

no i didnt

split hazel
#

me neither, very subtle

winged thorn
#

subtle*

split hazel
#

shh

sly grail
#

sup

golden raven
#

i have one doubt
i want to make the bot when the bot join's the guild it send a message to a specific channel in my server

#

for that what i need to do?

earnest phoenix
#

which library are you using

golden raven
earnest phoenix
#

async or rewrite

golden raven
#

rewrite

#

on_guild_join

#

event

earnest phoenix
#

yeah

#

give me a sec to see the docs

golden raven
#

how do send the msg to a channel in my guild by discord.utils.find

modest maple
#

Just have in the on join event

#

Get channel object by id

golden raven
#

ok

earnest phoenix
#

get_guild

modest maple
#

By using client (or bot).get_channel(I'd)

earnest phoenix
#

or you can directly use get_channel

#

yeah

modest maple
#

Then just await channelobject.send("xyz or embed)

golden raven
#

@modest maplethnks i will try

earnest phoenix
#

but it's generally bad practice to log to a discord channel

modest maple
#

^^

earnest phoenix
#

log to your console, or a .log file, if you want to inspect logs have a command that uploads the .log file

golden raven
#

@modest maple i have an idea to do that first then i thought getting help

quartz kindle
#

should be fine if youre not logging a lot of stuff

golden raven
#

@quartz kindleim not logging a lot

west raptor
#

can anyone help me understand this error, im so confused ```error[E0599]: no method named search found for type sites::kissanime::KissAnime in the current scope
--> src/main.rs:6:23
|
6 | println!("{}", ka.search()[0].metadata());
| ^^^^^^ method not found in sites::kissanime::KissAnime
|
::: src/sites/kissanime.rs:3:1
|
3 | pub struct KissAnime;
| --------------------- method search not found for this
|
::: src/sites/mod.rs:9:8
|
9 | fn search(&self, to_search: &str) -> VecSelf::Episode;
| ------
| |
| the method is available for std::boxed::Box<sites::kissanime::KissAnime> here
| the method is available for std::sync::Arc<sites::kissanime::KissAnime> here
| the method is available for std::rc::Rc<sites::kissanime::KissAnime> here
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a use for it:
|
1 | use crate::sites::AnimeSite;
|

error: aborting due to previous error

For more information about this error, try rustc --explain E0599.
error: could not compile anime-rs.

To learn more, run the command again with --verbose.```

#

uh

#

lemme get code

#
use crate::sites::{ AnimeSite, SiteEpisode };

pub struct KissAnime; 

impl AnimeSite for KissAnime {
    type Episode = KissAnimeEpisode;

    fn search(&self, to_search: &str) -> Vec<Self::Episode> {
        let ep1 = KissAnimeEpisode {};
        let ep2 = KissAnimeEpisode {};

        vec![ep1, ep2]
    }
}

pub struct KissAnimeEpisode;

impl SiteEpisode for KissAnimeEpisode {
    fn metadata(&self) -> String {
        return String::from("lol");
    }
}
golden raven
#

How to display custom emoji in embed, i have used as :wrongsign: 659381780826161182 but in the result it displays only the text

mossy vine
#

<:emoji🆔>

#

what the fuck discord

#

wait no

#

if ucked up

#

<:emoji:id> iirc

#

yea

#

you can get that by putting a backslash before the emoji

golden raven
#

@mossy vine i have done as like you but shows only text

mossy vine
#

you need to do <:name:id>

golden raven
#

same

west raptor
#

coding on mobile

mossy vine
#

oh embed titles dont support custom emojis iirc

west raptor
#

they dont

golden raven
#

ss

mossy vine
#

description does tho

golden raven
#

@mossy vine oh

west raptor
#

I think everything except titles and field titles support custom emojis

golden raven
earnest phoenix
#

is your bot in the guild the emoji is in

golden raven
#

@earnest phoenix no

earnest phoenix
#

it has to be

golden raven
#

im making this bot to upload on top.gg so all server would have this emoji to display?

mossy vine
#

no

golden raven
#

what is problem in my code

mossy vine
#

it has to be in the server with the emoji

golden raven
#

uh?

#

couldn't understand

earnest phoenix
#

The bot has to be in the server with that emoji to access said emoji

#

Similar to how users need to be in the server to use that servers emojis

golden raven
#

ok but in the other servers? what would be the result

late hill
#

Your bot has to be a member of the server that has the emoji

#

It'll then be able to use it in any other server

#

If it has the required permissions that is

golden raven
#

ok

late hill
#

external emojis or something

golden raven
#

same error

#

i have the emoji on the server where the bot is in, same error occures

#

it just displays the text

modest maple
#

is it the same ID tho

#

and you have to do <:name:<ID>>

#

e.g

golden raven
#

the previous and now id of the emoji is same

earnest phoenix
#

you're doing something wrong then

#

i dont even know how you can even mess up two simple steps

#

I tend to agree with that

#

literally just
add the bot where the emoji is in
escape the emoji in said guild and you can use it

golden raven
#

done

#

thanks for helping

mossy vine
#

in js is there a oneliner to await a promise and then grab a property of the object it resolves with?

#

would this work?

(r => r.property)(await func())```
quartz kindle
#

wat

mossy vine
#

im guesing no

sudden geyser
#

uhh, you mean like? (await myPromise()).myprop

quartz kindle
#

you mean this? (await something()).property?

#

lul

mossy vine
#

oh thats a thing?

quartz kindle
#

beat me to it

sudden geyser
#

first!

mossy vine
#

oh thats working, thanks

#

if .get returns a truthy value, will the function still be called?

let c = embedCache.get(message.author.id) || (await db.find('users', { user: message.author.id })).embed```
quartz kindle
#

no

mossy vine
#

okay great

#

thank you

quartz kindle
#

you can also update your cache with a one liner

mossy vine
#

oh i might want to do that

quartz kindle
#

well, if you had an object you could do this if(!c) c = embedCache[message.author.id] = (await find()).embed

#

it wont work like that with maps/collections

mossy vine
#

oh

#

well i am using maps rn so

#

would using objects instead affect performance

quartz kindle
#

afaik objects should be faster than maps

#

but maps have better utility

#

i think in your case the best way would be to just js c = embedCache.get() if(!c) { c = await db.find() embedCache.set(c) }

mossy vine
#

oh okay

#

thanks

quartz kindle
#

wait you could do this

#

c = embedCache.get(id) || embedCache.set(id,db.find()).get(id)

#

lmao

#

since set returns the map instance, you can chain methods on it

mossy vine
#

db.find is async tho, so wouldnt i have to await it in the set

sudden geyser
#

no

quartz kindle
#

yes, i just omitted it for faster writing

mossy vine
#

in the same way? (await db.find())?

quartz kindle
#

yup

mossy vine
#

thank you

#

@quartz kindle i have this but its returning undefined on first call, then what it should return afterwards

let c = embedCache.get(message.author.id) || embedCache.set(message.author.id, (await db.find('users', { user: message.author.id }).embed)).get(message.author.id)```
#

oh wait

#

i messed up the )

#

sry for ping lmao

#

finally its working perfectly

quartz kindle
#

👍

earnest phoenix
#

How can i defind member in roleCreate event?

#

there is no context of a member in the roleCreate event

split hazel
#

They have a forum for that, otherwise if you wanna get their servers memory usage

delicate zephyr
#

anyone know the ratelimit on how many users you can fetch/second

earnest phoenix
#

the ratelimits aren't static and you don't need to type in bolding

delicate zephyr
#

it doesnt matter

#

Im asking about the current rate limit

#

and ive googled, also read pins

earnest phoenix
#

i literally just said that the ratelimits aren't static

#

they don't have a certain value

#

they change

delicate zephyr
#

@modern sable I asked a question and this person is being unhelpful please help

earnest phoenix
#

i literally just said that the ratelimits aren't static
they don't have a certain value
they change
???????????

delicate zephyr
#

sigh

#

they have a basic value but I cant find it

#

like messages have a 5 / second

earnest phoenix
#

you have no clue what you're talking about

#

cry is right...

#

no ratelimit is static, the message ratelimit is known to be 5/5 because people tested for it and discord probably won't change something as crucial as a message ratelimit

delicate zephyr
#

im just not gonna bother

#

why are people here so fucking toxic

earnest phoenix
#

nobody is being toxic?

#

https://discordapp.com/developers/docs/topics/rate-limits
Because we may change rate limits at any time and rate limits can be different per application, rate limits should not be hard coded into your bot/application. In order to properly support our dynamic rate limits, your bot/application should parse for our rate limits in response headers and locally prevent exceeding the limits as they change.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

@delicate zephyr this is not toxic at all

#

you're literally being a help vampire

#

...?

coral trellis
#

@earnest phoenix You should be more open to people asking for help, not just indirectly call them stupid. .

earnest phoenix
#

stop putting words into my mouth

delicate zephyr
#

I literally know that. The point is all ratelimits have a current value. Like message ratelimit it has a basic value

earnest phoenix
#

i never called anyone stupid

#

^

modern sable
delicate zephyr
#

im just gonna go and ask in the d.js server instead

earnest phoenix
#

and that is calling them stupid

#

...?

coral trellis
#

Did you even read what I said

earnest phoenix
#

if a teacher tells you that you have no clue how to do x, it doesn't mean they called you stupid

#

they're just putting it upfront that you don't know what you're doing

#

I literally know that. The point is all ratelimits have a current value. Like message ratelimit it has a basic value
yes ratelimits have a value, but they change so they aren't known and shouldn't be put directly in code

delicate zephyr
#

I never said I was going to put them into code

earnest phoenix
#

what is your goal

delicate zephyr
#

I legit just want to know the ratelimit

earnest phoenix
#

yes ratelimits have a value, but they change so they aren't known

delicate zephyr
#

sigh

#

They are though

earnest phoenix
#

they're known only for specific crucial endpoints

delicate zephyr
#

I wouldnt have asked if I hadnt seen them already, I just forgot where I last saw them and thought people would be kind enough to repost them

earnest phoenix
#

ratelimits adapt to how often you hit the endpoint and what are the response codes

earnest phoenix
#

i'm aware of that

#

they're crucial endpoints so they don't really change

#

they do for a few people though

#

i've met a few people who've been ratelimited on messaging

#

that wasn't a 5/5 ratelimit

#

what's your end goal here

#

because if you want to implement ratelimit safe code, first attempt to remove all spam possible, then check if your library handles ratelimits for you, which if you're using d.js, it's supposed to

modern sable
#

You could have easily said that they're aren't static but the most common ratelimit is in the pins

There's literally no need in trying to escalate something by saying "you have no clue what you're talking about"

earnest phoenix
#

i went straight to the point instead of trying to bargain

delicate zephyr
earnest phoenix
#

i haven't shat on you in any way, i just said you don't know what you're talking about

#

because it's a clear fact you're uneducated on how ratelimits work...?

#

i mean, you do have a basic sense

#

you don't want to accept a fact that's written straight into the docs

#

anyways

delicate zephyr
#

I know how rate limits work. I was doing something and it was taking a while so I wanted to know what the basic value of the rate-limit was. How about instead of thinking about whether or not someone is stupid think before you speak

coral trellis
#

Good christ

earnest phoenix
#

you should really stop putting words into my mouth

#

i asked you what your end goal was and you didn't answer

#

because i'm trying to give you the most correct approach

delicate zephyr
#

anyway peepoLeave

wicked pivot
#

excuse me has anyone already worked on the event: voiceStateUpdate

lusty dew
#

No everyone likes to avoid it

#

@wicked pivot just state your problem

wicked pivot
#
const discord = require('discord.js')

module.exports = async (bot, oldMember, newMember) => {
    guild = oldMember.guild
    let newUserChannel = newMember.voiceChannel
    let oldUserChannel = oldMember.voiceChannel


  if(oldUserChannel === undefined && newUserChannel !== undefined) {

    let embed = new discord.RichEmbed()
    .setTitle("Un utilisateur à rejoint un channel vocal")
    .setDescription(`
Nom de l'utilisateur qui à rejoint le channel vocal : ${newMember.user.username}

Channel vocal qu'il à rejoint : ${newMember.voiceChannel.name}`)
.setColor('2CDB09')
.setTimestamp()
.setFooter(`Logs serveur ${guild.name}`)

return bot.channels.get("657162338184724482").send(embed)
  }//join
  
  
  else if(oldUserChannel !== undefined && newUserChannel !== undefined){
    let embed = new discord.RichEmbed()
    .setTitle("Un utilisateur à été moov d'un channel vocal")
    .setDescription(`
Nom de l'utilisateur qui à été moov de son channel vocal : ${newMember.user.username}

Channel vocal qu'il à rejoint : ${newMember.voiceChannel.name}

Channel vocal qu'il à leave : ${oldMember.voiceChannel.name}`)
.setColor('#C86110')
.setTimestamp()
.setFooter(`Logs serveur ${guild.name}`)

return bot.channels.get("657162338184724482").send(embed)
  }//moov
}```I could not explain it I am extremely bad at English but here is my code and a log screen which does with
lusty dew
#

And I can’t speak whatever that is

#

Looks French or spanish

modest maple
#

french

lusty dew
#

Yea

wicked pivot
#

french yes

modest maple
#

but i dont understand what the issue is

lusty dew
#

Nor do I

wicked pivot
#

the bot logs when a user mutates and I don't want to

modest maple
#

then remove the part where its sending the embed?

lusty dew
#

Mutates?

wicked pivot
#

make it so that when a user mutates it doesn't have any logs

#

mute *

lusty dew
#

Well

wicked pivot
#

sorry but i use google translations

lusty dew
#

That’s what voiceStateUpdate does

#

It triggers when anything voice related happens like muting, deafening, etc

modest maple
wicked pivot
#

yes i know but is it possible to modify my "else if" so that the event muting etc does not trigger

lusty dew
#

Only way to change I think would be to make your own voiceStateUpdate method extending client or whatever it is and override it triggering on mute

lean pike
#

Guys Can you help me

#

@modest maple

#

Can you help me

modest maple
#

what

lean pike
#

I have a question how do I make the bot display the specified protection level in the server

#

I searched the Discord.js library and saw it

wicked pivot
#
let verifLevels = ["None", "Low", "Medium", "(╯°□°)╯︵  ┻━┻", "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"];

verifLevels[message.guild.verificationLevel]```
lean pike
#

Thank you man @wicked pivot

wicked pivot
#

no problem

earnest phoenix
#

don't spoonfeed code

modest maple
#

^

lean pike
#

let verifLevels = ["None", "Low", "Medium", "(╯°□°)╯︵ ┻━┻", "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"];

lusty dew
#
discord.ext.commands.errors.CommandNotFound: Command "kick" is not found
#

Back to last night's problem

#

I have the cog loaded and even have the setup function

modest maple
#

code?

lusty dew
#
import discord
from discord.ext import commands


class ModCommands(commands.Cog):
    @commands.command()
    @commands.guild_only()
    async def test(self, ctx, member: discord.Member):
        await ctx.send(f'{member.display_name} was kicked!')


def setup(client):
    client.add_cog(ModCommands(client))

#
initial_cogs = [
    'cogs.owner',
    'cogs.mod',
    'cogs.fun',
    'cogs.general'
]

if __name__ == '__main__':
    for extensions in initial_cogs:
        client.load_extension(extensions)
        print('Successfully loaded {0}'.format(extensions))
earnest phoenix
#

uh

#

isn't the command test?

lusty dew
#

oh wait

earnest phoenix
#

i don't really do python but i'm guessing the method name defines the command name

#

async def test

lusty dew
#

Yea

#

Either way

#

Same thing

#
discord.ext.commands.errors.CommandNotFound: Command "test" is not found
earnest phoenix
modest maple
#

@lusty dew where are you calling test, i see you have the part where youre loading cogs

lusty dew
#

What

modest maple
#

but i dont see where your calling test at any point or referencing it

lusty dew
#

🤔 \

#

What do you mean

#

test is a command

modest maple
#

yh but it cant find it, thats what im going off

lusty dew
#

Okay

modest maple
#

if youre not telling it where to look it wont find it

lusty dew
#

🤔

sudden geyser
#

@earnest phoenix you return if there's no command by that name, but check the aliases below (which is never checked)

// Line 81
if (!client.commands.has(commandName)) return;```
lusty dew
#

@modest maple What else do I have to do

modest maple
#

send your full code

lusty dew
#

I have followed the cogs tutorial

earnest phoenix
#

@sudden geyser so how to fix it?

lusty dew
#
import os
from dotenv import load_dotenv
from discord.ext import commands
load_dotenv()
TOKEN = os.getenv('TOKEN')


class StarClient(commands.Bot):
    async def on_ready(self):
        print('Logged on as {0}!'.format(self.user))

    async def on_message(self, message):
        print('Message {0.author}: {0.content}'.format(message))
        await self.process_commands(message)


client = StarClient(command_prefix="p$")
client.run(TOKEN)

initial_cogs = [
    'cogs.owner',
    'cogs.mod',
    'cogs.fun',
    'cogs.general'
]

if __name__ == '__main__':
    for extensions in initial_cogs:
        client.load_extension(extensions)
        print('Successfully loaded {0}'.format(extensions))
sudden geyser
#

Remove the line and just check if the command exists (where you defined command)

earnest phoenix
#

frick solved it

#

ty

noble halo
#

when new votes arrive, dbl.webhook('vote' or dbl.getVotes ?

#

channel send

restive furnace
noble halo
#

Ok

stable horizon
#

@lusty dew uh

#

You uh, realize that bot.run doesn't return until the bot closes right?

lusty dew
#

@stable horizon so not even the cogs tutorial you guys support

#

That’s the one I used

stable horizon
#

There's no cogs tutorial?

#

There's an example?

lusty dew
#

Well it’s a link on how it works

#

My bad

#

Wait I should be running the bot on ready? @stable horizon

#

Or wait nvm

stable horizon
#

Huh

lusty dew
#

I read what you said wrong

#

Xd

stable horizon
#

No you need to load the cogs before you run the bot

lusty dew
#

Ohhhh

#

I’m so dumb

#

Thank you

opaque eagle
earnest phoenix
#

set the box shadow to none

#

on the avatar class

opaque eagle
#

ty'

#

also can someone help me debug this new error: I'm reaching max call stack size

#

I was trying to go from a normal client class to a singleton

#

and i'd just written all the code to accomplish that... when i was testing it, this shows up

sterile minnow
#

Uhhm i cannot post my servercount on the DBL JS api it loggs nothing :/

#

I copied the exanple 1:1 and pasted my token from TOP.GG in it

modest maple
#
  1. #topgg-api
  2. have you actually got your port opened on the right port?
ruby onyx
#

i recently bought a vps (finally ping under 70ms) and i'm kind of lost on something, i used express.js to host a status page (for my status page to ping for uptime) & some api, here was the script i had:

    app.get("/status", function(req, res) {
        res.send(`ONLINE`);
        console.log("[LOG] Pinged")
    });
    
    app.get("/api", function(req, res) {
        res.send(serverCount);
        console.log("[LOG] API Requested")
    });
    
    var server = app.listen(85, function () {
        console.log("[INFO] Listening on port %s...", server.address().port);
    });```
but on the vps, it doesn't start with this enabled.
#

could someone help me out a little?

earnest phoenix
#

you most likely already have something listening on port 80

light drift
#

Who now how to create the system of webhook vote ?

blissful scaffold
#

For using ports under 1024 you often need admin rights

topaz fjord
#

80 is an http port

#

If you have nginx/Apache installed it may be using the port

blissful scaffold
#

that too

ruby onyx
#

ah, but i don't

#

sorry just now saw these

#

anything under 1024 needs admin rights?

#

i'll check if i can run at something like 1025

ruby onyx
#

yeeah that seemed to work

#

totally didn't take an hour to do that

slender thistle
#

Does the indentation match up with the rest of the code

outer niche
#

Never mind I fixed it

west spoke
#

@modest maple posting doesnt require a webhook. That can be done with manual HTTP requests. The vote GET endpoint (notify) is what requires the webhook

earnest phoenix
#

Image previews on certain site doesn't work.

#

How can i fix it?

#

can't make image embed too

earnest phoenix
#

(node:5039) UnhandledPromiseRejectionWarning: EnmapTypeError: The key "644876298765860941" is not of type "Object" or "Array" in the enmap "settings" (key was of type "String")

earnest phoenix
#

Code?

#

@earnest phoenix

warm marsh
#

@earnest phoenix Embedded images from sites work using meta tags I think.

quartz kindle
#

@earnest phoenix that link gives me access denied

earnest phoenix
#
// index file
client.settings = new Enmap({
  name: "settings",
  fetchAll: false,
  autoFetch: true,
  cloneLevel: 'deep'
});

const defaultSettings = {
  modLogChannel: "mod-log"
}

client.on("guildDelete", guild => {
client.settings.delete(guild.id)
})

client.on("message", async message => {
const guildConf = client.settings.ensure(message.guild.id, defaultSettings);
})

// changelogchannel command
module.exports = {
  help: {
    name: "logchannel",
    description: "sets the log channel for your server.",
    category: "management",
    usage: " <channel>",
    aliases: ["setlogchannel", "slc", "setlog"]
  },
  execute: async (client, message, args) => {

    if(!args.length) return message.channel.send(":x: | Please give me a channel!")
    client.settings.set(message.guild.id, args.join(" "));
    message.channel.send(`Mod log channel has been changed to:\n\`${args.join(" ")}\``);
  }
}
#

@earnest phoenix

#

I’m relatively new to enmap so don't attack me for missing out some basic stuff

#
client.settings = new Enmap({
  name: "settings",
  fetchAll: false,
  autoFetch: true,
  cloneLevel: 'deep'
});

const defaultSettings = {
  modLogChannel: "mod-log"
}

client.on("guildDelete", guild => {
client.settings.delete(guild.id)
})

client.on("message", async message => {
const guildConf = client.settings.ensure(message.guild.id, defaultSettings);
})

// changelogchannel command
module.exports = {
  help: {
    name: "logchannel",
    description: "sets the log channel for your server.",
    category: "management",
    usage: " <channel>",
    aliases: ["setlogchannel", "slc", "setlog"]
  },
  execute: async (client, message, args) => {

    if(!args.length) return message.channel.send("❌ | Please give me a channel!")
    client.settings.set(`settings_${message.guild.id}`, args.join(" "));
    message.channel.send(`Mod log channel has been changed to:\n\`${args.join(" ")}\``);
  }
}```

That should work
late hill
#

Did you just copy his code, added a syntax error and removed the js language from the codeblock waitWhat

earnest phoenix
#

FRICK I FORGOT A ,

old gale
#
// index file
client.settings = new Enmap({
  name: "settings",
  fetchAll: false,
  autoFetch: true,
  cloneLevel: 'deep'
});

const defaultSettings = {
  modLogChannel: "mod-log"
}

client.on("guildDelete", guild => {
client.settings.delete(guild.id)
})

client.on("message", async message => {
const guildConf = client.settings.ensure(message.guild.id, defaultSettings);
})

// changelogchannel command
module.exports = {
  help: {
    name: "logchannel",
    description: "sets the log channel for your server.",
    category: "management",
    usage: " <channel>",
    aliases: ["setlogchannel", "slc", "setlog"]
  },
  execute: async (client, message, args) => {

    if(!args.length) return message.channel.send("❌ | Please give me a channel!")
    client.settings.set(`settings_${message.guild.id}`, args.join(" "));
    message.channel.send(`Mod log channel has been changed to:\n\`${args.join(" ")}\``);
  }
}
#

looks better

late hill
#

ok

earnest phoenix
#

i edited it alr xD

old gale
#

hello there

earnest phoenix
#

hello there

old gale
#

how r u doing?

earnest phoenix
#

well what bout you?

#

move on to #general i don't wanna get muted

old gale
late hill
#

Oh

#

Why did you add "settings_" to his code

#

That's not right??

#

Anyway, the error is kinda weird because it's complaining about your key

#

As for which it should be completely fine if that's a string

#

However, your default settings is an object (which you ensure in the message event)

#

While your command is setting it to a string

#

Rather than editing the object's modLogChannel property

#

Which is probably what you meant to do

earnest phoenix
#

@late hill There need to be a kind of Folder/File where it gets saved in

late hill
#

The directory it's saved at has a default

#

And can be changed

#

But I'm pretty sure you adding settings_ to the key doesn't change anything to the directory it saves the data in

#

Putting that in the set() method and ignoring it for literally any other method makes absolutely no sense

sterile minnow
#

Hi there,
I have a log channel for my bot where it always sends in when someone starts a radio, it has always worked so far but now I always get an error. Can anyone help me?

Code:
                ```   let consola = client.channels.get ("657713762853191680");
                  var playingconsola = new Discord.RichEmbed ()
                    .setTitle ("🎵 | Now Playing")
                  .setDescription (I'm now connected to the channel: <: voice: 585783907673440266> $ {message.member.voiceChannel.name} \ nguild: $ {message.guild.name} \ nPlaying: ▶ $ {stationname} \ nURL : [Click Here] ($ {streamURL}) 🎧 \ nOn Shard: $ {client.shard.id} / 6)
                  .setAuthor (message.author.username)
                  .setFooter ("To set the volume use: r> vol [volume]")
                  .setColor ( "GREEN")
                  consola.send (playingconsola)
                    })
                    .catch (console.log);
            }


Error: https://tayron.is-inside.me/NYqWOUNY.png
modest maple
#

apparently its undefined

#

oh

sterile minnow
#

but i've defined it thats the point

modest maple
#

why is the ID the in "" tho

#

ID's are Int when using .get() no?

sterile minnow
#

idk

#

What should i do?

quartz kindle
#

Ids are not ints

modest maple
quartz kindle
#

They cannot be ints

sterile minnow
#

But why does is send the: send of undefined error

sinful lotus
#

channel is undefined

quartz kindle
#

Because they exceed the 64 bit integer that javascript uses

sterile minnow
#

But its defined

sinful lotus
#

meaning you should pass a string and not int

sterile minnow
sinful lotus
#

not because you get it

#

it will be defined

#

.get() can return undefined

sterile minnow
#

i'll try find

sinful lotus
#

for example you have 2 shards and your are getting that channel, for sure only 1 shard will have the data, meaning one shard will throw undefined error if you dont have checks

late hill
#

Using find can still return undefined

sinful lotus
#

stop blaming js for your lack of knowledge and learn

#

you need to check if data exists before acting

#

thats a given

sterile minnow
#

Ouf i've 6 shards but how can i make that he's finding the channel

modest maple
#

why do you have 6 shards

sinful lotus
#

do a broadcast eval or webhooks

#

or ipc of you want it harder

late latch
#

maybe const

sterile minnow
#

Okay i'll disable the shards for a short time thats better

sinful lotus
#

const will not do anything