#development
1 messages · Page 756 of 1
You don't need to make it an array
Loading cogs works the same way as python imports
I didn’t mean to make it an array
But how else else would i do it
Just a plain string?
@opaque eagle you mind sharing your (neo)vim configs?
this might remove the extension
If you want to load example.py cog from cogs.fun, you just load it as "cogs.fun.example"
@west raptor sorry
"how" what? How to load the cogs?
You’re saying not to save the file names as an array
No, you're just putting the []'s in strings when not needed
Okay
How do I remove the [] in the string
you dont need to ping me twice
tempList = []
for files in os.listdir(newPath):
file = os.path.splitext(files)[0]
tempList.append(file)
I think he meant to ping me April
sorry
Okay what about that code snippet
I’m assuming me appending file to an array
Makes the []
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
Yes
Is that the code you currently have
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
You're adding the list itself to the last string
the one as arg of cog_list.append
What?
cog_list.append(f'cogs.{folder}.{tempList}')
See the {tempList} there?
Yea
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
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
GIve me a few minutes
Okay
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
what are some cheap and good hosting stuffs
check pins
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
A cog is a file that can contain multiple classes
In our case, we have one class but with multiple commands
No
Oh, you mean that
I'd really suggest putting all the commands under one class
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
I've been doing that since I started using cogs and never had a problem with debugging a command
I am dyslexic
Didn't you.... already ask this in 2 other servers?
Hm
I asked in d.py
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
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
I highly doubt those are my only options
Misunderstood, ignore
Okay
Which imports do you mean?
Are the files named the same as the folders, DyingLight?
aka would it be cogs.fun.fun, cogs.mod.mod to load?
no
they are named after what the command does
why would I name them after the folder
🤔
I am trying to basically make a command handler
and split the commands up related to the folders
I rest my case
i have a command handler not the best but works great i send it a bit
No
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());
its a command handler
For js
Pure spoonfeed at this point even if it's an unrelated language
i never never said this command handler is python i just said i have an command handler
Well why would it be related to this conversation
We're on a python topic?

