#development
1 messages · Page 707 of 1
if type is not supplied, it falls back to "text", but the discord api expects a channel type ID, not the string "text"
GUILD_TEXT's id is 0
Oh okay...
its already fixed in 11.5-dev
ok, i know how to do this in async, but how would i use a custom prefix (eg calling the server before it's sent)
import nekobot as nb
import nbapi
bot = commands.Bot(command_prefix=prefix)```
how would i change the prefix before the bot variable
Would i need to go through every server it's in?
How does one go about creating an eval command and what does it do?
it.. evaluates code
Oh cause I've seen people use it to do stuff?
yes
eval()
And only bot owners can do it because you can get the bot's token
store prefix in database
shivaco
ima finally go away from json
reccomend me a db in dm pls
since you convinced me to use rewrite
idk i saw your username
¯_(ツ)_/¯
How do I get the uptime of my bot? For stats command.
@west spoke use a function to check the prefix and just pass it
uh
could you help me with that

honestly i think #= is fairly uncommon
¯_(ツ)_/¯
so ill just keep it for now
until I properly learn rewrite

@west spoke quick Google search showed this https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
A Cogs Example for the rewrite version of - discord.py - bot_example.py
Nickname for others or just the bot
Because for members I think it is MANAGE_NICKNAMES
I don't exactly wanna mess with cogs
@earnest phoenix just the bot itself
Ah yeah CHANGE_NICKNAME should work then
👌
@west spoke i use json for change prefix
def get_prefix(bot, message):
with open ('<ur json>', 'r') as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
bot = commands.Bot(command_prefix = get_prefix)
no?
sqlite is good for small bots
in order to scale though youll need an actual db eventually
like mongo, postgres, mysql, etc
i dont like postgres
also mariadb > mysql

mariadb is better mysql
Sqlite can handle anything that you can run on a single machine
The only point at which you need to move to mysql/postgre/mongo is when your bot needs multiple machines
this.options.shards.filter(item => !isNaN(item) && item >= 0 && item < Infinity)
^
TypeError: this.options.shards.filter is not a function```
 can anyone explain this
Shards expects an array
You dont use shards
The shards option is to define the shard ids that this client should run
so that's not how you do internal sharding ok
It is, but if you know which ids you want
what do i use if i don't then
I dont remember, im on the phone, but there are other sharding options, check the client docs
mkay
shardCount i think
only takes a number apparently
how do you get util
Discord.util or {util} = require(discord)
what do i do
you do python v3
Oh, you're missing a ) in the above fn
await ctx.send(embed=embed) *
@outer niche on await ctx.send(embed=embed you forgot a )
Also change your idle's theme sheesh
use the dark theme at least
your eyes will thank you
I mean it was perfectly fine before
Impossible
And it's not doing it to that specific command anymore I moved it all around and it's doing it to another command now
^^
@outer niche you forgot to add a ).
That is gonna happen in python (and any language)
Show above it
It was not having this problem before
show above where the red is
what
show everything above this
yes what abot it
Send a image of it
Eg if the highlited area was a error
We would need to see the above part
(Yes that's async, I'm redoing my bot now)

Show the code above your ASYNC

AGAIN ABOVE
Are you talking about a whole another command
;-;
we dont need that here
@earnest phoenix pls, if you dont have anything helpful to say then please dont send it
okay
Yes
Fixed
Sweet 
@slim heart This channel isn't for that kind of message, last warning
i was clicked into the wrong chat leave me alone
Why is my bot registering non-mod users as mods with this command? https://hatebin.com/fjogyelfzu
Oh
Well
I want to check if the reported person has manage guild so it errors
damnit
assuming i dont need a !
TypeError: Cannot read property 'first' of undefined
we love that
it just worked

I seemed to have fixed that issue, but TypeError: reportChannel.send is not a function the same thing works for something else so like 
@ember atlas are you sure reportChannel isnt the report channel's id
today kids, we learn about the benefits of properly naming your variables
dont you need to resolve it into a channel before you can send a message to it
ok so i need to resolve it as a channel name rather than an id to send it?
w-what
id assume you need to resolve it to the channel object
you cant send a message to a string in this case
hm
im not fluent with whatever discord lib youre using but id assume its something similar to that
ya im usin discord.js
get channel -> use methods
do what the others said: Resolve a channel with the fetched ID, then send it from there
Ya i did that
this command is stupidly broken
it works fine but it cancels the report when i told it not to
@ember atlas do u even know how basic js works?
You need to get the object
<Client>.channels.get('id');
i bet you $100 bucks that has nothing to do with my issue above
i bet you $100 bucks that you wont try it

