#development
1 messages · Page 1867 of 1
Python?
Global slash commands are cached for 1h. To test a slash command, use a guild-specific slash command. Those update immediately. Then when you're ready to deploy to your users, make it a global slash command.
Js
I have this problem since yesterday @rose warren
Like this way is spam
I don't code in js
@earnest phoenix actually i also help h python
Precisely I do not know how to do despite my multiple research @rose warren
if you can tell me how pls ?
(if you know)
what is the problem?
@rose warren
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const config = require("../config.js")
module.exports = async (client) => {
const rest = new REST({ version: '9' }).setToken(config.token);
(async () => {
try {
console.log('Chargement des commandes (/)');
await rest.put(
Routes.applicationCommands("myclientid"),
{ body: client.commands },
);
await rest.put(
Routes.applicationGuildCommands("myclientid", "834472071559512104"),
{ body: client.commands },
);
console.log('Chargement des commandes (/) effectué');
} catch (error) {
console.error(error);
}
})().then(() => {
client.application?.commands.set([
{
name: "ping",
description: "Affiche la latence."
},
{
name: "help",
description: "Affiche la page d'aide."
}
])
console.log("Le bot est prĂȘt !")
})
};```
I did as you told me and it's good I see nothing, now I want to put some but it does not appear in my slash commands
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
"How to delete a global command"
you asked this
Where do I go to get a ticket bot
Thank you
already deleted
but now when i want to create a slash command, doesn't create :/
Is it guild command or global ?
Did you wait an hour ?
What was the error ?
Did you wait an hour ? - no
What was the error ? - no
Is it guild command or global ? - global
i will try in guild
Global commands may take upto an hour to update
Wait some time
ok
Use guild commands for testing
yes thc
They're instant
x
(And DMs too!)

Wait you can create DM commands ?
Not specific to DMs, but slash commands load instantly in DMs
ooh
You can add in your own logic to make certain commands only usable in DMs though
Its work but
when i try to create a new command, the slash command appears but he respond me "Interaction failure"*
guild.commands.set([
{
name: "ping",
description: "Affiche la latence."
},
{
name: "help",
description: "Affiche la page d'aide."
},
{
name: "test",
description: "test"
}
])```
and the interaction reply it's created for this slash command
I have the impression that the command is not recognized by the bot, yet it is there since it displays it to me in the slash command
yes! when i log client.commands.get(commandName); (commandName is the commandName option in interactionCreate event, so it's the name of the interaction) he send me undefined
same problem when i use .create() method
so if u have an solution ? @near stratus
if (reaction.emoji.name === "đŻ" && user.id !== client.user.id) {
reaction.users.remove(user)
console.log(user.id)
let pipo = makeid(5)
channel1 = await message.guild.channels.create(`đŻ${pipo}`, {
type: 'text',
permissionOverwrites: [
{
id: rolehello,
deny: ['VIEW_CHANNEL']
},
{
id: message.guild.id,
deny: ['VIEW_CHANNEL']
},
{
id: user.id,
allow: ['VIEW_CHANNEL']
},
]
});
channel1.send(embed2).then(m => m.react(`đïž`));
}```why is this damn code creating multiple channels each time?
Anyone help me to fix buttons code
is this correct?
await client.application.commands.set(slash)
as i am getting an error telling me commands in not defined
this.application.commands.create(command, guild)
do i have to have to guild input?
if i dont input guild will it work on any guild
yes
alr
Maybe u are running it on multiple instances?
check if u have the process running on more than 1 terminal
nope that's not the thing
module.exports = {
name: 'kill',
aliases: ['Kill'],
description: "Kill a user",
execute(client, message, success, failed, args, Discord){
let userN = message.mentions.users.first()
const killArray = ["flew too close to the sun and died", "died by forgetting how to breathe", "died attempting to eat Sofa's cooking", "died after calling Zaz flat", "got hit by a car that ran into their house", "died after begging for admin perms", "commited toaster bath", "got sick and tired of the server owners constant bullying and got banned attempting to talk about it", "died"];
const randKill = killArray[Math.floor(Math.random() * killArray.length)];
const killArray2 = ["died attempting to hug", "was shot to death for peeking at", "went missing after exposing", "died after eating food made by", "died after receiving a kiss from"];
const randKill2 = killArray2[Math.floor(Math.random() * killArray2.length)];
if (!userN){
message.channel.send("Kill someone else not yourself");
} else {
message.channel.send("**" + userN.username + " " + randKill + "**" || "**" + userN.username + " " + randKill2 + " " + message.author.username + "**")
}
}
}
``` my kill command doesnt work 
This is the error I'm getting
```let userN = message.mentions.users.first() || message.guild.users.cache.get(args[0]);
^
TypeError: Cannot read property 'users' of undefined
îș§ npm start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-09-05T10_35_17_716Z-debug.log
exit status 1
What is that error
You do not have a script named "start" in ur Package.json
message.guild is undefined
But its a drop down
Code
earlier it was ```js
let userN = message.mentions.users.first() || message.guild.users.cache.get(args[0]);
and it still gave the same error
npm run start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-09-05T10_37_53_594Z-debug.log
îș§
Yes, u do not have a script named "start"
How can be fix it?
then the message is undefined
Create one, in package.json
Command?
I did define it in index.js
Which version?
Hello! Sorry if this is the wrong channel but my bot currently runs on replit.com and needs significant storage space to store images. I purchased the hacker plan to get 5gb of storage and that has now run out so I am looking for a simple cloud storage that can be accessed, read and written to with python. If anyone knows of any please either dm me or reply to this message so I get a notification. Thanks so much đ
v13
that command is from my old bot which is in v12
I used the same on my v13 one and tried every possible thing 
yeah earlier used to get errors when I ran the node . command. But now with this (
) I am not getting error until I run the kill command, bot starts properly
module.exports = {
name: 'kill',
aliases: ['Kill'],
description: "Kill a user",
execute(client, message, success, failed, args, Discord){
let userN = message.mentions.users.first();
const killArray = ["flew too close to the sun and died", "died by forgetting how to breathe", "died attempting to eat Sofa's cooking", "died after calling Zaz flat", "got hit by a car that ran into their house", "died after begging for admin perms", "commited toaster bath", "got sick and tired of the server owners constant bullying and got banned attempting to talk about it", "died"];
const randKill = killArray[Math.floor(Math.random() * killArray.length)];
const killArray2 = ["died attempting to hug", "was shot to death for peeking at", "went missing after exposing", "died after eating food made by", "died after receiving a kiss from"];
const randKill2 = killArray2[Math.floor(Math.random() * killArray2.length)];
if (!userN){
message.channel.send("Kill someone else not yourself");
} else {
message.channel.send("**" + userN.username + " " + randKill + "**" || "**" + userN.username + " " + randKill2 + " " + message.author.username + "**")
}
}
}
https://discordjs.guide/additional-info/changes-in-v13.html @earnest phoenix
can I get attachments from a slash command
or is it not possible
What would be the hosting server location for my bot?
Your vps, replit, heroku, pc... Wherever you're hosting it
and also you can: js message.author.avatarURL({dynamic: true});
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const config = require("../config.js")
module.exports = async (client) => {
const rest = new REST({ version: '9' }).setToken(config.token);
(async () => {
try {
console.log('Chargement des commandes (/)');
await rest.put(
Routes.applicationCommands("883621594877009921"),
{ body: client.commands },
);
await rest.put(
Routes.applicationGuildCommands("883621594877009921", "834472071559512104"),
{ body: client.commands },
);
console.log('Chargement des commandes (/) effectué');
} catch (error) {
console.error(error);
}
})().then(() => {
const guild = client.guilds.cache.get("834472071559512104")
guild.commands.set([
{
name: "ping",
description: "Affiche la latence."
},
{
name: "help",
description: "Affiche la page d'aide."
},
{
name: "test",
description: "test"
}
]).then(() => {
console.log(`${client.commands.size} commandes ont étées chargées.`)
})
});
};```
I actually use guild slash command, only 2 command of 3 worked on my bot (help and pi,g) but the test slash command doesn't work, why?
When my bot is ready, i log the count of commands and he say me 2 and not 3... why ? someone can help me pls thx
What is the command to install discord.js v12
/**
* What is this
* @param {UserID} invite Invite code or URL
* @returns {Promise<Message>}
* @example
* exmaple.function({});
*/
How exactly are they used or what is their full name?
i am trying to make a file inside of a file using fs but it dosent seem to work, this is the code i am using
if (err) {
throw err;
}
});```
but its not creating the files, can anyone help?
Are you trying to create a folder my file?
what?
What
never hear of a folder my file, what is it?
This is a folder
Now, back to our question, are you trying to create a folder or my file?
Yes
If youre trying create file use fs.writeFile
im trying to make a folder not a file
SlashCommands folder already exits or not ?
no
use recursive: true
Perfect timing
I was going to write exactly that
yes
yes
okay
what the heck is this Error: \\?\C:\My Projects\ella\ella\node_modules\canvas\build\Release\canvas.node is not a valid Win32 application.
its the latest version...
do i also have to make the SlashCommands folder first then do that?
ping in replies
no, thats what the recursive option is for
creates a folder and all parent folders if they dont exist
you copied your node_modules folder?
yea
oh-
alr
whoa
frick
this is a wierd eeror I get now... btw thanks for the package help đ
the error says it all
That is JSDoc
it is used for typescript intellisense and generating documentation
Oh thanks
I am getting this error when I'm trying to set a playlist thumbnail as an embed thumbnail
Seems like it couldnât interpret the url as it said
Do playlist.thumbnail.url
Yeah youâre inputting an object and all it wants is a string
My brain didnât read past the part where it said âas stringâ
Hi, how can I know if it's the first or the second time a user has reacted to a message? (With different reactions) - discord.js
reactions have a .count property
couldn't find something similar by checking docs, but sure, will try it out!
discord isnât defined
Idk much about python but youâre supposed to import the discord module before trying to use it
pip install discord
You didnât import it in your file
How to import?
You can just install a package and expect to it magically work, you have to import it
Something like âfrom discord import discordâ
But I donât use python
So I donât really know
@earnest phoenix Just did some search on google and looks like you've to put
import discord
at the beginning of your code
How to defined buttons
I recommend learning the language before trying to make a discord bot
are there any bot devs using djs sharding here
I'm sorry, but I'm not experienced with python either
djs says "Sharding is required" even though i do shard
config.shards is set to 3 atm
how many guilds is your bot in?
and how many shards did you define in config?
show your main.js
3
it works on my pc but not my vps
I have a question. Is this bot, using slash commands 
is there anything else here?
yes, the whole main file
i mean inside the client config
but that doesnt matter it worked before
no
the bot works just sharding doesnt
but auto doesnt work
are you using any env variables?
for auto i think so yes
:| i see that today this channel is also busy? okeh, bye
you're on v13 right?
yes
when you initialize your Client pass a shards option thatâs equal to [0, 1]
uh what
console.log(process.env) in your main.js
why though
it has the token in it
oh i see oops
see if you find SHARDING_MANAGER in it
okay
well how many shards are running also? cuz if itâs only like 2 you should just do internal sharding
it should only be 2
but not even that works
you can just ditch the sharding manager and use internal sharding
Hello! :>
as i said, not even that works
can somebody create a thread
like
new Client({
shards: [0, 1, 2]
})
?
the manager is working fine then
is SlashBot a regular discord.js?
or a different package
it doesnt?
Remove the ; your cursor is at 
youâre doing client.login right?
yes, what else
just makin sure
the bot worked fine before
wait
just sharding broke
why 0,1,2? since when does the manager do that?
i did that
when will conversation end?
wut
he told me to
okay what now
if you wanted to do that you would just run the client exactly the same and scrap the sharding manager
well decide, you want the sharding manager or internal sharding?
then use internal sharding lol
yeah how
Just realized it's not what I'm exactly looking for
I'd rather know if there's a second reaction (given by a specific user) in the whole collection, if there's, then remove the first reaction given by that user, and leave the second one... I'm testing with .first() but I can't get it yet
:/
no no, talk talk, it was just emoji, i didnt wanted to interrupt your conversation, its okay :')
and how to with sharding manager
um question how do i receive a request or something when someone votes? like would i just await or idk how to do that
because this would be only temporary
the manager should work with the code you had before, we were trying to find out why it wasnt working
it just said "Sharding required"
i wanted to check if the manager is setting the client shards correctly
it literally spammed it
wait
could it be that my host doesnt like env
that djs breaks bc of that

the env was working, we tested it
vps
but pc works?
i cant
wat
dude
i dont have any access
if you want to troubleshoot why something doesnt work on the vps, you have to test it on the vps
no way in hell you gonna figure out why it doesnt work on the vps if it works on the pc
yeah i cant
poor Tim
you ended talking? or i should go playing slitherio?
If you have a development question just ask
its possible the vps doesnt like the sharding manager, especially if its one of those shitty pterodactly panels or whatever
but you cant do anything if you dont have access
yea but yesterday i didnt got any answers when i did it, so...
Maybe you needed to provide more context
what if i did it? you just were busy with other pepol in the background and ended talkking in 2 mins
i dont think so. and okay. continue your talking. sorry for my msgs =p

im in contact with my friend now, thanks for figuring this out with me
good luck
how can i see how many active voice connections my bot has with djs v13?
let message = msg.channel.send({ content: "test" })
ERROR: message.edit() is not a function
await msg.channel.send
dpy?
no
? await ctx. ... is in pithon...
WAT ?!
many languages have the await keyword
yes
;-;
most languages have them
except of pithon where arent weird signs. oof
Where does one accept an invitation to the App whitelist of a discord bot?
there are
and now isnt there any other conversation in background? or i should start streaming slither in #609604489900589066
I'm trying to check if an user reacts with â
or the red cross (can't get the emoji lol), but when reacting, nothing happens. I don't get a reply or anything.
Code:
client.on('messageCreate', async message => {
if (message.content === `${prefix}test`) {
await message.reply("this is just a test lol");
message.react('â
').then(r => {
message.react('â');
});
const filter = (reaction, user) => {
return ['â
'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == 'â
' || reaction.emoji.name == 'â'),
{ max: 1, time: 30000 }).then(collected => {
if (collected.first().emoji.name == 'â
') {
message.reply("yes")
} else {
message.reply('idk');
}
}).catch(() => {
message.reply('No reaction after 30 seconds, operation canceled');
});
}
});
okeh. will be slither
client.on('guildMemberAdd', (member) => {
const embed = new Discord.MessageEmbed()
.setDescription(member.user.tag + 'has joined the server welcome!')
console.log('User' + member.user.tag + 'has joined the server!');
var role = member.guild.roles.find('884081521839976498');
const chnl = member.guild.channels.cache.get('884079613205155900')
chnl.send(embed)
setTimeout(function(){
member.addRole(role);
}, 10000);
});
djs v12 no errors at all just the message wont send
did you check if the event is even received?
do you have the guild members intent?
collector.on('collect', (ButtonInteraction) => {
let id = ButtonInteraction.customId
})
How can I get a button by ID. So I dont want to get the button I clicked. I want to get a specific button (in the buttonRow, too), so I can disable him
So is there a: ButtonInteraction.getButtonByID('') function or sth like that?
Repost
you should make <@Tim#2373> =]
who pong
ping pong?
Now attempting to load all the command handlers.
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found```
why is that?
the guild members intent has to be enabled in your discord developer portal
if you are not using the intents client option in your code, it should be enabled by default in v12, but still needs to be on in the dev portal
oh okay thanks
all things done or i should make a second stream with slither?
Command ping isn't registered in your bot client
dude just ask your question
okeh. stream :/
It is registered in my cog
đ©
import discord
from discord.ext import commands
import random
class fun(commands.Cog):
def __init__(self, client):
self.client == client
@commands.Cog.listener()
async def on_ready(self):
print("Successfully logged into the bot")
@commands.command()
async def ping(self, ctx):
await ctx.send("Pong!")
@commands.command()
async def _8ball(self, ctx, *,question = None):
if question == None:
await ctx.send(f"{ctx.author.mention}, Please mention a question.")
else:
answers = ["No.", "Never gonna happen.", "Shut the fuck up bitch.", "I don't know.", "Maybe.", "Yes.", "Defenitely gonna happen.", "Aw hell nah."]
embed = discord.Embed(title = "8Ball", colour = discord.Colour.green(), timestamp = ctx.message.created_at)
embed.add_field(name = "âąQuestion", value = f"_{question}_", inline = False)
embed.add_field(name = "âąWhat I say", value = random.choice(answers), inline = False)
embed.add_footer(text = f"Requested by {ctx.author.name}")
await ctx.channel.send(embed = embed)
def setup(client):
client.add_cog(fun(client))
idk if you remember me đ
came on python since yesterday
Hey.. quick question, sorry to interupt. Did I do something here wrong?
let string = "Ayo";
let replacing = (input) => {
input.replace('Ayo', 'Oof');
return input;
};
console.log(replacing('Ayo')) // Ayo
.replace returns the modified version probably
as opposed to modifying the original string
I did:
await py client.load_extension(f"cogs.{filename[::-3]}")
wdym by await
here
Strings are immutable in js, string.replace() returns a new version of the string
You can do ```js
let string = "Ayo";
let replacing = (input) => {
input = input.replace('Ayo', 'Oof');
return input;
};
console.log(replacing('Ayo')) // Oof
đ đ
Does it make sense to make a web page with nodejs?
and here's my full code:
import discord
from discord.ext import commands
import os
client = commands.Bot(command_prefix = "--")
filecount = 0
@client.command()
async def load(ctx, extension):
for filename in os.listdir('./commands'):
if filename.endswith == ".py":
client.load_extension(f"cogs.{extension[::-3]}")
filecount = 0
@client.command()
async def unload():
for files in os.listdir('./commands'):
for filenames in files:
filecount += 1
if filenames.endswith == ".py":
client.load_extension(f"{cogs.filenane[::-3]}")
print("Unloaded all the commands.")
await ctx.send(f"I have unloaded {filecount} number of files.")
filecount = 0
@client.command()
async def reload():
for files in os.listdir('./commands'):
for filenames in files:
filecount += 1
if filenames.endswith == ".py":
client.unload_extension(f"{cogs.filenane[::-3]}")
client.load_extension(f"{cogs.filename[::-3]}")
print("Reloaded all the commands.")
break
await ctx.send(f"I have reloaded {filecount} number of files.")
client.run('Token')
well you can code routes with it
but it's a pain in the ass to code a webpage using nodejs
@slender thistle
-_- okeh. i'll go to other server -_-
-_- bye -_-
Read the fucking channel etiquette and stop bitching around
@earnest phoenix !!! sWEARS hERE !!!
swearing is not against the rules, before reporting be sure the member is actually breaking rules.
;-;
Ikr
Thatâs the price for not banning kids of Discord đ€Šââïž
there is no discussion? i thought there was... #development message
?
im 17, im not kid btw =p
you're been told several time to "just ask your question"
if someone can help you, they will
Acting like 9
technically in the eyes of the law, you are still a kid
not a kid but not yet adult. this is in my country =p
if (message.mentions.has(client.user)) {
message.reply({ content: `Yo` });
}
If i mentioned here, everyone, or replied to the bot it will send the message
U wanna probably search the user mentions
someone can? look at msgs : #development message #development message
thats a google question
nope. cause pithon at me is 3.8 , not 3.3
and its not at google
anyways - i'll ask someone on dm in tweeter, maybe will get answer faster :/
What's cogs
Well, My bad
I'm autistic
I was gonna add the {} after cogs but thanks for pointing out my mistake.
Did you hide-
Okay
That was quick
Anyhoo you seem to hide some parts of your code
hi
hey =]
I was watching chat
And if not, some parts aren't making sense
same, watching chat
You're being offtopic FYI
@round cove also offtopic? hes a mod btw
Huh?
How can somebody be that annoying god damn
The cogs shit within the snippet you sent
me or vedant?
don't doubt this channel

Bruv, If you want to talk outside coding related stuff. Just head onto #general. this channel is meant for coding help and all that programming shit
Vedant's issue is annoying, they themself are not. You, on the other hand, are pissing everyone off
Why are you pinging me. 
Because I'm going through every file in a folder
becoz u were talkin with me and others appeared?
Yeah but where's the loop where you define filename?
I wasn't talking to you. I was talking to Shiv.
aaah. i thought to me đ
anyways bye - i have u mooted so i wont see pings
I'm sorry, I type very fast with mistakes lol. Its a typo basically
Bye and no one cares regardless
Bleh it's fine
i'll faster get answer on tweeter than here :/
Thatâs what this channel is made for
i dont think so, there are only general channels =]
Not fine for me. You wasted more of your time explaining stuff to me earlier and it all comes onto stupid typos I made

