#development
1 messages ยท Page 1755 of 1
I assume this is the answer he wants
https://stackoverflow.com/questions/61978737/discord-js-send-emoji/65767718
how to ban ban-kick for regular players?
client.on("message", message => {
if(message.content === "!gif"){
clients.search('gifs', {"q": "anime slap", "limit": 1})
.then((response) => {
var gif = response.data[0].url
const m = new MessageEmbed()
.setImage(gif)
message.channel.send(m)
})
}
})
My code
And I get this blank
actually the answer was already provided #development message but idk they werent happy
they want custom emojis
i think
ah lol
Ping?
their English is hard to understand
yep
no one pinged you
are you searching from giphy?
Yup
giphy needs api token, you know that right?
just use unicode then.......
i know how add in commad by member
discord does auto conversions from unicode to discord emoji so unicode is nice
i need in embed
Yup
that's a reaction right there
you need to add the .then().catch()
that's not part of the embed
what
that's a reaction
var GphApiClient = require('giphy-js-sdk-core')
const {MessageEmbed} = require("discord.js")
const clients = GphApiClient(process.env.GIPHYTOKEN)
i cnt know how add it embed
I'm confused on how you made your bot
bro i make by bot reading doc
message.channel.send(embed).then(msg=>{
msg.react("โ
");
})
thx
yes

wait a min pls
it should work fine
I'm not sure why its not
see the .setImage method uses a url
Yup
Can I use tenor?
hello anybody know how can i define voice channel in slash commands
Can u suggest me
Tenor is also same
what does cn mean
when i type command where i add emoji it come 2 times
it sends the emoji twice?
that's not an error with the reaction then
bro
that's just an error in your code
bots don't need nitro

the bot needs to be in the same server as the emoji it's trying to use comes from
hmm
when bot in another server
considering you didn't even know what reactions were you should first get used to using reactions before you tackle custom emojis
also a bot can send an emoji from any server it's in to any other server it's in
cn you pls make id of this emoji
:844512161649000469:
i need like this
that means nothing to me
cn you say how
do
:844512161649000469:
any thing i add
say here
I don't own this server so I don't know what the emoji ids are
you're gonna have to make your own or steal them from somewhere
bro i say how make
emoji id
pls tell na
it too hard because i cnt have nitro
so pls say na
you can get the id from there
now look how
what do you need?
just google "get emoji id discord"
and follow the instructions
pls make id of this emoji for command only one time 
i say how make id
i cnt need emoji
๐ญ bro i cnt search so i tell you na
๐ hindi ati ha
You can get a custom emoji ID by right clicking the custom emoji and copying it's URL, with the ID being the image file name. All bots can use custom emoji on any server, just like Nitro users.
kisko ko
do that
bro i say
say.... what
true
Iโll come here when I need something to laugh at thx guys
If you're hosting a Discord bot, your options are slim.
I recommend you purchase a cheap VPS instead.
Or use the free trial that likely comes with it
it will take 1 - 2 weeks or more than that
It's currently 3 weeks or more.
yea
Ohk
hsduhsudfgh i asked before
`const Discord = require('discord.js');
const clinet = new Discord.Client();
clinet.once('ready', () => {
clinet.log('Parth Coders Is Online');
});client.login('NOT SEE MY TOKEN');`
What Is Wrong In This??
@thin quarry
i dont know javascript
then how you cretated??
in python
okay
and i see a mistake
what
everywhere you type clinet

and in the last line it`s client
yes
everywhere must be the same
@gritty lintel
not it is client only
client.login
Hey, I have a problem because my bot will not count invitations on the server
const clinet = new Discord.Client();
clinet.once('ready', () => {
clinet.log('Parth Coders Is Online');
});
clinet.login('NOT SEE MY TOKEN');```
yes
(node:10832) UnhandledPromiseRejectionWarning: TypeError: clinet.log is not a function
at Client.<anonymous> (C:\Users\Toshiba\Documents\Custom Office Templates\main.js:6:12)
at Object.onceWrapper (events.js:421:28)
at Client.emit (events.js:315:20)
at WebSocketManager.triggerClientReady (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:431:17)
at WebSocketManager.checkShardsReady (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:415:10)
at WebSocketShard.<anonymous> (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:197:14)
at WebSocketShard.emit (events.js:315:20)
at WebSocketShard.checkReady (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketShard.js:475:12)
at WebSocketShard.onPacket (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:16)
at WebSocketShard.onMessage (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
(Use node --trace-warnings ... to show where the warning was created)
(node:10832) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10832) [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.
this error @thin quarry
yes
yes
i am trying in python
ok
yee
did you see the guide?
that's a C then: specialized table for i18n
yes
Yay
leave it i am working on python
Whats the key for message content in webhooks?
What do you mean?
when making a post to a webhook. You send data. I dont remember what the key for the message content is
content
that doesnt work
then you're doing it wrong
oh yea
client.on('message', message => {
if (!message.guild) return;
if (message.content.startsWith('!ban')) {
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.ban({
reason: 'They were bad!',
})
.then(() => {
message.reply(`Successfully banned ${user.tag}`);
})
.catch(err => {
message.reply('I was unable to ban the member');
console.error(err);
});
} else {
message.reply("That user isn't in this guild!");
}
} else {
message.reply("You didn't mention the user to ban!");
}
}
});
Here is the working code, is it possible for someone to supplement and throw it off already with the rights of a ban from the admin?
Change the user mentions validation and conversion to a single members.mention to only read member mentions
You aren't checking if the member has permission to ban the other member
Nor are you checking for a hierarchy in roles to measure the executor's importance
How to implement this code?
Reminder: you need to learn javascript, we will not spoonfeed you code.
I don't ask you, you can go for a walk
I mean you can be rude all you want, but no one can help you, it's written in the rules.
mem
Take a look at https://anidiots.guide/understanding/roles though, it will probably help
I help everyone, and I just helped you by providing a link. "You need to learn javascript" is also helping, even if it's not the answer you want, it's the answer you need.
You can learn on the go
You could, of course, be a self-taught person. But if you're asking others to spoonfeed you an answer, you are not "learning", you're begging for scraps.
Spend less time begging for help and more time reading documents and resources you are sent. Like https://anidiots.guide/understanding/roles .
Help is useful to ask
Yes, and the answer has been provided.
at some point it's time to step back and catch up on what you're missing
and then continue writing your bot or whatever you were doing until you hit a roadblock like this again
that's how self-learning works
You mean like this:
py1.py
print("file1")
py2.py
import subprocess
subprocess.run(["puthon3", "py1.py"]);
or like export--import ?
Im not sure. I just want to get a variable from a file to use it in another file
Just import it, assuming it's in the same dir
from .py1 import str
print(str)
# or
from . import py1
print(py1.str)
Redefining built-ins is a bad idea though
You can just do from py1 import str if it's not in a package
is any thing to check who invite your bot
in server
Can you show me export??
Oh ok thanks
@use.pc.error
async def pc_error(ctx, error):
if isinstance(error, commands.group.CommandOnCooldown):
embedVar = discord.Embed(title=f"You are on cooldown!" , description='You may use this command again in {:} Seconds.'.format(error.retry_after), color= ctx.author.color)
await ctx.send(embed=embedVar)
else:
raise error
why does t not work
Traceback (most recent call last):
File "main.py", line 472, in <module>
@use.pc.error
AttributeError: 'Group' object has no attribute 'pc'
Error
Referring to the subcommand doesn't work?
yeah
What error
..
You're referring to the parent, I'm asking if referring to the subcommand directly doesn't work
Suggest you don't overwrite built-in keywords like data types
Instead of referring to use.pc, try pc itself
Yes I will replace it in my code. Im just so used in JS
ok
(Then you have me overwriting id because God forbid I ever need it)
>>> doodoo = "hahaa\nlol"
>>> yeet = f"{doodoo}"
>>> yeet
'hahaa\nlol'
>>> print(yeet)
hahaa
lol
Any specific examples you can provide?
>>> f"{'\n'.join([str(e) for e in range(5)])}"
File "<stdin>", line 1
f"{'\n'.join([str(e) for e in range(5)])}"
^
SyntaxError: f-string expression part cannot include a backslash
I do know this
f">> **__{cmd.name}__**\n\```\n{signature}\n\```\n{desc}\n"
if isinstance(entity, Command)
else f">> **__{cmd.name}__**\n{desc}\n {subcommand}\n"
)```
>>> f"{'\n'.join([str(e) for e in range(5)])}"
File "<stdin>", line 1
f"{'\n'.join([str(e) for e in range(5)])}"
^
SyntaxError: f-string expression part cannot include a backslash
>>> s = '\n'.join([str(e) for e in range(5)])
>>> f"{s}"
'0\n1\n2\n3\n4'
>>> print(f"{s}")
0
1
2
3
4
What error are you getting? Can you post the full traceback?
how do i do this for multiple variables
not an error but when i use \n in variable
it cuts off the remaining part
lemme show
"Example-1: `fa!aar inviter role` will give the role to the member when they join using inviter's "
"link\n"
"Example-2: `fa!aar inviter role1 role2` will give the `role2` to the member when they join using "
"inviter's link and get the `role1`"```
but it only prints
Auto assigns a role to the member when joined or after they claim the required role. Example-1: `fa!aar inviter role` will give the role to the member when they join using inviter's link
the text after \n isn't there
Can you show your full code related to whatever you're doing?
const Discord = require('discord.js')
module.exports = {
name: "say",
description: "a command to say",
run: async (client, message, args, prefix) => {
const user = message.author
const target = message.mentions.users.first()
let msg
if(!target) {
msg = args.slice(0).join(" ")
.catch(console.error)
if (!msg) return message.reply("What do you want me to say? Command Usage: `"+prefix+"say <message>` or `"+prefix+"say <user> <message>`")
message.channel.send(msg)
message.delete()
} else if (target) {
msg = args.slice(1).join(" ")
if (!msg) return message.reply("What do you want me to say? Command Usage: `"+prefix+"say <message>` or `"+prefix+"say <user> <message>`")
message.channel.send("Send the message in `[1] DM` or `[2] Channel with ping`\n\n*Say the ID of that you choose.*")
.then(() => {
message.channel.awaitMessages(response => response.content == '1' && response.author.id == message.author.id || response.content == '2' && response.author.id == message.author.id, {
max: 1,
time: 20000,
errors: ['time'],
})
.then((collected) => {
if (collected.first().content == '1') {
message => message.delete({ timeout: 20000 })
target.send(message.author.toString() + " Told me to say you this: ```" + msg + "```")
}
else if(collected.first().content == '2') {
message.channel.send(target.toString() + ", " + msg)
}
})
.catch(() => {
message.channel.send(`No response! Request has been declined`);
});
});
}
}
}```
this is my code and
so apparently cmd.help only gives this ```Auto assigns a role to the member when joined or after they claim the required role. Example-1: fa!aar inviter role will give the role to the member when they join using inviter's link
I want the bot to delete the
message.channel.send("Send the message in `[1] DM` or `[2] Channel with ping`\n\n*Say the ID of that you choose.*")``` this message after the response message is collected
is it possible to do so?
@command(name=f"autoassignrole", aliases=["aar"],
help="Auto assigns a role to the member when joined or after they claim the required role. "
"Example-1: `fa!aar inviter role` will give the role to the member when they join using inviter's "
"link\n"
"Example-2: `fa!aar inviter role1 role2` will give the `role2` to the member when they join using "
"inviter's link and get the `role1`")
Why don't you just make a docstring instead
m = .send()
await m.delete()
ok thank you
W1309 f-string-without-interpolation 
Fr doe, just make a docstring. It'll get the docstring if nothing passed on to the help kwarg
Might / might not have something to do with inspect.cleandoc
neh it didnt work
the bot is going directly to the .catch
async while true:
await client.change_presence(activity=discord.Streaming(name='Economy Stats in {:,} Servers...'.format(int(len(client.guilds))), url='urllsdlsdjsai'))
Why this not work
error:
SyntaxError: invalid syntax
url is an actual url but I blanked it out
Omit the leading async
omit?
remove
One message removed from a suspended account.
SyntaxError: 'await' outside function
int(len(...)) aaaaaaa
Rather, put it in an async function
a
because it's outside of one completely
One message removed from a suspended account.
haha
Stop trying to convert me to gay

I'm being bullied
One message removed from a suspended account.
Imagine being bullied
like?
Smh my smh
async def THIS_IS_MY_ASYNC_FUNCTION_AND_I_DO_WHATEVER_THE_HELL_I_LIKE_WITH_IT():
...
One message removed from a suspended account.
One message removed from a suspended account.
In your case you probably want to put it in some event instead
Finna snakecase your life because you keep being acting like an underscore, all bottom
One message removed from a suspended account.
And stack them loop 
One message removed from a suspended account.
One message removed from a suspended account.
@earnest phoenix
so after looking into the help property of Command class i got to know they strip the new lines
return self.brief
if self.help is not None:
return self.help.split('\n', 1)[0]
return ''```
this code was there
kekw
I mean why would they do that
can't you remove is not None
it was in discord.py lib
In most cases you can just do if x: but in this case Danny decided to check strictly for None
At that point, just make your own help class
lol i got escaped with using breif
Tmw brief is not brief
since they were not modifying anything in it
Danny pulled a reverse one on us
who is danny?
oh lol
exdee
it always showed Raptzz
He named himself Danny on Discord iirc so
oh
didn't know
sad
main.py:492: RuntimeWarning: coroutine 'statusUpdate' was never awaited
statusUpdate()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
await statusUpdate()
use await?
File "main.py", line 492
await statusUpdate()
^
SyntaxError: 'await' outside function
There's no top-level await statements
are you using await outside async function?
Me?
Yes
prolly yes
I am trying to make the bot status a live server count
Coroutine in non async code 
just create task loop
Any idea how you know if a user has a flag? I have the public_flags value and want to manually check the flags.
discord.py tasks ftw
Working with the bitfield directly?
Yes exactly
I use AsyncIOScheduler()
Like it didn't take me that long to open the d.py docs ToC and find discord.tasks
lol
(values & to_check) == to_check? Pretty weird naming but w/e
Well I didn't know that existed
the tasks
i mean
Hey guys, I was tryna use the nekobot api and make a few commands with it and idk where I'm going wrong in the code but it returns no errors and nothing happens, here's the code :```py
@commands.command(aliases=['df', 'deep-fry','deep_fry'])
async def deepfry(self,ctx,member: discord.Member = None):
if member is None:
member = ctx.author
async with aiohttp.ClientSession() as session:
request = await session.get(f'https://nekobot.xyz/api/imagegen?type=deepfry&image={member.avatar_url}')
req = await request.json()
embed = discord.Embed(ctx.author.color, timestamp=ctx.message.created_at)
embed.set_image(url=req['message'])
embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
await ctx.send(embed=embed)
@commands.command(aliases=['tt','trump_tweet','trump-tweet'])
async def trumptweet(self,ctx,*,message):
async with aiohttp.ClientSession() as session:
request = await session.get(f'https://nekobot.xyz/api/imagegen?type=trumptweet&text={message}')
req = await request.json()
embed = discord.Embed(ctx.author.color, timestamp=ctx.message.created_at)
embed.set_image(url=req['message'])
embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
await ctx.send(embed=embed)
@commands.command(aliases=['cmm','change-my-mind','change_my_mind'])
async def changemymind(self,ctx,*,message):
async with aiohttp.ClientSession() as session:
request = await session.get(f'https://nekobot.xyz/api/imagegen?type=changemymind&text={message}')
req = await request.json()
embed = discord.Embed(ctx.author.color, timestamp=ctx.message.created_at)
embed.set_image(url=req['message'])
embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
await ctx.send(embed=embed)```
if number & 1 << 0:
mod_list.append('NF')
if number & 1 << 1:
mod_list.append('EZ')
I legitimately thought that the & came first in order of ops
Nevermind shiv, found out.
I was using && for some reason
guys wanna see some bs
I confuse ^ with & sometimes so I feel you
And there's ~ 
ternary operator internet explorer polyfill
(condition && (doiftrue)) || doiffalse
looks like in all the embeds, you have discord.Embed(ctx.author.color), I think you need to do (color=ctx.author.color)
Anyways, thanks shiv and norizon :)
Thanks God I never had to work with that
Hikari provides raw flags, so gotta do things on my own 
(perms & ~deny) | allow applying overwrites be like
Just write your own perm wrapper
Yes exactly
I feel bad for you
It's pretty worth it anyway, the only thing it lacks is a command handler. There's an official unofficial command handler for it, but not as good as d.py's
As long as it works and dblpy users can get it /s/s/s
I'll release a v0.6.9 specifically for that
I'm sticking with 0.4 anyway
LMFAO I'm not gonna add anything to it
Everything is gonna have a deprecation warning
tmw it's getting deprecated but the docs tell you to do pip install dblpy
top.gg docs: pip install dblpy
dblpy README: pip install topggpy
Just as intended
I will update that along with examples so yeah\
pog
for firestore, in document snapshot. Can I detect the changes?
What will be the new one?
It's topggpy
Thanks
And to make the addition of the user flags it's
1<<1 | 1<<6
for a user that has partner and bravery flags
why
hi
what does += mean?
take the value of the variable and add some amount to it
ok...
and mutate the variable
Yep
Ok, so Iโm making a discord bot in discord.js. I do โnpm run devโ and it starts up my bot but it gives me the unhandled promise rejection error. Iโm also using vs code and node.js. This is the unhandled rejection code it gives me โ--unhandled-rejections=strictโ
@quartz pier thats too little information. Can you send the full error? A lot of the time promise rejections donโt show a lot, maybe you can catch the rejection somewhere you think itโs occurring?
Iโve searched everywhere but canโt find a fix. Iโll have to show the code later as Iโm busy rn, is it ok if I ping you with the error later?
Sure!
Ok, thank you! Iโll talk to you later, bye!
can somebody help me in javascript
@tribal quest Don't ask to ask. Feel free to just tell the people what you are struggling with, there are always people that want to help!
https://i.callumdev.xyz/ukvzi.png
https://i.callumdev.xyz/hxz0m.png
https://i.callumdev.xyz/xzefh.png
Why does e.remove not work
im making a meme commands but there comes an error i am going to send the code an the error
iยดll upload it on source.bin
and the error:
message.channel.send(imageembed)
^
TypeError: Cannot read property 'send' of undefined
at IncomingMessage.<anonymous> (D:\Users\david.jaros\Desktop\DavBotBeta\commands\utility\meme.js:53:33)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! DavBot@5.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the DavBot@5.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\david.jaros\AppData\Roaming\npm-cache\_logs\2021-05-19T17_41_55_785Z-debug.log
can somebody help me
and maybe fix it
under execute(message, args) { put console.log(message)
or code own
So, I am trying to make a quote command, but I keep getting this error. The code is ```javascript
const { MessageEmbed } = require("discord.js")
const { NOMEM } = require("dns")
const Discord = module.require("discord.js")
module.exports = {
name: "quote",
description: "Easily find a message by ID",
usage: "quote <message id>",
category: "fun",
callback: async (client , message, args) => {
console.log(message)
const messages = await message.channel.messages.fetch({around: "352292052538753025", limit: 1})
const msg = messages.first()
if(!msg) {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(${message.author.tag}, message.author.avatarURL)
NoMessage.setDescription(Enter a message id to quote a message!)
message.channel.send(NoMessage)
}
if(msg) {
const quote = new MessageEmbed()
quote.setColor("#7289da")
quote.setAuthor(${message.author.tag}, message.author.avatarURL)
quote.setDescription(${msg.content} \n\n [Jump to Message!](${msg.url}))
quote.setFooter(${message.guild.name} ${message.channel.name} ${message.createdAt})
}}}``` and the error is.
smh both same error
what does your console.log(message) return, since you already have it
undefinedfor some reason, but idk why.
ok
is it that what you need
change execute(message, args) to execute (client, message, args)
one sec
freaking legend XD
๐
sidekid
๐
show me ur command handler, where it executes the callback
yes
Default version of WOKCommands.
wot
It is an npm.
inb4 the kid comes back with another error in his stolen code
delete this message and regenerate your bots token btw, you accidentally leaked it
It's getting even more strange.
np
Im using nextjs, in the useEffect, I am listening to snapshot of a firestore document.
But I the state is not updating, in this useEffect. What other method should I use?
Do I have to add state as a dependency?
If so, then the snapshot listener will rerun, which I dont want.
this commes btw
https://preview.redd.it/lsnpziq9f2071.jpg?auto=webp&s=003caf9cd78f5f699f3b086ac4602bda1f8873d7
D:\Users\david.jaros\Desktop\DavBotBeta\commands\utility\meme.js:54
message.channel.send(imageembed)
^
TypeError: Cannot read property 'send' of undefined
can easily tell it is stolen/copy pasted code
mhmm
wow haha
๐
your sending your bot client into the message parameter. not the message.
as you can see in the log https://i.woo.pics/e6d9bb21c4.webp
woo, can you delete the message that they put the log in btw, it shows their client token
yes ofc
how do i fix it
im new in coding
first of all, dont use stolen code. doesnt help you learn
second of all, use the message not client.
What is patience?
and now you have https://discord.js.org ๐

not sure if anyone got back with you. but your issue is the same as sidekid. you are sending the wrong parameters
(client , message, args)
on the execution side, you are sending something other than a message in the second parameter of the function.
So, (message, args) then?
is that your execution side?
you should just do the exact same thing for each.
(client, message, args)
how to shutdown my bot with a command?
I am still confused.
restart or completely shut it down?
process.exit() on js
or you have to kill it with shelljs (shell package for shell exec)
function someFunction(firstParm, secondParm){
}
someFunction(firstParm, secondParm);
// ^ correct way to use a function. firstParm and secondParm need to be in the correct order.
function someFunction(firstParm, secondParm){
}
someFunction(secondParm, firstParm);
// ^ Wrong way to use a function. parms are out of order.
do any of yalls know why my vs code does not open
nah
seems to be the same issue, just in a different place.
message.author.avatarURL is v11 and what is this NoMessage.setAuthor
could you log out message
btw use v12, v11 is outdated and will crash bc of stage channels
const messages = await message.channel.messages.fetch({around: "352292052538753025", limit: 1}) is undefined, how do I fix?
messages is undefined?
Yah.
is the id provided in around an actual message id.
Yah.
show the error stacktrace //if any
There is no error. I just have console.log messages, and it says undefined.
๐ค
const Discord = module.require("discord.js")
module.exports = {
name: "quote",
description: "Easily find a message by ID",
usage: "quote <message id>",
category: "fun",
callback: async (message, args) => {
const msg = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
console.log(msg)
if(!msg) {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
message.channel.send(NoMessage)
}
if(msg) {
const quote = new MessageEmbed()
quote.setColor("#7289da")
quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, message.author.avatarURL)
quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
quote.setFooter(`${msg.guild.name} ${msg.channel.name} ${msg.createdAt}`)
}}}```
Now it is logging Collection(0), so for some reason no message is being collected.
alright, so that's something
i was confused as to why it was undefined
because the api should never return null arrays
0 is not defined.
what
I forgot to change it to parseInt(args[0]) in the fetch, but now it is saying "Cannot read property '0' of undefined", so for some reason message, and args are undefined.
How are you calling callback
protip to clean up your commands and the argument mess
instead of taking in multiple arguments (i.e (message, client, args, ...)) just take a single argument that's a context object instead (so your run method signature would just be async (ctx) =>)
and where you execute commands pass in that object with whatever values
Javascript?
i.e.
command.run({
client: myDiscordClient,
args: myArguments,
whateverYouWant: here
});
yes
this simple change will make your life easier
you won't have to mess with argument lists
instead, all of your commands will have a single argument and they'll be able to access everything through that object
i've seen people do something like
if(command === "ping")
command.run(client, args);
else if(command === "ban")
command.run(client, args, member);
...
which you can imagine, is just a mess
client: bot,
arguments: args,
messages: msg
}) => {```
Like that?
no
the run method in your command file is supposed to look like something like this
run: async (ctx) => {
//ctx.client or whatever
};
Then how do I get the message, and it's args?
js allows destructuring variables so you can even do something like
run: async (ctx) => {
const { message, client } = ctx;
await message.channel.send(...);
};
through the object you passed in the method
see this
this is what you place in your command handler
aka your message event
Ok, now the message stuff is working, but it is saying "cannot read property 'username' of undefined' for msg, not message, and I have it log msg and it says that there is an author with the correct username.
can you show your code?
const Discord = module.require("discord.js")
module.exports = {
name: "quote",
description: "Easily find a message by ID",
usage: "quote <message id>",
category: "fun",
run: async (ctx) => {
const { message, args} = ctx;
const msg = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
console.log(msg)
if(!msg) {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
message.channel.send(NoMessage)
}
if(msg) {
const quote = new MessageEmbed()
quote.setColor("#7289da")
quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, message.author.avatarURL)
quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
quote.setFooter(`${msg.guild.name} ${msg.channel.name} ${msg.createdAt}`)
}}}```
Bottom half btw.
that should work just fine ๐ค
can you screenshot the console.log output
it's probably big, so just the author area is fine
msg.first()?
should work yeah
How would I check if the imputed message id is incorrect?
define correct
if you want to check if a message with the id exists, you have no choice but to fetch and see
im having a moment plz send halp
(node:24632) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
const Discord = require("discord.js");
const randomPuppy = require('random-puppy');
exports.run = async (client, message, args) => {
const subReddits = ["Cheesetopia"]
const random = subReddits[Math.floor(Math.random() * subReddits.length)];
const img = await randomPuppy(random);
const embed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setImage(img)
.setTitle(`From /r/${random}`)
.setURL(`http://reddit.com/${random}`)
.setFooter(`Requested By: ${message.author.username}`, message.author.displayAvatarURL({ format: 'png' }))
message.channel.send(embed);
message.delete({timeout:10});
}
``` it didnt even show one of the cheese images i posted to my subreddit
How do u make an event that sends a message in a channel if the server name matches Spooky Time?
I think it includes: GuildUpdate and filtering it
I need the exact code for this
i have a very basic message event
module.exports = (client, message) => {
if (message.author.bot) return;
if (message.content.indexOf(client.config.prefix) !== 0) return;
const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command);
if (!cmd) return;
cmd.run(client, message, args);
};
Very nice
So can someone help me
const Discord = module.require("discord.js")
module.exports = {
name: "quote",
description: "Easily find a message by ID",
usage: "quote <message id>",
category: "fun",
run: async (ctx) => {
const { message, args} = ctx;
const errors = 0
const msgs = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
.catch((err) => {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
return message.channel.send(NoMessage)
})
console.log(errors)
if(args[0]) {
const msg = msgs.first()
const quote = new MessageEmbed()
quote.setColor("#7289da")
quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.avatarURL)
quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
quote.setFooter(`${msg.guild.name} | ${msg.channel.name} | ${msg.createdAt}`)
message.channel.send(quote)
}}}```?
Would that work?
Try and see 
Still runs the other one and gives me erros.
Also, how do I make it so I can quote a message from another channel that is different then the one the command is ran on?
...
@fresh verge await message.channel.messages.fetch({around: "${parseInt(args[0])}", limit: 1})
this not how u fetch messages
simply pass the messageId
why is the string being parsed as an integer back to a string
the command doesn't exist in the collection
You should verify the command's existence by checking if command is undefined
no...
log the collection
it could also be a parse issue but I doubt that's the case
is guild.fetchMember even a thing
1 mom
i know
Bruh, align that grid
aka console.log(client.commands)
Wdym.
'ParnterManager' => {
name: 'ParnterManager',
desc: 'Give the permissions to make a Partnership for the server.',
run: [Function: run]
},
'test' => {
name: 'test',
desc: 'A simple test command',
run: [AsyncFunction: run]
}
}
Maybe it's because PartnerManager command isn't an AsyncFunction as test command...
It's probably not.
Your issue is because you converted the command input to lower case.
But you stored the command in its original capitalization (PartnerManager instead of partnermanager)
so, what do i have to do?
i didn't understand...
I recommend you do one of the following:
- Declare all your command names as lowercase in your
module.exports - Update your command handler to convert the name to lowercase beforehand
now it works, thank you
@quartz pier Yea thats what I already thought. A promise error doesnโt say a lot. You have to look for the promise you think the error is originating from.
what could have happened?
Not sure. I donโt know your code. But an error has taken place inside a promise
hm ok ty
is there a way to fix a promise? and where can i find the promise?
nvm
is it ok if i send you a picture of my code and maybe you can help me?
@quartz pier yea sure send it. Promises are for asynchronous functions. So somewhere with โawaitโ or โasyncโ probably. You can catch the error and then it will show you more information about what is going wrong.
I will be asleep by then. Surely somebody else will be able to help then!
ok ty!
Soo.
ok so, i have created a kick command but it gives me an error. here is my code
here is the error
not sure if you can
Try changing async run(client, message, args) { to run: async (client, message, args) {

ok ty ill try that
u could use the message link instead of quoting it ig tho as a workaround
It already includes the message link.
ah
didnt work : (
Any error changes?
instead of using try catch use .catch((e) => { })
it gave me 4 errors and it didnt give me anything in terminal
so where could i use that? everywhere theres catch?
give me an example please
Are you sure? 
you're supposed to have a .catch for every single promise
try {
someCode()
} catch (e) {
console.log(e)
}
would become:
someCode().catch((e) => {
console.log(e)
})
ah ok ty ill try that
is this right?
because sometimes I still get the unhandledpromiserecjection error when sending a message :/
it gives me an error so i dont think so
const Discord = module.require("discord.js")
module.exports = {
name: "quote",
description: "Easily find a message by ID",
usage: "quote <message id>",
category: "fun",
run: async (ctx) => {
const { message, args} = ctx;
const msgs = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
.catch((err) => {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
return message.channel.send(NoMessage)
})
if(args[0]) {
const msg = msgs.first()
const quote = new MessageEmbed()
quote.setColor("#7289da")
quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.avatarURL)
quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
quote.setFooter(`${msg.guild.name} | #${msg.channel.name} | ${msg.createdAt}`)
message.channel.send(quote)
}}}```An issue I have is that if an invalid ID, or nothing imputed, it gives me this error. I tried fixing it multiple times.
Just check if msgs is your expected type or generally not null or undefined
if(!msgs) return evil
no its not
hm, is there any other ways to fix it?
what could be another problem with this?
is that what i need to do?
if so ok
Whatโs the issue?
one second
Let me guess the code has an error close to your MessageEmbed line?
no, it gives me an unhandled error
Still waiting for the error
idk
Whatโs the issue?
Whatโs wrong with the world...?
I see at least one error in his screenshot already
heres my new code
ok, whats the problem?
ok, how can i fix it?
Discord.MessageEmbed
Take a look at the line you defined it and you will see the issue
i dont see it
https://img.pyrocdn.com/XbImfpLP.png this is the issue by the of it
I still donโt even know what his issue is
how do i fix it?
Just see he required "discord" and used "Discord" as var name
*saw
Thatโs why it should throw an error
there are multiple issues
Iโm driving ... thatโs the first I saw
wow i am not good at writing code lol
Do you know what a class is and itโs properties?
@delicate zephyr do you mind guiding me through solving them?
kinda but i started coding this bot not long ago and i have a bit of experience with coding
Ok so not really which makes me guess itโs just copied code, right?
For some reason it isn't displaying the user's avatar. quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.displayAvatarURL)
No errors.
iirc displayAvatarUrl is a function so it needs to have ()
What discord.js version are you using? Discord.js v12 and above would have that as a method instead of a property
what is the latest version of vs code?
pretty sure Xiuh is correct, this is 12.4.0 @pale vessel
On my Mac, it's 1.56.2
How does one get a channel by ID?
Depends.
Do you want to do it conveniently on your account
e.g. Right click and copy ID
Or do you want to do it programmatically
How would the bot get the ID of a role it just created?
Discord.js
How are you creating the role?
It's likely returned as a promise resolving to a new role.
message.guild.roles.create()
Yep, returns a promise resolving to a role (https://discord.js.org/#/docs/main/stable/class/RoleManager?scrollTo=create)
So after you resolve the promise, just access its .id getter.
Okay, thank you.
๐คฆ No I mean like I say !channel (id), and then it would do something to the channel that has the id that was imputed.
That was not directed at you
What library are you using anyway
I'll assume Discord.js from your previous code
Yah.
One solution is to get a guild instance and do <Guild>.channels.cache.get(...). .channels is a manager, so its cache of channels is under the .cache property.
Once you have a channel instance, you can just access its .id property.
For example:
let id = parseInt(someInput, 10);
let channel = message.guild.channels.cache.get(id);
// `channel` may be `null`, so make sure you verify.
How does .first work?
Try looking here. https://discord.js.org/#/docs/main/stable/class/GuildMemberRoleManager
I know how to add a role but message.author.roles is undefined
It grabs the first element in the collection.
Is there a .second?
I don't believe so.
Only a .first?
and a .last()
Anyone know if there is anything out there that parses the discord api docs? For generated types etc.
Is a certain server always gonna be on the same shard if the bot is always in the server every time there is a restart?
Yes, if the number of shards doesn't change.
if more are added it would stay the same only if some were removed?
I have an issue like if you put the message ID as like a correct one, but something to interfere with it as in an extra character [all in on argument], it gives an error that turns off the bot.
Also how does one check if a list contains value?
dumb question that is kind of relevant. How long does it usually take for a discord bot verification request usually take? I submitted mine over 2 weeks ago and haven't heard anything back.
The bot still says awaiting verification
request processing
out of curiosity, do you know python?
usually it is between 2 and 3 weeks
Can take up to a month at the moment
if the 3rd week reaches, please contact support discord.gg/discord-developers
Sadly, no. I am a Javascript person.
i wondered about the indentation of ur code, thats usually a sign
Anyways?
also
check this
add a breakpoint in the beggining of ur code
and re-run the command that broke it
What is that?
read what i sent
;-;
well like i said, VSC has a debugger, use it

if even then you cant see the answer, ask away
lmao

Good luck! Gonna get some sleep
gnit
Which compiler do you guys use for c?
I mean the cdecl or Pascal...
I recently got to know about it
Since I've been using GCC
And the only compiler I know

GCC
Also for some reason, it selects the message above the attended target.
For grid layout in css, how can I arrange childrens like this?
7 8 9
4 5 6
1 2 3
<div class="grid-container">
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
</div>
like this ?
na na, there should be 3 columns
and the items would be in sequence
I just want them to be ordered like that visually
like that should be hella hard
you can try naming the grids (r and c)
Try using grid-template-areas:
but you'll end up doing that for every single one
Actually I'm trying to flip a chess board.
So this is the layout I want.
9 8 7
6 5 4
3 2 1
can someone explain why my bot is taking a long time to start]
when running it locally
what used to take less than 10 secs
now takes 3 mins +
My bot crashes as he joins new guild without admin perms.... It shows missing permission
any fix for this?
check if you have the correct permissions before executing and action
why does it need admin perms
i.e. before banning, check if you can ban in the first place
before creating a channel, check if you can create a channel in the first place
etc
its a security bot
oh ok
but some ppl dont rely in starting giving admin perms
or just try..catch and .catch()
So, I am trying to whitelist a Specific role to a Ticket Channel, it goes by name, so it locates the Role Name, then allows it to view the channel.
``` message.guild.channels.create(open-${message.author.username}, {
permissionOverwrites: [
{
id:message.guild.roles + "Staff Team",
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL']
} ```
Ik its not right, but how can I make it so the "Staff Team" can be added to the channel, when I use that, it says "The Specified thingy is not a User or Role ID." , Can anyone assist?
It's multi guild so using 1 ID will not work, thus the explanation of how I want it to locate the role with the "Staff Team" role and whitelist it to the channel.
no, that's horrible advice
you're wasting a request
Calm down @vivid fulcrum , they are trying to help.
im calm lol??
anyway
doing that, and hitting too many 401 | 403 | 429 response codes will get you api banned
that's why that advice is horrible
you should make your code do the absolute minimal requests to discord
with less than 500 servers that shouldn't be an issue
doesn't matter
Anyone have any feedback on my request above^?
I mean... the ID needs to be an actual id. What do you think message.guild.roles + "Staff Team" is supposed to do?
Trying to add a collection with a string? that... doesn't really make any sense
you probably need to read this, should be helpful: https://anidiots.guide/understanding/roles#get-role-by-name-or-id
Are you using bootstrap? material-ui?
tailwindcss
^ ^
I dont find any solution, so I just reversed the array.
Are you using a grid layout? The numbers are columns right?
yes grid layout, with 9 childs
Isn't there a column-reverse property in css or something similar
naah, not in grid
How can I restrict a command to the users who only have the given role, I alr have the role find code:
but, How can I make it so the command will not go unless they have that role?
1:35am so my brain has been fried lol.
Wait, hold up
Why am I doing that, I need to restrict it to a channel 
Welp, lemma just go gather my thoughts.
Oke
Okay, after that little thing, I have restricted the command to users with ADMINISTRATOR permissions, but how can I make it so it only runs if it has ticket- in the channel name?
Otherwise if a admin uses x/delete in the wrong channel, poof
if(!message.channel.name.startsWith("ticket-")) return;
Thought so haha.
@rocky hearth You wanna know something funny. I didn't know about that function until now. I always used something like channelName.substr(0,7) == 'ticket-' ๐
omg!!
My life just got a little bit easier
lol ๐คฃ;
there's "".endsWith("") as well, or includes etc
can someone help me
my bot dosent work without admin perms and gets crashed if added without admin perm
There is no way in the world ur bot should ever need or crash without admin perms ever
thats completely bullshit
Admin perms are just a short cut to giving every permission
from the error path, you must be missing
hey does anyone know why miniget is givin me a 404 error code
aha alright
@quartz kindle to keep you busy, I just have now learned that message.mentions.users.keyArray(); exists
lel
Is there any JavaScript code for server count! If yes pls reply! 
yes there is
Please sent me
I think spoonfeeding is not allowed?
Idk
Discouraged but not strictly prohibited
You call yourself a verified dev and are asking for code for a pretty simple thing :/ Take a look at the docs for the library you're using
Dude! I asked because man i dont wanna spend time on that :/
I have lots of work tbh
Aka LAZY TRICKZ
then finish ur work, then go back to your bot
we dont spoonfeed here
its against the rules
It's not that hard wth
Oop sorry! My bad
here, let me show you how much of a prick you are being
Uhm
oh wow, would you look at that
if only google had answers for basic questions

now you understand why u pissed a few here
If you meant posting server count to top.gg, see https://docs.top.gg/
If he means that he is in the wrong channel 
yeah, if its that, it should be asked in #topgg-api
laziness isn't an excuse here, if you knew how to do that you would've done it in 1 min instead of wasting your time asking here, even searching on google would've been faster than coming here
not wrong
is it hard to make a dashboard for you bot
@torpid otter There are some tools you can use like https://statcord.com/
@spare badger what do that do
I don't think that's exactly what they mean by dashboard
What do you want to see in your dashboard?
Do you want a dashboard for your users, or a dashboard for yourself?
like mee6
Yes thats a different story
You would have to pull out your web development skills for that I'm afraid
oh
You need to know a lot of different technologies, it's definitely not for beginners
Hi, I am using express backend and I will auth users from express but I have no idea how to control this in react. Can you help me?
I will do it with api, but how?
Is it enough to do req.isAuthenticated in the backend?
You could try using a HTML list or table and style it using css?
ok
how do i add button on my bot list on top.g
You can add buttons but you can't add any javascript to them - what do you want the button to do?
You can style an anchor like a button
Pls help
Send request to that URL, read the response body and set that as your response
how do i change from text to css or html
You can use HTML directly in the description field.
To use css you wrap it inside <style> tags
i want to move invite the button
You don't need canvas for this? Make a http request to the image URL, get the data, send back the data
how do imove invite the button with ccs
More like 1st world problems
something like ```js
let stream = await fetch(imageurl);
stream.pipe(res);
using node-fetch
you could also simply make a redirect and avoid wasting bandwidth altogether
type messageMentionObj = {
embed?: embedMentionObj
messageContent?: string
}
type mentionObj = {
allow: boolean;
messageOptions: messageMentionObj;
]
interface MyClientOptions extends ClientOptions {
allowBotMention: mentionObj
}``` how would i see like if embed in messageMentionObj was provided, messageContent would not have to be provided. i want to require both, but if they make it embed, messageContent Isnt Required
is there way that you can move intvit button
Sure using padding or margin or an absolute or fixed position if you wanna move them around anywhere.
like how don't understanted
Maybe something like
Pick<messageMentionObj, "embed">|Pick<messageMentionObj, "messageContent">
Basic CSS
Depends on what you mean by moving.
Just a few pixels or down in the bottom left corner?
whats Pick<>?
Types which are globally included in TypeScript
If you have other properties too, which can be included with both embed and messageContent you can use Omit instead
ahh thanks so much.
You don't need canvas for this? Make a http request to the image URL, get the data, send back the data
well, besides ignoring our recommendations and reposting the exact same question, your user is undefined, either because the client is not logged in or because the user is not cached
you need to fetch the user instead of getting it
or cause req.params.id is not a valid id
`import discord
from discord import user
from discord.ext import commands
import json
import os
import random
os.chdir("C:\Users\Toshiba\Documents\Custom Office Templates")
client = commands.Bot(command_prefix=">")
@client.event
async def on_ready():
print("Ready")
@client.command()
async def hello(ctx):
print("Hello")
@client.command()
async def balance(ctx):
await open_account(ctx.author)
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = [str(user.id)]["bank"]
em = discord.Embed(title = f"{ctx.author.name}'s balance",color = discord.Color.red)
em.add_field(name = "Wallet",value = wallet_amt)
em.add_field(name = "Bank",value = bank_amt)
await ctx.send(embed = em)
@client.command()
async def beg(ctx):
await open_account(ctx.author)
users = await get_bank_data()
earnings = random.randrange(1000)
await ctx.send(f"A Person Gave You {earnings} coins!!")
wallet_amt = users[str(user.id)]["wallet"] += earnings
async def open_account(user):
users = await get_bank_data()
with open("mainbank.json", "r") as f:
users = json.load(f)
if str(user.id) in users:
return False
else:
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
with open ("mainbank.json", "w") as f:
json.dump(users,f)
return True
async def get_bank_data():
with open ("mainbank.json", "r") as f:
users = json.load(f)
return users
client.run("DO NOT TRY TO TAKE MY TOKEN")
`
What Is Wrong In This??

i am getting and error again and again
Statements must be separated by newlines or semicolons line 49:
wallet_amt = users[str(user.id)]["wallet"] += earnings
@pale vessel
+= is not an expression in python
What are you trying to do in that statement
why even += in that specific expression? you wouldnt do that in any other language either
In Python it's not valid syntax
js
i mean you wouldnt use += if you're assigning to a different variable anyway
yeah in that case it's kinda pointless, though maybe if they use wallet_amt a bunch then it's justified
Also it's useful for when you want to pass the result to a function
in the new theme "I don't think so"
it would make sense if he wants to update both variables in a single line, but considering the nature of the question, you start getting doubts the person has such comprehension
Y'all missed "Using json as a database" in there? ๐
Oh god...
@gritty lintel if you want to save data to disk and don't want to use a database, use shelves not JSON. https://docs.python.org/3.9/library/shelve.html#module-shelve
It is exceedingly easy to use.
i dont usually point out people using json, i just let them go through the experience :^)
sometimes the best teacher is excruciating pain ,depression and mental scars for using json as a database
and unbearable remorse
for all the lost data
and screaming users
oh oh and karens
don't forget the data karens
i want it so my bot sends a message in a channel when the server name is Spooky Month
so it has to keep checking
and i want it so it checks when the server name DOES NOT have the name "Spooky Month"
and when it does have the name it stops the loop
and when u make it not spooky month name again it loops
i think u can use boolean to achieve this idk tho
But noone knows how to do dis