i fixed it anyways
nope sorry i don't know what your issue is because i didn't bother reading it at all
😦 ok
when you copy code:
w r o n g c h a n n e l
so i was trying to host my bot on heroku.com and i got this alert msg can someone help me ?
@copper cradle technically no this channel is for talking about bot dev
@unreal hollow get a real host or try heroku support or something
I've created a "userinfo" command with my bot, but it didn't work with certains users. Why?
user isn't in cache
the code
what
the null isn't the problem
yeh but it still doesn't make sense
I've try with regular random members too, sometimes an error occured
"null" is beacause I don't have nickname on the server
the log
(this user HAVE a nickname)
Looks like lastMessage is null? 
message.channel.send(Name: ${user.username}, ID: ${user.id}, Username: ${user.nickname});
this work
thx
if user is the User Object then nickname is nothing
How to "delete" the ping before a message?
...don't send it? Or change message.reply() to message.channel.send()
message.reply() mentions the User.
message.channel.send() dosn't
How do you get text to appear as a link?
Like let's say I wanted Discord to have a link to discordapp.com on it, how would I do it?
users don't have roles; guild members do (d.js). What lib are you using
A message author can have up to 250 roles, which role would you be talking about?
master or stable
stable
GuildMember.highestRole
check out the guildmember class docs for something that looks like it.
so it would be message.author.highestRole?
users don't have roles, only guild members
How do I add custom emojis to my bot's responses and in embeds? All the emojis are in its support server.
well get the id of them
Just put the ID in the message?
WHY MY BOT IS SO GLITCHY
.
now he can't ban users...
Put an :- before the Emoji to get the Id.
:-
remove the :-
\ works too.
and ur good
that would
@earnest phoenix we wouldn't know.
So I put  in the response, for example.
Yes
And it would send:
Testy test
my bot was declined beacause the invite isnt correct, but the invite link is correct help
can someone help me?
contact the mod who denied your bot
Alrighty thank you quality
@astral meteor Yep
@normal crater Discuss that with the moderator who declined your bot, preferably in DMs
Np
the bot HAS the permissions to ban, but it failed
@slender thistle @sudden geyser okay, thankyou
@earnest phoenix bannable's spelled incorrectly
o
line 28, you misspelled banable, should be bannable.
(1 error, and the bot crashes)
yeah
thx
np
but luca declined my bot lol
Search for your bot with the search bar in #mod-logs (bot id) and you'll find the mod
A question I have: How long are user IDs usually?