For your impatient ass' issue, hacknorris, try retyping the function stuff manually again. If that doesn't work, scroll up and see what can be wrong above
I wasted time on worse stuff
Damn
Get your shit straight and stop scting like a child dude
Kids will never learn if you just ignore them
But they will shut the fuck up if you keep on ignoring them
I've tested it on so many 12 year olds online
And it works out well
I'm too used to kids in Arma playing with me so ignoring isn't the first thing I think of when dealing with them
Force of habit
Aah I see lmao
:-|

Harsh truth over silence, essentially. Anyhoo back to what I was saying
@brave garnet your issue could be happening because of syntax error around if not in earlier lines than the interpreter is reporting
its in this line and line is good
Whats the problem hacknorris
do u want all the source?
Send it up I'll see what I can do
I just said the error could be caused by something around the reported line and not the line itself
Why the pass_context though
so why points in d in def?
It's redundant since v1.0
to get text channels from input
It doesn't make any difference
makes becoz without it wasnt working. and tihs part doesnt stop bot. i dot yet know what ;-;
@slender thistle I got the error again
Cogs not defined
Sending the code
Came back onto discord.py after so many months
And I know shit about it rn lmao
@client.command()
async def load(ctx, extension):
for files in os.listdir('./commands'):
if extension in files:
client.load_extension(f"cogs.{extension[::-3]}")
Do note, dpy has ceased development
I know
me 2
js is đ€ź
Py is đ€ź
Tada well cogs isn't defined
and what bout bash?
Then neither is JS
Stop shit talking lmao
Javascript is meant for website regarding stuff
Notice how you put out an opinion without backing it up
bye
And some backend dev
JavaScript wasn't meant for the backend but here we are now
Keep your opinions to yourself if you ain't got the brass neck to back them up
So what should I do
I don't know
You talking to me? đł
Show me what your bot folder looks like
That is it
And the commands folder
Shiv means the directory tree
Hmm holdup
my pc is fucked up/has some issues lmao so I'm coding it on my mobile meanwhile 
Bleh
lmfaoo
xdd
Okay
I really can't code anything on my pc atm
So let me explain this
Whatever is considered an extension discord.py will import in a Python import-like manner
aah
im kinda new to using mongo how do i find my mongoURI
Isn't that the path to the db?
That means if you want to refer to the fun.py file in the commands folder, you will either iterate over the directory's files by getting them via os.listdir (this allows for dynamic extension loading)
or
load_extension where the argument will be commands.fun
oh I see
Because commands dir and fun Python file
You don't use cogs or filename outside of your cogs
Also, I'd suggest using == instead of in when iterating over the commands directory's contents
What I mean more precisely is as follows:
for extension in os.listdir("commands"):
if extension[:-3] == cog_name: # Where cog_name is the name of the cog received from the command itself
bot.load_extension(f"commands.{cog_name}")
đ
Tbh it both comes onto the same thing.
in and == ig
Not exactly
in is inclusion, == is exact match
'a' in 'damn' is True
('a' == 'damn') is False
I'd suggest reading up on Python comparison operators
milliseconds iirc
no way
Seconds
alright I'm retarded
lol
I wonder why JS works with ms but nodejs with s as default val for the uptime
idk
Can I ask a js related questions here?
I find it rlly annoying
collector.on('collect', (ButtonInteraction) => {
let id = ButtonInteraction.customId
})
How can I get a button by ID. So I dont want to get the button I clicked. I want to get a specific button (in the buttonRow, too), so I can disable him
So is there a: ButtonInteraction.getButtonByID('') function or sth like that?
discord also uses seconds
I was tricked too last time, donât worry
Shoot
I mean Unix timestamps are in s by default too
on collect you want to edit the message with new buttons where one of which is disabled
JS is just weird
I am getting undefined when I print it. But if I print it inside if its printing perfectly
on collect I just want to find buttons by ID not more
then save the buttons in an object i guess
"id": <MessageButton>
then just get the button with obj[id]
I will try it
you're not awaiting the sqlall
let row = new MessageActionRow().addComponents(
new MessageButton()
.setEmoji('âȘ')
.setStyle('SECONDARY')
.setCustomId('wL'),
new MessageButton()
.setEmoji('âïž')
.setStyle('SECONDARY')
.setCustomId('L'),
new MessageButton()
.setEmoji('â¶ïž')
.setStyle('SECONDARY')
.setCustomId('R'),
new MessageButton()
.setEmoji('â©')
.setStyle('SECONDARY')
.setCustomId('wR')
)
I cant define something inside the addComponents()
then define it outside lol
sqldb.all accepts a callback, so it wouldn't make sense to return a promise as well
its says await has no effect on this type of expression
doesnt make sense
I use keyv
let button = new MessageButton()?
In your callback, you aren't returning if an error occurs, which is one thing. But do you know where the error is explicitly coming from
then you dont have a row, you just have single buttons
no
I an new to javascript. So I don't know how to do it.
Just switched from python to js
you can still do .addComponents(button)
Well do you have a stacktrace
no
can you get one
whats stracktrace. Let me google it first
the big verbosy error
okay I think i can get stack trace
I miss Rust error messages
can you share it
oh, empty now?
okey
import discord
from discord.ext import commands
from keep_alive import keep_alive
import json, random, requests, datetime, time, urllib.request, io, os, aiohttp
from datetime import datetime, timedelta
import math
import base64 as b64
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='$', help_command=None, intents=intents)
with open("bad-words.txt", 'r') as f:
global badwords
words = f.read()
badwords = words.splitlines()
@bot.listen("on_message")
async def swears(ctx):
msg = ctx.content.lower()
for word in badwords:
if word in msg:
await ctx.delete()
@bot.listen("on_message")
async def pingraid(ctx):
msg = ctx.content.lower()
if member.mention in msg:
return
l = []
scam = requests.get(
"https://script.googleusercontent.com/macros/echo?user_content_key=V1VRkcLy79NqRzGszzki5IwoqgfiRS0CPnpSth1jVdX0Z88w39o7tC71MMkAARMFYXSZIe5ysMkkTdp_V8q-gLFNUefAtxy5m5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnA1zRMJcOWhp5p8-TrasYiLfc8s82yHYvncMdEYM4VMzrAWyr3_vgWcPkd2qwPRs1bz0TAVXLS4Dleb--x_lwbJ0QrOacq8a_9z9Jw9Md8uu&lib=Mvhguv8KrjGlroshaZkuz2rjldAiTUHuJ"
)
Data = scam.json()
for i in Data:
for key in i:
l.append(i["put here stean scam: âââ"])
@bot.listen("on_message")
async def scam(ctx):
global l
for thing in l:
if thing in ctx.content:
await ctx.delete()
@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Activity(
type=discord.ActivityType.listening, name="$man command..."))
@bot.command()
async def rm(ctx, arg1):
channel = ctx.channel
msg = await channel.fetch_message(arg1)
await msg.delete()
@bot.command()
async def stat(ctx, member: discord.Member = None):
if member == None:
await ctx.send(f"`{ctx.message.author.status}`")
else:
await ctx.send(f"`{member.status}`"
@bot.command()
async def rn(ctx, channel: discord.TextChannel, arg1):
await channel.edit(name=arg1)
all error
(hoping a god will enter đ )
You should post your error message too
syntax error -> on line 69 (async def)
Nice
đ
at me or hookahoo?
your shard is dead
Okay how to solve it
đ
anyways - figured out for myself where i got bug. thk u but u were helpless :/
Rust error messages are â€ïž
Get off the high horse bud
;kill 884131985369481276
Glad to hear you solved it yourself but your ass ain't innocent here either
what prefix should I keep for my bot?
whatever you want
Whatever is related to it
but you may end up just using slash commands
Or anything convenient
You should think about moving to slash commands anyway
@opal spruce hi
?
k
my discord bot is conneted to the website i mean the bot fetchs my data to my website is there any host to host them both at the same project?
Any machine that can run your bot and the website at the same time
replit
And what I mean by that is that it can handle running both
The rest is up to you
replit doesnt host the node and html at same project
it does if you use express
alr tried and didnt work
then you did it wrong
can ya join my repl to helpp
ok
ok check dm
k
Damn attracting bugs
lmao
can anyone help me, when you do the command lets say -ping how do I make it so the -ping is deleted? Could anyone send me the code for it or where I can learn how to do it please
What library are you using
That's the programming language.
Discord.js? Eris? etc.
ye discord.js
Just call .delete() on the Message instance
try using the debugger
not allowed to talk in here 
đ
my discord bot is conneted to the website i mean the bot fetchs my data to my website is there any host to host them both at the same project?
Didn't you like the answers you got already?
can i ask or channel busy?
ask
dis $#1t doesnt filter mentions. after looking to stackoverflow and docs i think it should...
@bot.listen("on_message")
async def pingraid(ctx):
msg = ctx.content.lower()
if len(ctx.mentions) >= 10 in msg:
ctx.channel.send(f"why are you pinging too much @{ctx.author} ?")
ctx.delete()
Nothing is for free, there's a list with providers u could use pinned in here
we already told you how to do it, what else do you want?
add await msg.delete() instead of ctx.delete()
u can come and check
it should work ig
:||
send link then
aaaa await my dumb brain đł
try doing it and lmk
k, thk
and also do await ctx.channel.send("content") instead of ctx.channel.send(f"why are you...")
ye, ik. im just dumb and forgor to await đ
edit - didnt yet worked sadly TwT
this. did yet nothing... TwT :
@bot.listen("on_message")
async def pingraid(ctx):
msg = ctx.content.lower()
if len(ctx.mentions) >= 10 in msg:
await ctx.channel.send(f"why are you pinging too much @{ctx.author} ?")
await ctx.delete()
@sick fable âââ
-_-
aw shit
ye
holdup lemme quickly code mine
okeh
I'm trying to check if an user reacts with â
or the red cross (can't get the emoji lol), but when reacting, nothing happens. I don't get a reply or anything.
Code:
client.on('messageCreate', async message => {
if (message.content === `${prefix}test`) {
await message.reply("this is just a test lol");
message.react('â
').then(r => {
message.react('â');
});
const filter = (reaction, user) => {
return ['â
'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == 'â
' || reaction.emoji.name == 'â'),
{ max: 1, time: 30000 }).then(collected => {
if (collected.first().emoji.name == 'â
') {
message.reply("yes")
} else {
message.reply('idk');
}
}).catch(() => {
message.reply('No reaction after 30 seconds, operation canceled');
});
}
});
wait
okeh
which version of discord.js?
do the initial reactions work?
does the 30 second message work?
now is?
I'm close
real skid moment
?
lmao
didn't worked lmao @brave garnet
gonna subscribe
;-;
Just on the Python side of stuff
@client.event
async def on_message(message):
try:
for mentions in message.content.mentions:
if len(message.content.mentions)>= 10:
await message.delete()
await message.channel.send("..")
except Exception as error:
await message.channel.send(error)
break
here's my current code
right
which is total aids
:000 you were doing coke in that video????
where are you getting mentions from
no way to make it work?
ctx.message
it sends 'str' object has no attribute 'mentions'
?
content is a string
i didnt had it...
you gotta use for loops to figure out the mentions and all that bullshit
bro
lmao
content is a string
that code makes no readable sense
lmaoo ikr
automod
I'm going to sleep
tried
I will figure it out tomorrow
;-;
and will let you know
Litterally just get the length of message.mentions
;;;;-;;; i'll faster get answer from tweeter i see than from here..
i did it literally
i did. moment
you did, virtually the opposite
have you gotten your answer yet
@bot.listen("on_message")
async def pingraid(ctx):
msg = ctx.content.lower()
if len(ctx.mentions) >= 10 in msg:
await ctx.channel.send(f"why are you pinging too much @{ctx.author} ?")
await ctx.delete()
nope
D:
v13. The bot reacts, but the receiving end doesnât work (when I react, nothing happens). And the 30 second message works yes
the filter function has to be inside the collector options in v13
thank. removed. gimme 5'
Ah okay. Thanks
await ctx.delete() ah yes, turning a ping raid into a GHOST ping raid
what could be better?
honestly its fine
so what i should do?
because thats not a function
to filter dis shit?
mute the member or some other kind of punishment
ikr. but it doesnt even detect... it doesnt even message on it . nothing
ik, I'm just commenting on message deletion
ikr?
not on the issue itself
so what. no way to detect? without iterating all string for <!@>
that's with chillfish
how do I delete the command with a command handler

and make a dictionary or a list which has every possible reasons of pings in it( <@!> or @)
really no way?
so why dpy have mesage.mentions function?
didnt he already tell you what to do? lmao
btw, when testing don't try pinging the same user multiple times
this is just a battle of bad code i swear
bcuz it'll only count as 1 mention
WHAT? ONE MENTION IN 10 PINGS? THK
???
most libs consider only distinct mentions
add 10 bots
or 2
ikr? i had second server with a few pepol and bots
Linter deciding to just, not lint 
stained IDE đ©
does 32767 (all intents) includes privledged intetnts?
dies đ
đ
It's a sign to not use linters
ye, it does due to GUILD_MEMBERS and GUILD_PRESENCES
o-...
that language looks a bit rusty
clean it up
see? the rust is even visible /s
is there like a function like
const myIntents = new Intents();
myIntents.add({ intents: 32767} );
myIntents.remove( { stuff } ) // <----
const client = new Client({ intents: myIntents });
If it isn't documented then no
oh wait it is đ
intents aren't actually represented by an integer but a binary sequence
it's easier to visualize like that
yis
you just need to know which indexes are the perms you want to remove
everything is integer if u try hard enough
For what
I wanna see what I got to see if i need to upgrade..
bc I cant find it in my configs..
How do I know if the message channel is a community channel?
Channel#type
For djs it doesnt work
It shows only text or voice
What's a community channel then?
thats a text channel...?
Yes
the type is equal to text then
But i wanna return if the channel is for community
Wdym "for community"
GUILD_TEXT - a guild text channel
Public?
announcement channels
I'm making a server setup command and it should delete all channels
But if the channel is set for community it can't delete it and throws an error
I want it to detect this and continue without deleting that channel
It is more clear?
.catch(err => {
//Do nothing
})
botum randomly broke, am not sure what this is 
it happens when you start the bot
Doesn't the fact you need to handle errors or your process will die
(at least in newer node versions)
Doesn't the fact you need to handle errors
If you don't catch any promise you're using, then at least catch the (unhandled) process errors
For example:
for(const event of ["uncaughtException", "unhandledRejection"])
{
process.on(event, (error) => { console.error(error); });
}
Which will obviously handle rejections and exceptions
That still doesn't change the fact your promise throws an error and need to find out why.
let value = 2
if(value != 3) return;
console.log("Value detected as 2")
It doesnt return...
!==
Still same
im already handling errors
was doing that for weeks
it was in the code
fixed it now
i was getting 429
let x = message.guild.ownerID
let y = message.author.id
if(x === y) {
message.reply("Yes")
} else {
message.reply("No")
}
You're still on djv12?
Error: Cannot find module 'discord-buttons'
Require stack:
- E:\C) Developing\Wolfy Djs-13\node_modules\utils-discord\index.js
const Util = require('utils-discord')
don't use discord-buttons since Discord.js natively supports them now
I am not i am only using
const Util = require('utils-discord')
For mongoose
utils-discord requires it
But discord.js v13 not working with it
Can i use it with another way without package ?
const data = await Util.mongoFind(guildSchema, { guildID: message.guild.id})
E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\APIMessage.js:9
class sendAPICallback extends dAPIMessage {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\APIMessage.js:9:31)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\WebhookClient.js:2:20)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\MessageComponent.js:1:23)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
ok
discordjs ecosystem is hell
what's wrong with it
if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
^
ReferenceError: GuildData is not defined
setcode
const channel = args[0]
let data;
try {
data = await schema.findOne({
GuildID: message.guild.id,
ChannelID: channel
})
if(!data) {
data = await schema.create({
GuildID: message.guild.id,
ChannelID: channel
})
}
} catch (error) {
console.log(error)
}
await data.save()
return message.channel.send({content: `set the channel to <#${channel}>`})
schema
const mongoose = require('mongoose')
const guildSchema = new mongoose.Schema({
GuildID: { type: String },
ChannelID: { type: String }
})
module.exports = mongoose.model('guildSettings', guildSchema)
Someone help please
oh wait
I forgot to send it
try {
GuildData = await schema.findOne({
GuildID: message.guild.id,
ChannelID: channel
})
if(!GuildData) {
GuildData = await schema.create({
GuildID: message.guild.id,
ChannelID: channel
})
}
} catch (error) {
console.log(error)
}
if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
Did you define GuildData before that? Youâre assigning GuildData but never declaring it
Youâve got GuildData = blahblah but not let GuildData = blahblah unless you defined it before that
That would raise an error of its own actually so nvm
I it possible to make a cli very simply using an npm or something?
yes its possible to make a command line program using node.js, if thats what you're asking
yes, is there a npm or something so I dont have to code it all?
just use the built in repl module
that means I have to do it on repl
easy life eh?
?
there are modules that can help you, but you still have to code something lol
use some botmaker if u want easy plug 'n play stuff, just don't expect anything sweet or fancy
yeah, but something to make it easier
I'm trying to make an npm package
you mean making a library?
ah, then I apologise, I thought u wanted a cheesy way of making a bot without coding
lol no worries
@bot.command()
async def testvote(ctx):
headers = {
"Authorization": "a"
}
r = requests.get(f'https://top.gg/api/bots/882268179991257109/check?userId={ctx.message.author.id}', headers=headers)
print(r.text)
why doesnt this work
i obviously changed my token but
doesn't python require waiting for async stuff?
Where
But mixing synchronous code with Discord.py is discouraged
if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
^
ReferenceError: GuildData is not defined
setcode
const channel = args[0]
let data;
try {
data = await schema.findOne({
GuildID: message.guild.id,
ChannelID: channel
})
if(!data) {
data = await schema.create({
GuildID: message.guild.id,
ChannelID: channel
})
}
} catch (error) {
console.log(error)
}
await data.save()
return message.channel.send({content: `set the channel to <#${channel}>`})
schema
const mongoose = require('mongoose')
const guildSchema = new mongoose.Schema({
GuildID: { type: String },
ChannelID: { type: String }
})
module.exports = mongoose.model('guildSettings', guildSchema)
to know the channel
try {
GuildData = await schema.findOne({
GuildID: message.guild.id,
ChannelID: channel
})
if(!GuildData) {
GuildData = await schema.create({
GuildID: message.guild.id,
ChannelID: channel
})
}
} catch (error) {
console.log(error)
}
if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
that's all codes
weird
doesnt work
try {
let GuildData = await schema.findOne({
GuildID: message.guild.id,
ChannelID: channel
})
if(!GuildData) {
GuildData = await schema.create({
GuildID: message.guild.id,
ChannelID: channel
})
}
} catch (error) {
console.log(error)
}
if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
Not working
oh
why channel is not defined ?
ReferenceError: channel is not defined
at Object.execute (E:\C) Developing\Wolfy Djs-13\commands\test\testagain.js:17:24)
try {
let GuildData = await schema.findOne({
GuildID: message.guild.id,
ChannelID: channel
})
if(!GuildData) {
GuildData = await schema.create({
GuildID: message.guild.id,
ChannelID: channel
})
if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
}
} catch (error) {
console.log(error)
}





