#development
1 messages ยท Page 1539 of 1
I know this isn't the right channel to ask, but does any dpy dev wanna work together?
I have a good bot idea.
You started good, but ended catastrophically
guys i have wage problem
i cant login in the bot
when i use other bot to login eith same code it works
but the main bot stucks
terminal only shows nothing after node .
no errors as well
plus my bot is under verification on discord
Help plz 
must be something wrong with your code
bruh it works on other bots
i used it
Don't exclude the possibility of CF ratelimit
Don't u really get anything on the console?
Like, anything
freakin windows powershell
Why are you localhosting it tho
this is why i use cmd 
because the host also died
try using the terminal instead of powershell
having same issue
whats that
Cloudflare, but it's definitely not ur case
No
ufff how to fix
how about this
ignored.exe lul
pretty sure that removes the giant red error thing on your console
doesnt work
yea the red thing went
imma go kms my bot just crashed cuz files are missing that MADE THE BOT FUNCTION cuz after the reboot some files were corrupted and i dint notice the bot was fine but it was starting to fall apart and i just spent 24hours up from coffee and now this will take 3 hours to reprogram them brb
Wot
@umbral zealot sorry to ping needed urgent help with that
"files were corrupted"
Are you using json storage btw?
Also, use git, it's a must for every project
no its fine tho my files are kinda in good shape rn eh imma sleep ill just post a announcement saying its under work and ill be fine then ill deactivate the bot
ok
From inside the code?
You could open the class file as text
Then use regex to retrieve docs
Afaik comments are ignored during runtime, which includes javadocs
Open the class file directly
I don't mean the compiled one
I mean the original
Unless it's a standalone executable
If you use github, u can also retrieve the classfile content through direct link
You can fetch the javadoc from the official site can't u?
Iirc they do have an api
If not, you can just download the javadoc files
No, i mean, javadocs are actual files stored in the official site
All IDEs download/fetch them
Idk exactly how it's done, but all ides gotta download the javadocs for ctrl + space usage
I'm pretty sure all vanilla java packages have their javadoc files
guys i hv a problem with 429 ratelimit error
i am not able to acces the discords api
till last night it was fyn ...
is there any fix?
i use repl.it
429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.