18 @sudden geyser
iirc 17 characters minimum
One message removed from a suspended account.
Port 5000 is already in use
he is asking what he can do
use a different port?
so 17-18? okay
they're 64 bit numbers
see: https://github.com/twitter-archive/snowflake/tree/snowflake-2010#solution
How do I see the names of servers & their member count my bot is in using my eval command?
what lib
djs
Iterate through the <Client>.guilds collection mapping by its name & membercount. ex: (guild) => guild.name (other stuff...)
How do I get uptime of my bot for stats cmd?
Hello.
How i can paste guild id's in the website?
Servers this bot is in
Guild IDs, max. 3, these display on your bot page and the IDs you enter must be valid servers on https://top.gg/servers/
id1, id2, id3
The servers under those IDs must be listed on https://top.gg/servers/
Thanks
Does loading commands with a handler increase memory usage that much, I thought the increase was due to a command, but after playing around with that I don't think it's directly caused by a certain command, leaving it seemingly be the command and event handler. Would something like that really increase memory usage by 30mb (discordjs)?
Or would it be something I glossed over when checking each of the commands
30mb cant be caused by command handlers
What does mean this erro unexpected token { ?
unless you're doing something seriously wrong
it means that you have something wrong in your code
Ok I check this
I mean the command handler is pretty basic ```js
client.commands = new Discord.Collection();
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(./commands/${file});
let commandName = file.split(".")[0];
client.commands.set(commandName, props);
});
});
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
const event = require(./events/${file});
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});```
unless it really is somewhere else in the code, which I suppose it could be
how do you know those 30mb are caused by the handler and not by the cache?
I mean I suppose I really don't it was just an assumption based on the occurrence of how it started
I'm not knowledgeable on memory related things very much at all, if it were to be the cache, is there much that can be done, or is it just the way it is
there is a lot that can be done, but not obviously so, and not easily either
the easiest thing you can do is disable message caching if you dont need it
by setting maxMessageCache to 0
other than that, you can either sweep the other caches regularly (users,members,channels.roles,emojis,voice states,presences)
or intercept their events to prevent caching in the first place using the raw event
you can also get some mileage by disabling event processing for events you dont need in the client options
is there a discord.py discord?
yes
I cant post an invite though because I'm a white name
r3sSKJJ this is the code tho
When my bot joins a new server, how do I post that into a logging channel in its support server with said server's information?
fetch the channel and send the message
listen to the guild join event and use logic from there
Yeah, but how do I get the info of the server my bot joined?
the guild object is passed in the guildCreate event, assuming youre using d.js
yes djs
some.thing().then(do => do.that()).catch(err => console.error(err))```
something like this works
probably

I dont think it even matters the order
¯_(ツ)_/¯
.then if you want to handle the received stuff. .catch if you don't plan on doing anything with it. The order does matter. .catch(...).then(...) handles the .then for the rejected promise
I was doing msg.author.send('some error occurs here').then(m => m.delete({timeout: 5000})).catch()
that works
Was just unsure
@knotty steeple that makes no sense lul, disabling message cache doesnt interfere with that
megathonk
did you try setting it to 1
yeah try setting it to 1 then
Waht does unexpectited identifier mean ?
syntax error
that's not valid typescript/javascript
please learn the language before trying to code a bot in it
let me tell you where you dont start: making a discord bot
sololearn is also good for learning syntax
@mossy vine js and node.js isnt the same rEEE
node.js is a javascript runtime outside of a browser environment
Yep I know that
just learn js and you basically can do node.js
might get taught on using js in the browser tho
How i can delete this arrow in long description on DBL BOT PAGE? I don't know this command line ;/
If i wanted my prefix to be a word like "test" would I put the prefix in my file as "test " with a space after the word? So a command would be test <commandname>.
ok
For users this is https://discordapp.com/api/v6/users/:ID/profile
What is it for guilds?
.
I have found ^^
bots cant use that endpoint
should i download Noda.js ?
@hushed berry really?
You can if you want @cedar brook
@grim aspen How to make a commands to the bot? (Sorry for a lot of questions but I am new here)
bots can't access user profiles
^
No problem I can put my user token on the header
:)
which is against the tos
:/
lmao
it can result in account termination
bruh
@earnest phoenix What thing I need to use to make a commands for the bot?
Is there a way of knowing if you got the 1 hour ban for the API because it seems like my shards can't connect to them for the past 2 hours or so. No 400s hit
@cedar brook read #502193464054644737
kk
With my account i have this
being logged in inside of the browser doesn't carry it to the api requests
you need to supply a token
in the auth header
Bruh
Wait
really i need to script the bot?
no
depends what is hard for you
you need to know a programming language
Bruh
Am I not allowed to use this on a bot command?
no
:/
you're not allowed to use a user token outside of the official discord client
Okay
can someone dm me the link that i can scripting the bot there?
yes
use google
but.... i mean what program i need to download to script a bot
do you use windows?
it's not as simple as you think it is
^
@earnest phoenix honestly thats a great vid
i use windows @jade thistle
yeah, polymatter makes really good videos, enjoying his content a lot
.
https://www.codecademy.com/learn/paths/code-foundations this can be of use but it requires codecademy pro iirc
lucas did you read the links people gave you? like faq
i am noob, i am new in making bots, i need good teacher
@cedar brook windows has a program called "Notepad.exe" and you can write yor code here
but it isnt the best for doing it
i can be your teacher for $20/hour
@quartz kindle WHAT?
tim are you serious rn
"for freep ls"
tim
do you do tutoring for 20 bucks an hour
may i have a teacher for free?
for him, yes
bruh
oh, i thought you do that for anyone lol
i wouldnt mind tbh
what programming language do you wanna start with?
guys! i really need a teacher for free. that who will teach me how to make commands etc.
you think 20 is too much?
...
self-teach yourself if you can't afford a tutor or online services like codecademy
20 per hour is dirt cheap
most developers here are selftaught
honestly, i dont know what the average prices are but 20 seems fair, considering how good you are at teaching and explaining concepts
jesus
nvmmm
hell, i'm a selftaught fullstack jr
40 per hour is more fair
do people actually pay 40 per hr?
time is money my dude
@cedar brook go on youtube and search for "the coding train"
I dont know
okay
I guess it depends on quality
they have tutorials
oh god here we go recommending shitty outdated guides
last time i checked, https://anidiots.guide was pretty good
yeah tim, people have one on one call sessions and they're willing to pay a lot
how tf do guides become outdated?
it's because software development brings a huge amount of profit, so obviously teaching sessions are pricier
oh ok i though you were talking about the programming languages, not the apis
es6 vs old non chad js is a good example
programming languages can become outdated as well
i am downloading noda. js it is good?
Message#timestamp
node is pretty good
thats what
oh
@cedar brook did you read #502193464054644737 ? specially the last section
let me see
even if there wasnt a prop you could obtain the timestamp from the id
discord follows twitter's snowflake system
shift 22 bytes to the right and add discord's epoch
yeah nvim doesnt like unicode
is noda.js installing is taking long time?
maybe
exactly?
it's an environment not a program
you install it as if it was a program so
node:1307) UnhandledPromiseRejectionWarning: Error: Invalid file object
h u h
will post code wait
msg.channel.createMessage("📶 Pongerino",{embed: {
color: 0x7289DA,
description: `💗 Latency (WS): **\`${boatboye.shards.get(0).latency}ms\`**
📬 Message response: **\`${msg.timestamp}\`**`
}})
``` does this not work
what are you trying? we need context too.
im trying to send a message?
the second param takes a file
yes
the first one is an object iirc
yeah first param is either string (message content) or the entire object u want to send
because e r i s
so how do i do message and embed
{
content: "",
embed: myembed
}
{
content: aaaaa
embed: {
color: 0xaaaaa
}
}
thanks eris
const db = require('quick.db');
module.exports = {
name: 'reportchannel',
description: 'Sets the report channel.',
category: 'config',
usage: '<channel name | id>',
run: async (client, message, args) => {
if (!message.member.hasPermission("MANAGE_GUILD")) return;
if (!message.member.hasPermission("ADMINISTRATOR")) return;
let reportchannel = message.mentions.channels.first() || message.guild.channels.get(args[0]) || message.guild.channels.find(c => c.name.toLowerCase() == args.join(' ').toLocaleLowerCase());
if (args[0].toLowerCase() === "disable") {
await db.delete(`reportChannel_${message.guild.id}`)
await message.channel.send('Deleted the report channel in my database. Use the command `!reportchannel [channel name | id]` to set a new one.')
}
if (!reportchannel) {
return message.channel.send(' Please supply a valid channel.')
}
db.set(`reportChannel_${message.guild.id}`, reportchannel.id)
message.channel.send(` Set the report channel to <#${reportchannel.id}>`)
}
}
This command works with the disable thing, but how can I make it to it doesnt send supply a valid channel?
um
@loud salmon ^
-b @cedar brook 10 years old
Banned 🎃LucasPro2534🎃| Halloween!#2875 (@cedar brook)
dang
does not matter read his messages
okk
Hello everyone, I created my webhook for a channel and when I put the link in my bot's info and test it, nothing gets sent to the channel. What could I be doing wrong?
code?
The way I did it was create a webhook on the Discord channel and copied that link into the bot's info in the top.gg website
do I have to code something in order for it to work?
Is this correct?
dblpy = dbl.DBLClient(bot, token)
@dblpy.event
async def on_dbl_test(data):
print(data)```
oh im not a py dude
Is anybody here really good with bots
if you are looking to get someone to make a bot to you message Oliy to get access #434058442764714002
many people here are good with bots
Okay sorry
does anyone know if it's better practice to include tags for each metric on prometheus?
for each process i have it is a label on each metric
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./bot.js', { token: 'your-token-goes-here' });
manager.spawn();
manager.on('launch', shard => console.log(`Launched shard ${shard.id}`));```
I can use the shards but for orders?
Example music.js or moderations.js
:/
what do you mean?
For example, if I want some commands to be available but not others if I update them, can I use shards for that?
that has nothing to do with shards
Example in music.js there are music commands and in moderation.js there are moderation commands
Oh :/
sharding is a system to split servers into different processes
a single process/login can only get 2500 servers
if you have 4000 guilds, you need two shards. each shard is a process managing 2000 guilds
Mmmh okay
if (command === 'stats') {
- return message.channel.send(`Server count: ${client.guilds.size}`);
+ return client.shard.fetchClientValues('guilds.size')
+ .then(results => {
+ return message.channel.send(`Server count: ${results.reduce((prev, guildCount) => prev + guildCount, 0)}`);
+ })
+ .catch(console.error);
}```
I have read this but
It makes it very difficult to order
I don't have 2k guilds lol juste it's interresting
But you have to redo each order for the shards, right?
what do you mean?
Exemple:
2 shards:
1 = 2k guilds
2 = 2k guilds
The controls will not work on both shards
you will have 2 processes
each process will be a copy of your bot
with the same commands
But if in one process i use a port i can't launch a second process...
why do you need a port? do you have a webserver?
Yes i test to make a dashboard
you can put the webserver in the main process, the process where you use the sharding manager
no, the sharding manager does it
'-'
with eris
you have 2 files, the manager, and the bot
you run the manager, and the manager runs the bots for you
What should this manager file look like?
Yes
He is in this github
yes, thats how the manager file looks like
Oh okay
This is really hard to setup shards
So if I use the manager file I don't need to modify the coding of my commands?
This is my last question.
you only need to modify if you have code that is not compatible with sharding
Ah, there's a compatibility story....
for example, if you have a database like levelDB which only accepts a connection from one process at a time
I use sqlite
sqlite should be fine
Okay
also, if you have commands that show the server count
the command will only show the servers for the shard
not all servers
Hi
hello
I need help in troubleshooting my bot
Explain
@charred orbit
which lib?
wait
He won't reply in some servers but replies in here and the main server
sk.dblinfo @charred orbit
bruh
hol on
I can't help you for other librarie..
I can only help you on discord.js librarie
Sorry
Good night
Idk what library it is
That's what I have it as other
the library used to code your bot
Im not the one coding it
My friend is
@earnest phoenix the bot owner is shibe bot loader
uh
not you
lmao
it's not your bot
We're both
are u alt
Nu
but you arent listed as bot owner
I can prove it
so he's muted
Mute evasion?
LOL
I have access to all of the bot
No, im not an alt
his youtube channel is jessie
so are you mute evading?
but why arent you listed as bot owner then
HMMMM
who else is named jessie here
@drowsy sentinel
HMMM

could someone please tell me how to fix this?
Did you check what the docs say for Guild#createChannel?
oh
I feel like I am going to go crazy trying to figure out what is wrong with my code x3
undefined:1
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.<anonymous> (C:\Users\Ori\Desktop\E-Bot\E-Bot\bot\index.js:7:15)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
here is my error and my code is to long to copy and paste here or screenshot.
I don't know where in my code this is happening. somewhere in 814 lines this is hammening and I don't know where
help?
That JSON file isn't formatted properly
@jaunty stump show your json please
I have 3
a package.json
a config.json
and a database.json
I'll show all three
Well just show the one that caused the error
hold up json db
It could just be connection information... never make assumptions @sudden geyser
not making assumptions. just makes me think
I fixed it
the database.json file was empty for some reason despite me not editing it after I created it
@jaunty stump show the json file please
They said they fixed it
also thanks Promise for telling me it was an issue with my .json files and not my main code. I was going crazy trying to find it.
the database.json file is like this btw
@earnest phoenix
Yes i know
np
well, my leveling system/database is working.
now I am having issues with this.
(node:6004) UnhandledPromiseRejectionWarning: ReferenceError: prefix is not defined
at Client.client.on (C:\Users\Ori\Desktop\E-Bot\E-Bot\bot\index.js:14:5)
at Client.emit (events.js:194:15)
at MessageCreateHandler.handle (C:\Users\Ori\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Ori\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\Ori\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\Ori\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\Ori\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
at Receiver.receiverOnMessage (C:\Users\Ori\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:189:13)
(node:6004) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6004) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
like. I know I need to define my prefix.. But at the same time I want to say I have already
Rather than give an error that we have no idea where it comes from
Oh ya 
Ok so js and djs
discord.js/Javascript
and I have like 814 lines of code. it won't all fit here
if I knew what line this is happening on then maybe it will help me
Use hastebin
Well, it's saying prefix is not defined. So... did you define it correctly?
It happening on line 14 In index.js
ok. i'll be right back
Js errors are self explanatory
if it is happening on line 14 then here
Which one is line 14....
What do you want your bot prefix to be
I have my prefix in my config.json
Then it needs to be config.prefix
Are you requiring the config
And you need to require config in one of the first lines of the code
yes I am requiring the config.json file in the first lines of my code
Then anything with prefix needs to be config.prefix
Or however you required config .json
ok. I will look through my code and try to update things. I'll keep you guys updated if I get anymore errors or problems
One message removed from a suspended account.
you could just
have the config on the client
then have access to it everywhere
and not require something more than once when you dont need to
One message removed from a suspended account.
I just did
client.on('message', async(message) => {
if (prefix || (message.content)) {
var parts = message.content.replace(config.prefix, "").split(" ");
switch(parts[0]) {
case 'ping':
const m = await message.channel.send("ping?");
m.edit(`Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
break;
and it responded to my ping and help command
if (prefix || (message.content)) {
One message removed from a suspended account.
One message removed from a suspended account.
yea
One message removed from a suspended account.
just for the ping and help command and this
client.on("message", message => {
if (message.author.bot) return; // ignore bots
and this
client.on('ready', () => {
console.log('ready!');
});
One message removed from a suspended account.
?
One message removed from a suspended account.
it is to let me know what it does
it's a comment
I use comments to make my life easier
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
well now that I got the ping and help command to work. Every other command I do is being completely ignored and I don't get any errors
is it possible to get the Guild.icon_url from a Guild.icon in discord.py? if so how
^ i found https://cdn.discordapp.com/icons/{ID}/{ICON}.webp?size=1024 (is there another way though?)
its with oauth2 and the users guilds doesnt have an icon_url @west spoke
shouldve specified
How can i make args.join(" ") to lowercase?
no. dont works at me
Uh k
.lower()# converts to lowercase
In python
What language do you want it in? @stray garnet
i tried, but dont works
discord.js that's work
ik but not for me
Can embed footers contain custom emojis?
Okay
hello, how do i do that the embed fields will go the side like in that picture
and not like that
in discord.js
You want their avatar in the corner?
no
Or inline fields?
see the embed fields will go to sides
Yeah inline fields
yh i think inline thas called
Ya you need to use true
so how do i do that?
What Lib?
discord.js
add ,true after each field
.addField(title, text, inlineBool)
.addField('Hi', 'Info here', true)
So inlineBool would be true if u want inline
That’s what I’m saying to do
Oh lol you said bool
I’m just trying to not tell him to just throw true into his statement with no idea what it does
You absolute large brains
Yes
U sure
Anyways @earnest phoenix got it?
Have it not inline
The 3rd iirc
It’ll affect the next one over
If not the 4th
But it’ll auto format because it can’t just like go on forever
One message removed from a suspended account.
no, bulky text no one cares about, duh
i really wonder whose idea was to make that lool
One message removed from a suspended account.
Well depends... Are you on master or stable
One message removed from a suspended account.
https://discord.js.org/#/docs/main/stable/class/ShardingManager?scrollTo=shards I'm not 100%, but I'd start here
I would think they iterate the Collection and fetchClientValue for https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=status and guilds.size
question for the dblapi.js:
how can i get the coding language of an Bot?
One message removed from a suspended account.
Hey I’ve recently created an MMO for my bot but a lot of my players are having issues with the cooldowns.
I have a a few cooldowns that are 10 minutes long, but for some reason they are sometimes stuck on cooldown forever.
I originally implemented cooldowns by writing their ID’s to a JSON file and having the program check if their ID is in there. With a low amount of players, this works fine. When 100+ players are playing, it didnt work that well anymore. I thought it’s because if multiple people use the command at once, the file gets written to at the same time and therefore gets out of sync, and also because my PC was writing to a JSON file too slow.
Is there a better solution for this? Should I be putting the cooldowns in a player specific JSON file instead? I already have player specific JSONs to manage their MMO progress. Any help would be greatly appreciated!
stop using IO
keep cooldowns in memory
cease
you should never use files as a database
@sage bobcat The Libary of the Bot
you don't unless the owner exposes it
e.g on an info command or on a website
you seem to be misunderstanding how bots are ran
@earnest phoenix info command
a bot being alive and listening to messages is no more than a mere websocket connection, what language it used to achieve that is not revealed unless the owner explicitly defined it in a command or on a website
I have my cooldowns stored in a Collection
^ yeah it's probably the best to keep cooldowns like that, in memory
Ok that’s exactly what I did a few days ago, I just stored the ID’s in a list instead of JSON files and called that list every time I needed to check for cooldowns
But I’m still running into the same issue when a lot of players use it
optimize it
True
Yea it only needs the ID of the player, which is the only thing going in there. I just do set.add and set.delete when I need to mutate it and put them on or take them off cooldown. I have a setTimeout function to remove them from the cooldown list when it’s time
The bot is hosted on my PC and not a dedicated hosting service (yet)
javascript generally isn't a language that's performant so a huge amount will require bigger end hardware
I do have a very good pc, 64 gb of ram should definitely be enough
Do you think moving to a dedicated service would solve this problem? Or is there something I’m missing?
By the way thank you so much for helping out so far
i mean, yeah, obviously
your pc is being used for things other than the bot
meaning the bot process cannot use its hardwares capabilities properly
Yea lol I do play a lot of destiny with my friends
which is why there are flops in performance
But even when it’s idle during the day when I’m at work, it still has this issue
it's probably because of uncleared cache used by other processes/games
Are we forced to create a new file for our commands or can we do everything in index.js ?
your choice
id probably recommend making each command a seperate file though
much easier to work with
Ok but I can't associate index.js and fun.js ( The command file for fun :X)
If your bot is small/limited (like having 2 or 3 text commands), then having everything in one file is fine
Oki thank u very muvh ;D
But if it is bigger or your foresee it getting bigger, then do multiple files
if you have a lot of commands it gets cluttered after a bit
For the moment I'm gonna keep just only 1 file
Aye, it's personal preference anyway - whatever is easier for you. And with big projects, seperate files are easier to maintain
you dont have to scroll through 5k lines to fix a command then
Exactly
Also performance and modularity
Can you say what is wrong in my code ?( I'm beginning js)
Oki thank u ;O
I don't find the solution in discord.js 😬
^
is your command a class?
I tried everything but still not working
Did you learn JS beforehand
Pretty sure he was told before about learning the basics of JS but refuses to do so
I am actually /learning/, I just start yesterday a video about node.js ( Grafikart )
tthen maybe dont jump straight into bot? there are better ways to learn
Why not get off the not beginner-friendly library and learn the very basics first?
You are barely learning to do anything useful for yourself if you jump straight into something without learning
we told you yesterday to go learn the language
Yes u are probably rigth, but I thpugth that create a bot would be a good way to lean js
It's a very bad idea
you can't create a project without even knowing the language syntax
what you thought was wrong
You are right ...
please stop rushing into it, take your time and learn the language
it's not a thing you do in 15 minutes
You should probably start with python or something tbh
Python is very beginner friendly
JS and Python are somewhat beginner-friendly
True
Then again, it comes to preferences
I prefer python to teach people because it reads how you think, if that makes sense lol
python has a distinctive syntax from what you're going to be met with later on if you get into software engineering
it's also really not performant since it's interpreted code
Python is definitely a special child
not a bad one
just special
I still never bothered to try Python
i had basic experience with in cs
disliked the syntax so much
Yeah I've tried python for a bit, I just couldn't get used to it at all
depends on the developer
not everyone wants to or should learn
pssh
what even is it
you might be able to find something on https://top.gg/ if its not insanely specific
dbl needdev @winged rapids
DBL is not a place to find developers for jobs. You can try and put a request on Fiverr or Freelancer. Please do not post the request again. Doing so may result in punishment.
Dude I am just trying to see a price for now
Like a average I’m not asking for anybody to make it right now
it takes a week or more @raw sail
really?
yes
no, because there are around 200 other bots to review @raw sail
there is a line
you must be patient
Efficiency at it's best.
data.timestamp = data.timestamp ? new Date() : undefined;
Now instead of typing timestamp: new Date() I can type timestamp: true

I save 5 valuable characters