send the css?
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
ok let me try to a webpage with this and try to find solusion
discord.ext.commands.errors.CommandNotFound: Command "kick" is not found```
What am I doing wrong
I am so close to just giving up
The command isn't found
initial_cogs = [
'cogs.owner',
'cogs.mod',
'cogs.fun',
'cogs.general'
]
if __name__ == '__main__':
for extensions in initial_cogs:
client.load_extension(extensions)
owner, mod, fun and general
Okay send code of a cog
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))
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?
use bot
Bot has a built in commands framework
@golden raven separate them into groups of cogs
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$")
So they can be loaded and unloaded with ease
Again why does it matter if I name it client or bot
Ok you're doing something funky
How
@earnest phoenix ok let me organise them
@lusty dew you should follow this tutorial it helped me alot.
A simple bot tutorial for Discord.py. GitHub Gist: instantly share code, notes, and snippets.
Why do I have to name it bot
it has more than 200 lines
firstly I don't think doing a class is right
It is
like I don't know if it works
ok well I don't do it that way so idk
Yea
But addpy def __init__(self, bot): self.bot = bot self._last_member = None
But change bot to starclient
It doesn't matter what it's named
Ok then client
Again
what does that even do
I am not going to use something if I don't know what it does
You don't need last member
i use it
bruh I'ma be honest
So?
Don't know what it does
@lusty dew you can use this as reference https://github.com/AlexFlipnote/discord_bot.py
🍺 A simple discord bot that helps you getting started within discord.py - AlexFlipnote/discord_bot.py
Just cause you use it doesn't mean others need to
But it makes it work
Smh
ok fine y'all help them
Conflicting advices
I'm tryina help
OK. Your command isn't found. We're still there yes?
Yes
did you get any other errors?
Ok. So most likely you haven't loaded the cog
like a reason it wasn't loaded?
You not loading it or an error
did you see any other errors when loading it
I feel like it's Todo with self
I dont
__init__ is optional
what does it even do
self?
Uh
basic Python stuff
Basic py
I suggest you Google that after this issue is solved

Honestly
Yeah google it
loading the cogs?
Yeh
initial_cogs = [
'cogs.owner',
'cogs.mod',
'cogs.fun',
'cogs.general'
]
if __name__ == '__main__':
for extensions in initial_cogs:
client.load_extension(extensions)
You're getting an error before you get to cogs.mod most likely
you do need to have a setup in each cog
I'm ignoring other cogs for now
I know this
I just haven't gotten to making commands for mod, fun or general
I am focusing on owner
You showed the code for mod tho

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
How much python do you actually know
you should probably learn more python before continuing
Reset here. What command are you attempting. And which module is it in. And is that module actually loading.
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
we do stuff differently, I haven't seen someone use a class to define the bot
You haven't?
so it was weird to me

Literally every advanced bot out there does it
Override superclasses' methods with bot.x instead of subclassing ftw
Ban
most of my commands are in cogs
a cog is a class isn't it
But subclassing bot is also normal
Okay
just making sure I was right xd
Anyway
I will ask again later
My family is watching a movie
Unless you wanna go super advanced, I don't see anything wrong
bot=commands.Bot(prefix=prefix)
Mines a variable too. But that variable is a subclass of Bot
boring
im not going like dyno or anything crazy
Just a small bot
would a leveling system be considered advanced tho
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
I actually started my bot on mobile
me and my friends were messing around so I downloaded pydroid 3 and ran it on heroku
Ree heroku
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 :/

Sqlite is fine
Isn't aiosqlite not actually async
Yes it is?
Aiosqlite3
I heard it just did some fucky stuff to pretend to be async
It's aio not async
Pardon my blind brain
It pretty much runs sqlite3 in an executor loop
i originally learnt Python to do a fortnite bot

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
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] :^)

what~
why do this
did I mention I'm too lazy to learn that format stuff
I litterally do "some "+ variable + " is bad"
v for k,v in some_dict
error
Tbh I completely forgot about accessing dict values when I did that
you forgot .items()
I wanna learn python some more because I feel my code is "bad"
https://github.com/IAmTomahawkx/bob/blob/master/main.py#L89
right thats my bot class. what a horror.
ok w h a t
like i said, horror
Good lord
That code needs a Bible
what
its too horrifying to be yours
nope it's mine
this is the worst part LMAO
I barely use comments I really need to go through and comment stuff
my bot isn't that bad right
i have some serious cleaning to do
legit my main command:

LOL i just realized i uploaded the cpython files to github as well
i have uh, alot of cogs
ok well my code might be bad but I'm proud of it
maybe thats why it took so long to upload
And that's what matters
heh, tell that to vex
who's vex
nvm

it's not bad
having a main command
it's a meme
it's probably gonna just get phased out and I'll make my bot multiput
My bot page isn't bad tho right
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?
in the queue
ive been working on it every day since june lol
only submitted it like 2 days ago
Wait aiosqlite
I’m def searching that up
😂
I was working on a js bot
But got bored
Now I’m learning py
Xd
aiosqlite3
Wait what
I’m about to start using it when I get to database shit
mhm
How do you use aiosqlite3
same way you use sqlite3
but put await in front of everthing
it's on pythons page
the docs for it are terrible
Python docs
I had a hard time making a database cause I had all the code but that
A) theyre in japanese or something B) theyre really short and brief.
just use the python docs, and await literally everything
Yeah I was trying to read them they confused the hell outta me
Lol
Hi, can some help me
Can I have a link to said aiosqlite3
Sure what's the issue @earnest phoenix
@earnest phoenix state you’re problem
Hey, what are the max interval for changing the bot's status without getting API banned?
uh
dont quote me on that
5/20s or something
Yea that sounds about right
Mh
@stable horizon I’ll give you a dollar to code my whole py bot 😉
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.
Ima make a rainbow bot

Anyone here
Yessir
@slate wave I could not join the voice channel: Error: FFMPEG not found
How to fix it
FFMPEG IN HEROKU
I have no Idea how to use heroku
by not using heroku
I use aws
How to install it
Rn
😅
https://aws.amazon.com/
Amazon Web Services
This
Yes
there is this magic place called google
^
rule of thumb: if a hosting service is free, it aint good
Except for aws
no
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
Do you have a specified location in css for the image?
What is that text inside of for HTML
It is a list item in an unordered list
You could try setting margin and padding to 0
If that doesn’t work just mess around with the top attribute
@grave mist
I mean, you see that text right there? I want to make it go up @lusty dew
I tried margin-bottom, padding-bottom
Just do margin and padding to 0
Not working
Ik
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
What
Still can't even do that ffs
If you did margin-bottom it wouldn’t move it upwards
Why won't it
It should give 10px space below if I use margin-bottm: 10px
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
And the navbar is of height 60px
There's some text below but it is not in navbar
As I’ve said for the 5th time
Show me what you’re doing
No
Then?
It’s a positioning attribute
Doesn't it place the element from top x position
Which literally leaves space of x position above the element
Well, I'll just send you a website link you look on it. Can you?
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
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
@lavish shuttle if i dont reclare client i wont be able to use it.
ofc i could but i like it more this way
@young jungle well uh, python isn't just flat out lying to you
Right here no need to ping
oh sorry
I'm saying if it's telling you it ain't there, there's a reason.
Have you restarted the bot? Or simply hot reloaded the module?
yep

it worked before
That... wasn't a yes no question
So check for circular imports
IE the admin cog being loaded inside an import from the checks file
yeah I checked it's not that
admin commands is a cog
the decorators file cant import it anyway
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
aight well thanks anyway
Hope you find the problem
thanks
i THouGhT pYThOn wAS iNtErPrEtEd
xD
i have no idea why his code isnt working
unless there is some issue with somthing during the importing
it should work
python is Interpreted unless you convert to Exe using somthing like kivy framework or py2exe
feel like you don't see the sarcasm
no i didnt
me neither, very subtle
subtle*
shh
sup
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?
which library are you using
async or rewrite
how do send the msg to a channel in my guild by discord.utils.find
ok
get_guild
By using client (or bot).get_channel(I'd)
Then just await channelobject.send("xyz or embed)
@modest maplethnks i will try
but it's generally bad practice to log to a discord channel
^^
log to your console, or a .log file, if you want to inspect logs have a command that uploads the .log file
@modest maple i have an idea to do that first then i thought getting help
should be fine if youre not logging a lot of stuff
@quartz kindleim not logging a lot
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");
}
}
How to display custom emoji in embed, i have used as :wrongsign: 659381780826161182 but in the result it displays only the text
<: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
@mossy vine i have done as like you but shows only text
you need to do <:name:id>
coding on mobile
oh embed titles dont support custom emojis iirc
they dont
ss
description does tho
@mossy vine oh
I think everything except titles and field titles support custom emojis
is your bot in the guild the emoji is in
it has to be
im making this bot to upload on top.gg so all server would have this emoji to display?
no
what is problem in my code
it has to be in the server with the emoji
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
ok but in the other servers? what would be the result
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
ok
external emojis or something
same error
i have the emoji on the server where the bot is in, same error occures
it just displays the text
is it the same ID tho
and you have to do <:name:<ID>>
e.g
become !blush_eoto_002
the previous and now id of the emoji is same
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
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())```
wat
im guesing no
uhh, you mean like? (await myPromise()).myprop
oh thats a thing?
beat me to it
first!
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```
no
you can also update your cache with a one liner
oh i might want to do that
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
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) }
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
db.find is async tho, so wouldnt i have to await it in the set
no
yes, i just omitted it for faster writing
in the same way? (await db.find())?
yup
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
👍
How can i defind member in roleCreate event?
How to show Memory Usage on glitch.com?
there is no context of a member in the roleCreate event
They have a forum for that, otherwise if you wanna get their servers memory usage
anyone know the ratelimit on how many users you can fetch/second
the ratelimits aren't static and you don't need to type in bolding
it doesnt matter
Im asking about the current rate limit
and ive googled, also read pins
i literally just said that the ratelimits aren't static
they don't have a certain value
they change
@modern sable I asked a question and this person is being unhelpful please help
i literally just said that the ratelimits aren't static
they don't have a certain value
they change
???????????
sigh
they have a basic value but I cant find it
like messages have a 5 / second
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
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.
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
...?
@earnest phoenix You should be more open to people asking for help, not just indirectly call them stupid. .
stop putting words into my mouth
I literally know that. The point is all ratelimits have a current value. Like message ratelimit it has a basic value
im just gonna go and ask in the d.js server instead
Did you even read what I said
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
I never said I was going to put them into code
what is your goal
I legit just want to know the ratelimit
yes ratelimits have a value, but they change so they aren't known
they're known only for specific crucial endpoints
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
ratelimits adapt to how often you hit the endpoint and what are the response codes
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
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"
i went straight to the point instead of trying to bargain
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
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
Good christ
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
anyway 
excuse me has anyone already worked on the event: voiceStateUpdate
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
french
Yea
french yes
but i dont understand what the issue is
Nor do I
the bot logs when a user mutates and I don't want to
then remove the part where its sending the embed?
Mutates?
Well
sorry but i use google translations
That’s what voiceStateUpdate does
It triggers when anything voice related happens like muting, deafening, etc

yes i know but is it possible to modify my "else if" so that the event muting etc does not trigger
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
what
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
let verifLevels = ["None", "Low", "Medium", "(╯°□°)╯︵ ┻━┻", "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"];
verifLevels[message.guild.verificationLevel]```
Thank you man @wicked pivot
no problem
don't spoonfeed code
^
let verifLevels = ["None", "Low", "Medium", "(╯°□°)╯︵ ┻━┻", "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"];
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
code?
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))
oh wait
i don't really do python but i'm guessing the method name defines the command name
async def test
Yea
Either way
Same thing
discord.ext.commands.errors.CommandNotFound: Command "test" is not found
Anyone can help me? My Aliases wont work at all
message.js: https://hastebin.com/relukaxema.js
@lusty dew where are you calling test, i see you have the part where youre loading cogs
What
but i dont see where your calling test at any point or referencing it
yh but it cant find it, thats what im going off
Okay
if youre not telling it where to look it wont find it
🤔
@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;```
@modest maple What else do I have to do
send your full code
I have followed the cogs tutorial
@sudden geyser so how to fix it?
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))
Remove the line and just check if the command exists (where you defined command)
first one does when new vote arrives + #topgg-api
Ok
@lusty dew uh
You uh, realize that bot.run doesn't return until the bot closes right?
Also don't look at tutorials for discord.py
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
Huh
No you need to load the cogs before you run the bot
How do I get rid of the white border around the bot avatar?
https://top.gg/bot/643103079679393792
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
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
- #topgg-api
- have you actually got your port opened on the right port?
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?
you most likely already have something listening on port 80
Who now how to create the system of webhook vote ?
For using ports under 1024 you often need admin rights
that too
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
Does the indentation match up with the rest of the code
Never mind I fixed it
@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
Image previews on certain site doesn't work.
How can i fix it?
can't make image embed too
(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 Embedded images from sites work using meta tags I think.
@earnest phoenix that link gives me access denied
// 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
Did you just copy his code, added a syntax error and removed the js language from the codeblock 
FRICK I FORGOT A ,
// 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
ok
i edited it alr xD
hello there
hello there
how r u doing?
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
@late hill There need to be a kind of Folder/File where it gets saved in
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
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
but i've defined it thats the point
Ids are not ints

They cannot be ints
But why does is send the: send of undefined error
channel is undefined
Because they exceed the 64 bit integer that javascript uses
But its defined
meaning you should pass a string and not int
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
Using find can still return undefined
stop blaming js for your lack of knowledge and learn
you need to check if data exists before acting
thats a given
Ouf i've 6 shards but how can i make that he's finding the channel
why do you have 6 shards
maybe const
Okay i'll disable the shards for a short time thats better
const will not do anything