Guys
how to fix this Unicode error in logged = json.load(open('Logged.txt'))
(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
what are you trying to do
Opening the file
what's in the file
Dict
Working in VS Code but not in Python IDLE
message.member.voice.channel.join()
.then(connected => {
connected.play(ytdl(args[0]))
})```
why doesn't it work?
cyclomatic complexity too high
can anyone give me code of a reload command with sharding in js ?
@client.event
async def on_message(message):
if message.author == client.user:
return
What's the error?
cyclomatic complexity high
i did
so wat do i do now
chill ill show
Nah I'm praying here don't mind me
yo, how do i whitelist channels on my server for gambling bot, so you cant post it iin all chats
Hey this is my reload command code and has an error debug is not defined
try {
let file = path.join(__dirname,'..',`${command.config.category}`,`${command.config.name}.js`);
file = client.replaceAll(file,"\\","/");
console.log(file);
await client.shard.broadcastEval(`
delete require.cache[require.resolve('${file}')];
const newCommand = require('${file}');
newCommand.category = ${command.config.category};
this.commands.set(newCommand.name, newCommand);
`);
message.channel.send(`Command \`${command.config.name}\` was reloaded!`).then(msg => msg.delete({timeout:5000}));
} catch (error) {
console.log(error);
}```
the error comes from the djs sharding manager file
throw new Error(error)
i'm sorry, why are you wrapping an error in an error
leave that --- I am doing something else too
i don't use d.js so i can't help you
Fixed some things still the same issue
try {
let file = path.join(__dirname,'..',`${command.config.category}`,`${command.config.name}.js`);
file = client.replaceAll(file,"\\","/");
console.log(file);
await client.shard.broadcastEval(`
delete require.cache[require.resolve('${file}')];
const reqCommand = require('${file}');
const newCommand = new reqCommand();
newCommand.config.category = ${command.config.category};
this.commands.set(newCommand.config.name, newCommand);
`);
message.channel.send(`Command \`${command.config.name}\` was reloaded!`).then(msg => msg.delete({timeout:5000})).catch();
} catch (error) {
client.log.error(error);
}```
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "bal" is not found
async def gstart(self,ctx):
await ctx.send("Let's start with this Giveaway! Answer these questions within 25 seconds.")
questions = ["Which channel should it be hosted in?",
"What should be the duration of the Giveaway?",
"What is the price of the Giveaway?"]
answers = []```
please help
xD
whats the error ?
wait
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "gstart" is not found
@old cliff
use hastebin
yes
its offline
sad
# @commands.has_permissions(administrator=True)
async def gstart(self,ctx):
await ctx.send("Let's start with this Giveaway! Answer these questions within 25 seconds.")
questions = ["Which channel should it be hosted in?",
"What should be the duration of the Giveaway?",
"What is the price of the Giveaway?"]
answers = []```
see this
Show code of another command the bot has
you're going to have a hard time parsing the response by the way
best to ask the questions one by one
Bruh I am soo silly
newCommand.config.category = ${command.config.category};```
I forgot escaping
```js
newCommand.config.category = "${command.config.category}";
I AM SOOO DUMB
Does this !?? exist for js?
idk
discord.ext.commands.errors.CommandNotFound: Command "gstar" is not found
Ignoring exception in command gstart:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/Bot/cogs/giveaway.py", line 43, in gstart
msg = await self.client.wait_for('message', timeout=25.0, check=check)
File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
return fut.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 370, in dispatch
result = condition(*args)
TypeError: check() missing 1 required positional argument: 'm'
The above exception was the direct cause of the following exception:```
If the left operand is not null or undefined do (return) right side
lol
you can just invert the left hand side
actually
i am not sure
Ignoring exception in command gstart:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/Bot/cogs/giveaway.py", line 43, in gstart
msg = await self.client.wait_for('message', timeout=25.0, check=check)
File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
return fut.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 370, in dispatch
result = condition(*args)
TypeError: check() missing 1 required positional argument: 'm'
The above exception was the direct cause of the following exception:
JAGUAR ๐คดToday at 11:41```
i have to test but im on phone
show full command code
bin it
aight so you can do something like !x ? x : y
note that this checks for all falsely values
because it's not trash
makes sense
@pale vessel btw do you know how to get shard id of a client ?
TypeError: check() missing 1 required positional argument: 'm'
you can use guild.shard.id
are you sharding?
tf?
*experimental
is that
I want to set individual statuses for individual shards with shard id
what is sharad?
*shard
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
why is it like this
NO SELF
Scroll up
did
it looks weird
ng exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'convert' is not defined
ppq9q9w883uruhrb3bu2788w8w8w8ww888
wtf?
Ignoring exception in command gstart:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/Bot/cogs/giveaway.py", line 58, in gstart
time = convert(answers[1])
NameError: name 'convert' is not defined
what is convert
to secs
def convert(self,time):
pos = ['s','m','h','d']
time_dict = {'s' :1, 'm' :60, 'h' : 3600 , 'd' : 3600*24}
unit = time[-1]
if unit not in pos:
return -1
try:
val = int(time[:-1])
except:
return -2
return val * time_dict[unit]
@commands.command()```
Where did you define it
convert
convert.
?
Why is life so hard
cause it is?
Why are you using self there
because of my dumb friend
Are you making it a method and not just a function
"I ask myself that everyday"
flaze I at least have hope because I GOT MY PAYPAL ACCOUNT BACK
But people here ๐
do shard numbers start from 0 or 1 ?
How would i make this into a command, and if the user have the option for no dms for anyone it sends a message in chat, my friend made me this right before he went to bed lmao and i am so tried so i stopped trying after like 5 minutes
const linkId = pool.createLink(member.id);
const embed = new Discord.MessageEmbed()
.setTitle('reCAPTCHA Verification')
.setDescription(`Solve this captcha, and you wil get access to the server. \n\n\nhttp://${domain == '' ? 'localhost:8080' : domain}/verify/${linkId}`)
.setColor('RED')
member.send(embed)
})```
catch your send method
it will error if their DMs are closed
member.send(embed).catch(error => channel.send(embed)) for example
but you need to define a channel to send to first
A reCaptcha bot
Oh i know that
oh i understand, i'll try, But i was asking how would i make it into a command?
How would i fix message is not defined?
did u define it ?
Is it possible to make a command which can tell how many messages are there in server like 10,000 total messages
Ohh thanks
Is soneone able to fix mu code because when I upload a new video or start a stream on YouTube or Twitch it is not posting it in my discord
lol
so my bot has an autorole feature that adds a role to members when they join. for some strange reason, it seems that, sometimes, the role is added according th audit log but the member does not have any or that the bot automatically removes the roles as soon as it is added. Any clue why?
give me a minute to get my code
MeyamaClient.on("guildMemberAdd", (member) => {
MeyamaClient.stats.members.joined++;
if (member.user.bot) return;
let joinMessage = MeyamaClient.db.get(`${member.guild.id}.config.joinMessage`);
if (joinMessage) MeyamaClient.AR(MeyamaClient, joinMessage, {
type: "welcome",
member
});
if (MeyamaClient.db.get(`${member.guild.id}.config.roleAtJoin`) && !member.roles.cache.has(MeyamaClient.db.get(`${member.guild.id}.config.roleAtJoin`))) {
try {
member.roles.add(MeyamaClient.db.get(`${member.guild.id}.config.roleAtJoin`));
MeyamaClient.stats.roles.added++;
} catch {
"1";
}
}
if (MeyamaClient.db.get(`${member.guild.id}.config.backupRoles`)) {
let roles = MeyamaClient.db.get(`${member.guild.id}.${member.user.id}.backupRoles`) || [];
try {
member.roles.add(roles);
MeyamaClient.stats.roles.restored += roles.length;
} catch {
"1";
}
}
});```
code sucks ik
im not able to use iframes in my bot page
Are you sure you linked it properly?
yes
this
shouldnt this be fine?
when i preview it its blank
@slender thistle
well shrug
hey guys
TypeError: Cannot read property 'hasPermission' of null 2021-01-21T07:50:45.297121+00:00 app[worker.1]: at Object.module.exports.run (/app/commands/warn.js:7:23) 2021-01-21T07:50:45.297121+00:00 app[worker.1]: at Client.module.exports (/app/events/message.js:11:13) 2021-01-21T07:50:45.297122+00:00 app[worker.1]: at Client.emit (events.js:326:22) 2021-01-21T07:50:45.297125+00:00 app[worker.1]: at MessageCreateHandler.handle (/app/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) 2021-01-21T07:50:45.297133+00:00 app[worker.1]: at WebSocketPacketManager.handle (/app/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65) 2021-01-21T07:50:45.297134+00:00 app[worker.1]: at WebSocketConnection.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35) 2021-01-21T07:50:45.297134+00:00 app[worker.1]: at WebSocketConnection.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17) 2021-01-21T07:50:45.297135+00:00 app[worker.1]: at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:120:16) 2021-01-21T07:50:45.297135+00:00 app[worker.1]: at WebSocket.emit (events.js:314:20) 2021-01-21T07:50:45.297136+00:00 app[worker.1]: at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:789:20)
why am i getting this error?
yeah i am the guild owner
so the guild owners can't use the bot?
check your code, where do you get the member?
the property before hasPermission()
wait let me get the code.
module.exports.run = async (bot, message, args) => {
if (!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("You don't have `KICK_MEMBERS` permissions.");
let wUser = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0])
if (wUser === message.author) return message.channel.send("Are you retarted? Why do you wanna warn yourself?")
if (!wUser) return message.reply("Couldn't find the user.");
let reason = args.join(" ").slice(22);
if (!reason) return message.channel.send("Please provide a reason!")
if (!warns[wUser.id]) warns[wUser.id] = {
warns: 0
};```
message.member is null
how
Either it's not cached or the message is from a DM
only you?
yeah
does this happen often
yeah i cannot use the ban, warn, kick commands either
maybe because i use v12, but haspermission is v11?
@pale vessel
that method still exists
hmm strangeg.
log the author and the member
put console.log(message.author, message.member, message.guild.members.cache.get(message.author.id)) on the top of the function
This is giving me aids, it gives me unexpected token ')' then i remove that token sends me expected token ')' client.on ('guildMemberAdd', member => { const linkId = pool.createLink(member.id); const embed = new Discord.MessageEmbed() .setTitle('reCAPTCHA Verification') .setDescription(`Please verify using this link! @${author.tag}\n\n\nhttp://${domain == '' ? 'localhost:8080' : domain}/verify/${linkId}`) .setColor('RED') member.send(embed).catch(error => client.channels.cache.get('800979412971290664').send(embed)) .then(msg => { msg.delete(900000)
i git stage 4 cancer from this
then(msg => {
msg.delete(900000)
}) //to close the then
}) //to close the client.on```
just make sure every ( or { closes at some point
np
I WAS ON THAT FOR 7 YEARS
One more question, how would i mention the user in a embed?
you can do <@userid>
xD
Should I make a AI bot, which saves all questions here, then they can ask the question on a specific channel lol
do it
lmao ok
as many as you can, as long as they are optimized
at least one or two
cuz right now i am hosting 2 bots and 1 website on it.
i need to add 1 more bot.
but will it hold?
check your memory usage
@tight plinth
the only thing you can do to make it faster is optimize your code and cache less
eh do you know if its possible to cache less?
idk how to discord.py
ah damn it
just wait for someone like @slender thistle to help you
it needs to be in 75 servers
not exactly a discord.gg problem but its a problem that most likely came up a lot here, anyone knows how to reduce loading time when starting the bot?
Well...
I'm not sure what you are even doing in the first place
or the size of your bot
most of your load time should come from discord anyways, how many servers do you have
500
Thing is itโs loading tons of stuff I donโt even use in my bot so Iโm trying to see if I can make it load only what I need
help my messageReactionAdd event is not working
no console, no error
nothing . . .
const ms = require("ms");
module.exports = {
//!tempmute @user 1s/m/h/d
name: 'mute',
args: true,
run (message, args) {
let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!tomute) return message.reply("Couldn't find user.");
if(tomute.hasPermission("MANAGE_MESSAGES")) return message.reply("Can't mute them!");
let muterole = message.guild.roles.find(muterole => muterole.name === "muted");
//start of create role
if(!muterole){
try{
muterole = await message.guild.createRole({
name: "muted",
color: "#000000",
permissions:[]
})
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});
}catch(e){
console.log(e.stack);
}
}
//end of create role
let mutetime = args[1];
if(!mutetime) return message.reply("You didn't specify a time!");
await(tomute.addRole(muterole.id));
message.reply(`<@${tomute.id}> has been muted for ${ms(ms(mutetime))}`);
setTimeout(function(){
tomute.removeRole(muterole.id);
message.channel.send(`<@${tomute.id}> has been unmuted!`);
}, ms(mutetime));
//end of module
}```
Itโs showing error with await....
But I donโt see anything wrong
awaits can only be used inside async functions
module.exports = async(client, reaction, user) => {
console.log("Someone reacted");
}
This fucking event is even not emitted, help me
I tried with client.on('messageReactionAdd') but still don't work (without event handler)
on djs light with bots with each 8k guilds: 10 bots lol

does anyone have this issue? when i try to add a role to a member when they join, the bot adds it according to audit log but it's actually not added to the member
module.exports = {
name: 'ban',
/**
* @param {Message} Message
* @param {string[]} args
*/
run: (message, args) => {
const target = message.mentions.members.first();
const reason = args.join(' ');
if (!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send("You Don't Have Permission!")
if (!target) return message.channel.send(`<@${message.author.id}> please mention a user to ban`);
target
.ban({ reason })
.then(() => {
const embed = new MessageEmbed()
.setTitle('The ban hammer has spoken!')
.setDescription(`<@${message.author.id}> banned <@${target.id}>`)
.setTimestamp(new Date())
message.channel.send(embed);
})
.catch(err => {
console.log(err);
message.channel.send(`<@${message.author.id}> error while banning <@${target.id})`)
});
}
}```
Why is it showing error with the last line
maybe a discord visual bug?
hey guys
const test = message.member
console.log(test)
if (message.author.bot) return;
if (!message.guild) return;
if (!test.hasPermission("BAN_MEMBERS") || message.author.id !== n.oID) {
message.channel.send("You are missing the permission(s): Ban Members.");
} else {```
i have a role assigned to myself that literally has all permissions
when i use a command it still returns me the error message
could anybody help me with this problem.
Is there a tutorial or documentation on how to allow multiple people to edit a discord bot? (Preferably on GitHub)
You can invite users to become collaborators to your personal repository.
english
any errors?
yeah somon is Snowy
and you are using his bot template
anyways
try &&
you're doing if they don't have perm or they arent n.oID
so someone can have perm but be oID and still no and vice versa
if you use && you're checking if they don't have perms AND aren't oID
o/ does this look okay
how can i start pm2 with a node option like node --experimental-modules index.js
you can use the ecosystem.config.js file
example
module.exports = {
apps: [
{
name: "Meyama",
script: "index.js",
autorestart: true,
watch: false,
},
],
};```just put the argument you wanna run ur program with in the script section
Your urgency needs are of no relevance to the fact that you should not ping me or anyone from staff for your development issues, kthx.
where do i put that
in the same folder as your index.js file
also where do the node opts go
o
pm2 --node-args
99% sure it doesn't work
oh shit

tim here to save the day
ig imma belive u
or in the ecosystem file: "node_args": "--max_old_space_size=500"
you can do "script": "index.js --max_old_space_size=500" tho
i guess, although they dont mention it in the docs
so it would need to be tested
somethings in pm2 are confusing af if not blatantly bad design
pain
i had tons of issues getting logging to work the way i wanted
you need to start the file
without being in pm2 already
ye
So um I am making a discord.py bot and I wanted to make an economy system but whenever i run my beg and balance command it just gives the error Command raised an exception: TypeError: object method can't be used in 'await' expression. Some help would be gratly appreciated.
Code: https://srcb.in/N7QMJ3kD4H
if its already in the pm2 list, it keeps using whatever options it was added to it with
now it just doesnt start the server
errors?
nope
then how does it not start?
oh nvm its just throwing the same error as before
which is?
How do i show the name of the developer
in py
bc i think ctx.guild.owner is wrong
whats your node version?
you mean your name? because guild.owner is the owner of the guild where the message came from, not the owner of the bot
aeaaaaeeeeaaaeeeeeeaaaaaaeeeeeeaaaaa
@quartz kindle hey, hey, hey
Yeah my name
likely client.user.username, or something similar
Get application info, get ID of the owner, call get_user on it
12.20
@quartz kindle I got a question
The bot's name - client.user.name
and you dont want to use node 14?
ok imma try.
wut
I just haven't got round to installing nvm
i guess this chat is too active
I'm tied I meant nvm
yeah
do you have type:module in package.json?
i only ever use them in ts
@quartz kindle y'know how in d.js you can do message.channel.send({embed: {description: `and other things`}})
Si
yas
I'll update to 14.X
Line 52 - missing parentheses
from what im reading in SO, most people recommend ditching node's native ES modules and use the esm package instead
lol
whenever I do
message.channel.send({embed: {thumbnail: client.user.displayAvatarURL(), description: `bla bla`}})``` it returns this https://i.imgur.com/4zCNbxc.png
but whenever I make a normal `let embed = new discord.MessageEmbed()` it returns a normal looking ass embed
o
Hmm ctx.user.username doesnt work for me?
member.setNickname(nickname)
.catch(err => {
const b = new Discord.MessageEmbed()
.setTitle('Error')
.setDescription(err)
.setColor('#bb1414')
message.channel.send(b)
})
message.channel.send(embe)```
i get this
what shall i do?
But i use cog tho
@slender thistle THANK YOUUUU
ok
just do {thumbnail: {url: client.user...}}
ah ok
uhm excuse me
nani the fuck
ip leak brotha
@green kestrel man?
oop
i always respond quickly i just don't say "got it" ๐
ah noice
speedy is pog
so now
i got a problem
member.setNickname(nickname)
.catch(err => {
const b = new Discord.MessageEmbed()
.setTitle('Error')
.setDescription(err)
.setColor('#bb1414')
message.channel.send(b)
})
message.channel.send(embe)```
what's wrong?
no permissions to set name?
and just so you know you can't set the nickname of an owner
i just want it to send one error embed
well maybe actually do instead of making me think ur a slow mod that doesnt represent his username at all
it sends me both success and error
either await or .then
await setNickanem
Nickanem
yes nicknaem
nice
nicknaem
yes nickamen
.setNickmane
still doesn't work :(
remove the catch
or change it to return something
let result = await bla().catch(() => null)
if(!result) return sendError();
await sendSuccess()
or
try {
await bla()
await sendSuccess()
} catch(e) {
await sendError()
}
or
bla().then(() => {
sendSuccess()
}).catch(e => {
sendError()
})
these are all different ways of doing the same thing
I tried using self.bot.user.name but it's what i want bc that just shows the name of the bot instead of my name
sorry but what i have to type here in password
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
What do i have to do to show my name in the about command?
await bot.application_info()
then from the appinfo you get owner
yes
I mean this is my code:
em.add_field(name = 'Developer', value=ctx.owner.name, inline = True)
but self.bot.user.name is wrong so what do i put instead? is it just owner?
you need to fetch the application info
info = await bot.application_info()
info.owner.name
Where do i put that?
This is my code:
@commands.command(aliases = ['fawkes'])
async def about(self, ctx):
em = discord.Embed(title = "Bot Info",timestamp=ctx.message.created_at, colour = discord.Colour(0x1680E7))
em.add_field(name = 'Bot name', value = 'Fawkes', inline = True)
em.add_field(name = 'Developer', value=ctx.owner.name, inline = True)
em.add_field(name = 'Library', value='dscord.py', inline = True)
i already told you lol
I dont understand
use the sdk rather than the old dblapi, its been deprecated
Guys, is there a permission called MANAGE_ROLES?
@earnest phoenix https://discord.com/developers/docs/topics/permissions
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
@bot.command()
@commands.is_owner()
async def guildinfo (ctx):
name = str(ctx.guild.name)
description = str(ctx.guild.description)
owner = str(ctx.guild.owner)
id = str(ctx.guild.id)
region = str(ctx.guild.region)
memberCount = str(ctx.guild.member_count)
icon = str(ctx.guild.icon_url)
embed = discord.Embed(
title=name + " Server Information",
description=description,
color=discord.Color.blue()
)
embed.set_thumbnail(url=icon)
embed.add_field(name="Owner", value=owner, inline=True)
embed.add_field(name="Server ID", value=id, inline=True)
embed.add_field(name="Region", value=region, inline=True)
embed.add_field(name="Member Count", value=memberCount, inline=True)
await ctx.send(embed=embed)
** i put this code to get guild info but now i want to set a target guild with guild id how do i get it**
discord.py
@opal plank thanks
๐
how can i get my bot webhook url
depends where its hosted
where i can find ?
So I found out this docs from repl ( http://docs.repl.it/classrooms/webhooks ), and I wanted to use those kind of webhooks. The problem is, I need a webhook secret. And im not using repl.it Classroom. How do I get the webhook secret? Note: I'm trying to make a vote webhook, its for discord bots.
probably google
thx
that whole thing looks like an array of object, so idk where this bracket belongs to
good question
probably already gone for a few hours
Do you want me to send you the code? @opal plank
yeah its been 3 hours already that its gone
lol
send it here
Alr
better that than cellphone screenshots at 240p
some people dont even know about it
It got deleted...
const moment = require('moment')
var eco = require(`quick.db`);
module.exports = {
name: "userinfo",
aliases: ["Userinfo"],
async run (message, args) {
const people = message.guild.member(message.mentions.members.first() || message.author);
let username = people.user.username
let registered = moment.utc(people.user.createdAt).format('MMMM Do YYYY');
let joined = moment.utc(people.joinedAt).format('MMMM Do YYYY');
const embed = {
"title": `${people.user.tag}'s userinfos`,
"color": "#008000",
"thumbnail": {
"url": (people.user.avatarURL())
},
"fields": [
{
"name": "User ID",
"value": `${people.user.id}`,
"inline": true
},
{
"name": "JOINED ON",
"value": `*`+joined+`*`,
"inline": true
},
{
"name": "REGISTERED ON",
"value": `*`+registered+`*`,
"inline": true
},
{
"name": "USERNAME",
"value": `*`+username+`*`,
"inline": true
},
{
"name": 'USER ROLES ',
"value": user.roles.cache.map(role => role.toString()).join(" ,"),
"inline": true
},
{
},
"name": "Social Links",
"value": "[Invite Bot](https://discord.com/oauth2/authorize?client_id=73453769569887&scope=bot&pe=2147483647) | [Support Server](https://discogg/)"
}
]
};
message.reply({ embed });
}
}```
figured as much, its an array
const { Client, MessageEmbed, version } = require("discord.js");
const moment = require('moment')
var eco = require(`quick.db`);
module.exports = {
name: "userinfo",
aliases: ["Userinfo"],
async run (message, args) {
const people = message.guild.member(message.mentions.members.first() || message.author);
let username = people.user.username
let registered = moment.utc(people.user.createdAt).format('MMMM Do YYYY');
let joined = moment.utc(people.joinedAt).format('MMMM Do YYYY');
const embed = {
"title": `${people.user.tag}'s userinfos`,
"color": "#008000",
"thumbnail": {
"url": (people.user.avatarURL())
},
"fields": [
{
"name": "User ID",
"value": `${people.user.id}`,
"inline": true
},
{
"name": "JOINED ON",
"value": `*`+joined+`*`,
"inline": true
},
{
"name": "REGISTERED ON",
"value": `*`+registered+`*`,
"inline": true
},
{
"name": "USERNAME",
"value": `*`+username+`*`,
"inline": true
},
{
"name": 'USER ROLES ',
"value": user.roles.cache.map(role => role.toString()).join(" ,"),
"inline": true
},
{
"name": "Social Links",
"value": "[Invite Bot](https://discord.com/oauth2/authorize?client_id=73453769569887&scope=bot&pe=2147483647) | [Support Server](https://discogg/)"
},
]
};
message.reply({ embed });
}
}
that should work
oh, cuz you missed ANOTHER brackets
I'm exporting a function and importing it in another file, but this errors happens when i try to call it. Any clue why? (ts)
add language to them
i just do that
@opal plank sill no respond
Nope nothing
it should
const { Client, MessageEmbed, version } = require("discord.js");
const moment = require('moment')
var eco = require(`quick.db`);
module.exports = {
name: "userinfo",
aliases: ["Userinfo"],
async run (message, args) {
const people = message.guild.member(message.mentions.members.first() || message.author);
let username = people.user.username
let registered = moment.utc(people.user.createdAt).format('MMMM Do YYYY');
let joined = moment.utc(people.joinedAt).format('MMMM Do YYYY');
const embed = {
"title": `${people.user.tag}'s userinfos`,
"color": "#008000",
"thumbnail": {
"url": (people.user.avatarURL())
},
"fields": [
{
"name": "User ID",
"value": `${people.user.id}`,
"inline": true
},
{
"name": "JOINED ON",
"value": `*`+joined+`*`,
"inline": true
},
{
"name": "REGISTERED ON",
"value": `*`+registered+`*`,
"inline": true
},
{
"name": "USERNAME",
"value": `*`+username+`*`,
"inline": true
},
{
"name": 'USER ROLES ',
"value": user.roles.cache.map(role => role.toString()).join(" ,"),
"inline": true
},
{
},
]
};
message.reply({embed:embed})
}
}```
Wdym
you know what an object is?
how do you import it?
it's the problem, isn't it?
48 servers in a day, holy shit

tim that sharding is coming sooner than i anticipated
any faster way to do this? i'm trying to get the number of users who all their starred message's stars added up is greater than 729
if you're exporting as default, then you should be able to import it like import bla from "..."
mk
if you exporting as default it needs to be import().then(a => a.default //do stuff)
wut
you cant use import inside it
he's doing dyanamically
prob using fs
you cant import mid code
but you can import()
you mean you cant import ts files within your project if they are not modules?
well i dont know the details of his project, but you should be able to do this no? ```ts
// file.ts
export default () => console.log(1)
// index.ts
import bla from "./file"
bla()
i dont get it
red = good, yellow = bad
inside a module, you cannot use import
but you can use import() which does the same as require basically
why would you mix module.exports with ts imports?
this is all using es6 so you dont get confused
no more mixing module.exports
look at top imports
and then dynamic
top imports are no issue at all, they are not a module, so its valid to import them
inside the module, aka the object, you cant use import statements
i dont get async imports tho
but import() is valid
does the file wait until the async import finishes before exporting anything?
i mean
itsnot like require(),. but it works like require()
as you still need to access the .default property inside of it
exactly like require
its just async
in the code you showed above, wont export default be executed before import.then() loads?
haha sharex rectangles go brr
possibly, though i do somethign similar on my client, dont see any errors, even with stuff im calling right after
that goes back to that whole async talk we had
i mean, if ts somehow waits for the .then() before exporting, that sounds very against how promises work
just use eval and readFileSync smh
maybe because of the for() loop?
not sure if that waits for each iteration
or just throws it until it eventually ends
i doubt it though
dont think for() loops affect any of this
just guessing cuz i dont have a concrete answer for it
top level import().then() makes no sense
your code is being executed before the import finishes
im pretty sure
some of those globals get called immediately after they been declared, such as my status, i dont see any of that erroring
i googled a bit about ts dynamic imports
the ready event is just below that
import() is supposed to be used inside functions, not top level
to only load when needed
then im doing it wrong
like
im using it in top level
does it work when used top level
in my case it does, supposedly
hm
import bla from "bla" // always imported
bla()
async function something() {
let bla = await import("bla") // import only when called
bla()
}
client;
files = fs.readDir()
for(let f of files) import(f).then(client.commands.set(f.name, f));
client.on('ready', () => client.commands.get('status')());
this doesnt give me any problems
it might not be the right way to do it, but from what i played with, import() doesnt seem to fuck up much at all
I use require for things like this
that only works because it takes longer for the client to become ready than for the modules to be imported
it may even be the time d.js takes to intiaite client
yeah, was about to mention that
so if you doing it topยดlevel you might need to wrap your whole index async, which seems a bit too much
or, at the very least, things that require import()
so the correct way to do it would be ```js
(async () => {
for(f of files) await client.commands[f] = await import(./${f})
client.login()
})()
looks about right, yes
of course you'd need to put stuff that requires that inside there as well
i just used one example on ready event
but if you have more, it might need to be put inside there
that would be very problematic for my gauges for example
as every event relies on them for metrics
so every client event i'd need to be put inside
so like
thats what composes my events
there is no way to load static imports in a loop
in my case it'd be at least 2/3rds of the bot inside async
like this
for(...) {
import x from y
}
at the top of the file
that doesnt work right?
dont think so, no
and import() is always async?
so you cant automate static imports at all?
i think so, yes, i dont get intellisence from import() for some reason, so i cant tell what its doing
like if you needed to import 50 files
i doubt it
you'd have to manually type them all
you'd need to push it into a variable outside
or convert everything to async to use dynamic
not necessarily
there is no static sync
you can still use require if you are writing the code for node.js
thats what i do for my dynamic database types
i literally use fs.write to write every type in a ts file
and the ts is always imported
imagine this
import test from 'test.ts'
writeFile() {
let num = 1;
for(let f of fs.readDir()) {fs.write(`export ${num} = {${f}}`, 'test.ts'); num++};
}
someFunction() {
const a = test.1;
}
you could have test always be imported
and then simply add the code itself, or a require() inside of it with write()
then anything inside test is callable
lets say i have 50 files i want to import
option 1: manually write all 50 imports at the top of the file
option 2: put 50 names in array, make everything async and await import() in a loop
is there any other option?
something like put 50 names in array, loop with import name = require()?
you can still use require in an node.js environment
It's better than using fs
trying to connect to my vps with vscode, but i get this error despite it being fully functional. any reason?
its about dynamicism, not how to import it or not
wait what, you're writing the file after importing?
in order to dyanmic require() stuff you'd still need fs
you'd run that before
map all the stuff you want to import
thats why i put it in map and not like that
thats some weird shit right there lmao
though when the code is already running, you would need to delete cache
show host settings
my ssh config file?
if that's what you mean, here it is with the IP hidden
Should I start sharding?
my bot is in only like 240 servers but is growing
i did have a better gif somewhere, let me see if i can find it
Hello I am developing a bot for my server and looking for a way to get votes for my server on top.gg show up in a channel using the webhook. How should I approach this?
@summer torrent
nice
thonk
wait why do you have a different interface for each character or whatever
when they are literally the same 
cuz i sometimes need to import all characters there are
i need to use in keyword
if i have all charcters and then try characterA in characters it'll pickup if that character exists in those types
there are various reasons why this would be handy
That's very hacky
indeed, but it works flawlessly
this is basically dynamic types in a nutshell
i update database and the code updates itself with the types
and it also knows a new char as added
since i have TRIGGERS set
it runs that function sinde code with eval
rip I guess I can't get help here
TRIGGER on INSERT http=> expresser server => check token/whitelist => eval genTypes(tablename/primary)
from postgres to code
I don't think that's how interfaces are supposed to be used
they arent, thats why i had to do this
types are mostly needed when you're coding, unless you type checking, types makes no difference whatsoever inside
in all truth you ARE suppose to use require(), since you cant delete import cache
but i want types on it too
so i did this whole thing
intellisense
Wait can you tell me again what are you using all those interfaces that are practically the same for?
type checking in code
in usable code its being used with require() and Object.keys()
in types im using in keyword to check it when im manually using a character or something
Are you sure in works for interfaces?? An interface is just a type

more like
but still, 'Something' only refers to a type, but is being used as a value here.
can you even use in for entire objects? isnt it only for props?
like "a" in Something or "a" in obj
im tryhing to find the code, this is some really fucky code
yea in accepts only strings, numbers or symbols
fuck im not finding it
i know i used it in one of my files
dont think i'll be able to find it
i need to wait for my friend to come, he's the one who taught me about it
i really do not remember how i did it, but it does have a special keyword for using types in types
AH
anyways, why not just have one interface instead of a separate interface for all character? That's the point of em
found it
keyof in
Advanced concepts around types in TypeScript
its not in interfaces its in advanced types
this allows me to use them individually
and check if a charcter is inside the interface
it'll error when i try to assign a character index that doesnt exist in the types
and since their index is their names, it works out fine
this is all pure types
as gang
but if i recall correctly..
there
jesus christ that took a while to find
@cinder patio
this whole mess here
Is it possible to know if a channel is a news channel ? (discord.js)
aight, enough playing around, gotta get to code
i warned you is was hacky and complicated af
a sane person would just make an array and change it
not me though

that requires changing arrays and maintaining code
no manual labour in my case
yeet data in db, auto types, boom
no wonder, you're an aquarius xD
lmao
idk what being aquarius have to do with me being stupid, but is the astros says so
yup
i have multiple codes (saved as code_codehere) and rn it only gets 1 code even though i have 3 in the db
let codes = db.fetch(`code`)```
sqlite ^
fetch("code") doesnt mean fetch everything that starts with "code"
fetch("code") means fetch exactly "code" and nothing else
or if all codes start with a defined letter couldn't you use one of sql's patterns
o
how can i log when an user joins/leaves a guild without gateway intents?
u sure? there is not other way?
yes... you cannot get that info without the intent
doesnt work
all codes r defined with code_
then the random code
I wonder what data is even available with zero intents enabled ๐ค
i was saying privileged gateway intents
Honestly might make a bot just to have a play around with it.
yes?
quick.db does not support doing that
how can i log when an user joins/leaves a guild without privileged gateway intents?
does better-sqlite3 support it?
yes
you cant
but i had a welcome msg
and it stopepd working
stopped*
after intents were turned off
poggers
no
better-sqlite3 is the database itself and works with SQL queries
there are no helper functions that do it for you like quick.db does
you have to code them yourself
to do that in sqlite you would do something like db.prepare("SELECT * FROM table WHERE id LIKE 'codes_%'").all()
but then again, in sqlite you should structure your tables in a better way than that
for example SELECT * FROM codes WHERE id = 'id here'
and ditch the a_b_c thing altogether
SQL is a fully featured query language to interact with SQL-compatible databases (sqlite, mysql, mariadb, postgresql, etc)
if you learn SQL you can use any database that supports SQL
and it gives you a lot of power to do anything you want with the data
o
for basic data store/retrieval it'll be pretty easy to learn
assuming you're not doing any crazy joins or whatever
One message removed from a suspended account.
lmao
// save data
db.prepare("INSERT INTO users (name, date, age) VALUES (?,?,?)").run("tim", Date.now(), 30);
// get data
let timsAge = db.prepare("SELECT age FROM users WHERE name = ?").get("tim");
Another option if you're feeling saucy is to put a simple express.js API in between, so you can input/retrieve data in JSON. Doesn't really matter if you're only doing a few transactions but if you're planning to add quite a few tables and functions then it could clean your code up a lot
I've gone that route
C:\Users\pcs\Desktop\Natsumi>npm i discord.js
npm WARN tar EPERM: operation not permitted, open 'C:\Users\pcs\Desktop\Natsumi\node_modules.staging\discord.js-3f9e79e5\webpack\discord.js.LICENSE.txt'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community/
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pcs\AppData\Roaming\npm-cache_logs\2021-01-21T15_56_47_061Z-debug.log
C:\Users\pcs\Desktop\Natsumi>
because I get this error when I put
npm i discord.js
do you have any other program open in your project? like a code editor?
i will wait
xDD
How can I make the opengraphics image larger?
Also Tim, Matt and I will fax you a cake
bot.roles.highest.comparePositionTo(member.roles.highest)
bot indeed has a highest role
happy early birthday
@tribal siren does the member have a role?
yes
Is bot your client?
yes..
Bots don't have roles
should i do message.guild.me then?
dropMsg.react('๐').then(() => dropMsg.react(''));``` how do i make this only 1 reaction added?
wut?
lmao
how come right after it reacts, it sends the message?
dropMsg.react('๐').then(() => dropMsg.react('๐'));
const filter = (reaction, user) => {
return ['๐'].includes(reaction.emoji.name);
};
dropMsg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '๐') {
let winner = dropMsg.reactions.cache.get("๐").users.cache.filter((u) => !u.bot).random();
channel.send(`Congrats ${winner}! You win!`)
} else {
return
}
})
.catch(collected => {
channel.reply('**Drop exceeded the giveaway time limit! Ending...**');
});```
i think i need to filter the bot's reaction out tho right?
how do i do that
@quartz kindle BRO HAPPY BIRTHDAY

U happy too?
wait its tims birthday
HAPPY BIRTHDAY DUDE
YE MAN
HAPPY B DAY
The bot itself reacts to it
Make sure the user who reacted to it is not the bot
so how do i filter the bot on the await function?
Not sure
ik, but i want anyone to react except for the bot
Don't do .then?
no, i fixed that
but how do i filter the bot's reaction?
here
Isn't there a function to get who reacted?
UHhHh
Hello