#development
1 messages · Page 1270 of 1
Is there a good github repo code thingy for a disable command?
whitenames make me
Goddamn tylers, man.
just copy it
@autumn aspen FOUR different people have given you the answer
@umbral zealot but doesnt it fuck my command handler ?
no
NO
Not stupid. Just lacking in experience, and a damn Tyler
omfg
aight
Bruh we jokin. Just type const Discord = require('discord.js'); in the beginning
then people wonder why we don't like entitled little kids that refuse to learn the language.
my man has a new lvl of stupidity
@knotty sigil stfu
haha
lol
Please be nice.
sorry
then people wonder why we don't like entitled little kids that refuse to learn the language.
@umbral zealot bro u 2 stfu
lmao
Bruh.
And what happened in here?
What's going on here
Be respectful
Yeah well, if you can't handle the truth,we can't do much.
just look up the chat @wet dove
And what happened in here?
@wet dove little braincells droped thats it
Learn the language you want to use first.
He just asked a question though, and we answered. Job done. 🆗
Learn the language you want to use first.
@umbral zealot man chill out Im doin it all the time ot trying
and then they asked it again
If you are not willing to help, don't help. Ignore this channel.
but we did help him
@autumn aspen Please just add const Discord = require('discord.js'); at the beginning of the code to define Discord
If you are not willing to help, don't help. Ignore this channel.
@wet dove they helped
Yeah, we've all been there. What we're telling you is that you should know the language first, otherwise, making bots is extremely difficult.
after getting 4 answers
after getting 4 answers
@misty sigil chill I was slow
It's alright.
@misty sigil
aye
https://discord.js.org/?source=post_page---------------------------#/docs/main/stable/class/Guild?scrollTo=bannerURL for the banner https://discord.js.org/?source=post_page---------------------------#/docs/main/stable/class/Guild?scrollTo=iconURL for the icon
i remembers it
channel.guild
.setThumbnail(message.guild.iconURL())
how can i get int args (discord.py)
You're welcome
Bois
Question
presence intent are like bot events like GuildMemberAdd and those right?
I need some help with await: I want these four functions to execute one after the other and await a response. How can I do that?
const tokenRes = oauth.tokenRequest({
clientId: config.clientId,
clientSecret: config.clientSecret,
code: req.query.code,
scope: 'identify guilds.join',
grantType: 'authorization_code',
redirectUri: 'https://ai**.cam*******.repl.co/web/addserver',
});
const userRes = oauth.getUser(tokenRes.access_token).then(console.log);
oauth.addMember({
accessToken: tokenRes.access_token,
botToken: config.token,
guildId: '757991475941343352',
userId: userRes.id,
});
It's alright.
@feral aspen thx man it worked actually thx guys u the best!
well, literally const thing = await blah()
😄
It needs to be in an async function, too
Hey Evie.
how can i get int args (discord.py)
???
Ah that's the issue
It needs to be in an async function, too
@umbral zealot me? sorry for asking
No, not you, geeze, you were already answered 10 times.
No, not you, geeze, you were already answered 10 times.
@umbral zealot I was just alert
Can you... not hide the part where we can see if it's async or not? lol
can anyone help please
@umbral zealot NVM wrong function was async
nvm
lmao
@violet mesa
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
lol
I mean they've already asked twice, to be perfectly fair.
just ask ur question
how can i get int args (discord.py)
you should wait for a py dev to help u on that
ok
commands extension
its not working
how can i make my bot leave server/
servers
shivaco, its not working
let filter = m => m.author.id === "673362753489993749";
let collector = message.channel.createMessageCollector(filter, { max: 1, time: 25000, errors: ['time'] })
collector.on('collect', claimed => {
console.log("collected... \n" + claimed.first().content)
if(claimed.embeds[0].description == "got the card!"){
msg.delete();
return message.channel.send("delete!");
}```
how do I fix the error
TypeError: claimed.first is not a function
@stark abyss collect is a Message instance.
There's no need to try getting the first item as you already have it.
ahh okay
how do i get the id of an animated emoji without nitro
@autumn aspen I've no idea what you mean, but we don't just dispense code for you to throw into your command. That's not how it works (if that's what you meant)
Jeremy if you want to jump through some hoops you could inspect element and navigate to the emoji, but I don't know if there's a better way of doing it.
ok thanks
inspect element / use a bot ^^
How do i host my bot to be online 24/7 without paying if there is a way
you need to pay
:/
you're spending somebody else's resources
welcome to capitalism
well
welcome to the world, mate.
lol
@autumn aspen I've no idea what you mean, but we don't just dispense code for you to throw into your command. That's not how it works (if that's what you meant)
@sudden geyser forget abt lol
How do i host my bot to be online 24/7 without paying if there is a way
@earnest phoenix Do you have an android phone or a PC sitting around?
yes i have 3 android phones 1 iphone and 1 windows 10 pc
@earnest phoenix Will you bot being doing some pretty complex stuff or will the specs of a phone suffice?
message.channel.send(editTimer).then(msg => {
let filter = m => m.author.id === "673362753489993749";
let collector = message.channel.createMessageCollector(filter, { max: 1, time: 25000, errors: ['time'] })
collector.on('collect', claimed => {
console.log("collected... \n" + claimed.embeds[0])
//if (!claimed.embeds[0]) return;
if(claimed.embeds[0].description == "got the card!"){
msg.delete();
return message.channel.send("delete!");
}
})```
it doesn't console.log
lmao
no i am just asking, for now my bot is not done so i am just asking to know for later
yes i am in school

ty
no i am just asking, for now my bot is not done so i am just asking to know for later
@earnest phoenix You can use Termux app for android and run nodejs there. Or setup an ubuntu server
I have a setup script for the first one to get started
https://discordapp.com/channels/264445053596991498/272764566411149314/758502307049898005
lmao
bremea got no chill 
so like i was saying, console.log("collected... \n" + claimed.embeds[0])
prints object object
@Bloody.command()
async def tweet(ctx, *, message: str):
await ctx.message.delete()
async with aiohttp.ClientSession() as cs:
async with cs.get(f"https://nekobot.xyz/api/imagegen?type=tweet&username={Bloody.user.name}&text={message}") as r:
res = await r.json()
await ctx.send(res["message"])```
how do i send this as an image?
why would you spend processing power on it
why is there a f
just chuck the url in an embed
@bot.command()
async def deploy(ctx, arg: int):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.message.author
if users[str(user.id)]["wallet"] >= arg:
users[str(user.id)]["wallet"] -= arg
users[str(user.id)]["bank"] += arg
await ctx.send("succesfully transfered the cash")
elif users[str(user.id)]["wallet"] < arg:
await ctx.send("you dont have enough for that")
```why does this not work?
doesnt show errors
just doesnt work
(python)
why is there a
f
@stark abyss It's interpolation iirc
ic
what bot could get an emoji ID
any, as long as the bot is in the guild where the emoji is in
can i ask something who have no relation with bots?
just ask
okok, im making a external file for functions (python)
but in 1 function i need a object, and that object is declared in the main file
is there any form to import objects from another file?
nonono, im not talking abaut variables
ive allready try that
from main import x1, x2 that
oh?
like this
Main.pyw
from tkinter import *
from functions import click
w = Tk()
lbl = Label(text="Hello").pack()
btn = Button(text="click me", command=click).pack()
w.mainloop()
from main import *
def click():
lbl.configure(text="click!")
but this doenst work (is an example)
if i have: folder 1 file 1 - folder 2 file 2 and i want to get file 1 from folder 1 while in file 2 in folder 2, how would that be done?
similar to ./folder 2/file 2
(this is in a html file btw)
../file1 ?
../?
ah let me try that out
oo
thank you so much!
that appears to not have worked
wait
yeah that doesn't work @pale vessel
(sorry for ping)
you need to show the directory structure for clarity
like
const file1 = require("../folder1/file1");
if youre using js btw
Code:
var Discord = require('discord.js');
module.exports.config = {
name: "mute",
aliases: ["m"]
}
module.exports.run = async (client, message, args) => {
if(!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You can\'t use that!');
var user = msg.mentions.users.first();
if(!user) return msg.reply('You didn\'t mention anyone!');
var member;
try {
member = await msg.guild.members.fetch(user);
} catch(err) {
member = null;
}
if(!member) return msg.reply('They aren\'t in the server!');
if(member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You cannot mute that person!');
var rawTime = args[1];
var time = ms(rawTime);
if(!time) return msg.reply('You didn\'t specify a time!');
var reason = args.splice(2).join(' ');
if(!reason) return msg.reply('You need to give a reason!');
var channel = msg.guild.channels.cache.find(c => c.name === 'potato');
var log = new Discord.MessageEmbed()
.setTitle('User Muted')
.addField('User:', user, true)
.addField('By:', msg.author, true)
.addField('Expires:', rawTime)
.addField('Reason:', reason)
channel.send(log);
var embed = new Discord.MessageEmbed()
.setTitle('You were muted!')
.addField('Expires:', rawTime, true)
.addField('Reason:', reason, true);
try {
user.send(embed);
} catch(err) {
console.warn(err);
}
var role = msg.guild.roles.cache.find(r => r.name === 'Muted');
member.roles.add(role);
setTimeout(async() => {
member.roles.remove(role);
}, time);
msg.channel.send(`**${user}** has been muted by **${msg.author}** for **${rawTime}**!`);
}
Anyone help?
Error:
PS C:\Users\admin\apemodicus> node .
(node:7340) UnhandledPromiseRejectionWarning: ReferenceError: msg is not defined
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\mute.js:9:5)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:7340) 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:7340) [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.
help anyone?
which file from what file?
logo from files
msg not defined
i can get it to most of the other ones by ./ but getting it from index.html in sbn
you want to access logo.png from what file?
@drifting wedge [msg].guild.leave()
msg?
@drifting wedge
msg or message
ohhhh
want to access logo.png from the sbn/index.html directory which is part of the files folder along with logo.png
want to access logo.png from the sbn/index.html directory which is part of the files folder along with logo.png
bruh okay discord
so ../logo.png
Code:
var Discord = require('discord.js');
module.exports.config = {
name: "mute",
aliases: ["m"]
}
module.exports.run = async (client, message, args) => {
if(!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You can\'t use that!');
var user = msg.mentions.users.first();
if(!user) return msg.reply('You didn\'t mention anyone!');
var member;
try {
member = await msg.guild.members.fetch(user);
} catch(err) {
member = null;
}
if(!member) return msg.reply('They aren\'t in the server!');
if(member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You cannot mute that person!');
var rawTime = args[1];
var time = ms(rawTime);
if(!time) return msg.reply('You didn\'t specify a time!');
var reason = args.splice(2).join(' ');
if(!reason) return msg.reply('You need to give a reason!');
var channel = msg.guild.channels.cache.find(c => c.name === 'potato');
var log = new Discord.MessageEmbed()
.setTitle('User Muted')
.addField('User:', user, true)
.addField('By:', msg.author, true)
.addField('Expires:', rawTime)
.addField('Reason:', reason)
channel.send(log);
var embed = new Discord.MessageEmbed()
.setTitle('You were muted!')
.addField('Expires:', rawTime, true)
.addField('Reason:', reason, true);
try {
user.send(embed);
} catch(err) {
console.warn(err);
}
var role = msg.guild.roles.cache.find(r => r.name === 'Muted');
member.roles.add(role);
setTimeout(async() => {
member.roles.remove(role);
}, time);
msg.channel.send(`**${user}** has been muted by **${msg.author}** for **${rawTime}**!`);
}
nice code, what about it?
seriusly
Error:
PS C:\Users\admin\apemodicus> node .
(node:7340) UnhandledPromiseRejectionWarning: ReferenceError: msg is not defined
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\mute.js:9:5)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:7340) 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:7340) [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.
come to dm
help anyone?
youre spaming here
you defined msg as message
come dm
did you copy pasted the code?
did you copy pasted the code?
@pale vessel wut!?
not you
@pale vessel no I didnt but my friend said u will fix any error that happens
@autumn aspen what you are using msg or messages as message variable?
well thank you anyways mr.flazepe
@autumn aspen what you are using msg or messages as message variable?
@dire obsidian message
@autumn aspen what you are using msg or messages as message variable?
@dire obsidian DM
oh thx
@drifting wedge you use python right?
ikd i dont make py bots
Didn't I tell you how
Are you not familiar with objects
literally
guild = get_guild(id)
guild.leave
kind of
mainly wondering why people can't learn the concept of OOP before making Discord bots
xd
is there a way to copy a mongodb document to another collection?
without having to map each of the values one by one
Yo, why does this pop when I try to invite my bot to my server?
doc = findOne()
if (doc) somedb.somecol.update/insertOne(doc)
thank you shiv
https://imgur.com/IbuhOik.png @sinful thistle
message.channel.send(editTimer).then(msg => {
let filter = m => m.author.id === "673362753489993749";
let collector = message.channel.createMessageCollector(filter, { max: 1, time: 25000, errors: ['time'] })
collector.on('collect', claimed => {
if (!claimed.embeds[0]) return console.log("not embed");
if(claimed.embeds[0].description.includes(" got the card! ")){
try{
msg.delete();
isClaimed = true
}catch{
return
}
return message.channel.send("delete!");
}
return;
})
don't worry about what's closed and what's not but it gives me UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
@sinful belfry thanks
how would you do that? @pure lion
send me the full error stack
oh
(node:458) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
at RequestHandler.execute (/home/runner/kanekis-TEST-bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:458) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
there is like hella more

@pure lion
jeez i need the waste paste bin
requesthandler errors usually don't point to where the error happens
what is it called
no
save it and send the url at the top
send the whole thing at once
that should be the whole thing
they are the same error
occuring more then once
so anyone can help me

@pure lion
okay well thx anyway

debug
did console print "not embed"?
log if it errors in the try catch block
if the error doesn't give information, find where it came from by debugging
well the thing is that the code is working fine
everything is doing like its supposed to be
including the part msg.delete()
but it still gives an error
then it means that it's running twice for whatever reason
how do I delete it if it's not already
try if (!msg.deleted) msg.delete();
you should probably try to find what caused it though
okay
nah same thing

oh
the problem is that I am setting an timeout to it
but if a condition happens i want it to delete it
@pale vessel
where is the timeout
Hi, is there a way I can get the total number of default emojis in Discord ?
and if possible, the png files (like https://discord.com/assets/19fc9fc6001951c7370b1fd74e1570f1.svg but .png)
or the Twemoji version Discord uses
Object.keys(client.emojis).length
help
maybe make a bot that's in no guilds and then get the number
client.emojis is the list of (guild) emojis a bot has access to
the default ones are not in that list :/
why do you even want to get total number of default emojis in discord?
do u want the number or u want to use it

maybe a pagination list
I made a bot that does this:
and I'd like the png files
and be sure I have all of them
that is sick
thanks
the thing is, i'm not sure if I miss some
and I just got an update on Discord PTB that added new emojis 🥲 🪧 🤌 ... etc.
is your bot public?
ok
dont paste an invite link
it gets you in trouble
@wispy crane That is a cool bot.
Lots of props to you, it had to be difficult to make.
I'll just check Twemoji and try to check manually if I miss emojis
It's not that difficult honestly, but thanks ^^ it finds the emojis with the closest color to each pixel in an image
https://static.emzi0767.com/misc/discordEmojiMap.json contains all twemojis that are implemented in discord
Still, wonderful job.
Thank you @earnest phoenix
@earnest phoenix Can I ask a question?
yeah of course
Is there a way to create a reload command that searches through all directories? Or is it meant for only one directory?
./commands/folder/command.js
how do i store sessions?
https://hasteb.in/efulesuy.js
I am stuck on why I am getting (node:682) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message error
msg.delete() is causing it. If I change msg to message it works.
error or no error the stuff still works
node i'm assuming, yeah very possible
@stable nimbus delete require[require.resolve()]; or something for reloading cmds
Dirent objects allow you this behaviour of looping through directories
give me a sec
I know how to create a basic reloader, I have one, but I need to loop through the rest to search for the one I call for.
delete require[require.resolve("./commands/thisfile.js")];
require("./commands/thisfile.js");
reloading
well then
Read what I am typing
loop all folders
Yeah I don't know how to do that. Its why I am asking for help.
using fs um wait
how can i make my page look better (it isnt that small i just made it small so u can see the all this) im not so good with html and all that
fs is file sorter, if anything I am sure its meant for the handler that causes cooldowns.
fs.readdir("./folder/", (err, files) => {
if (err) console.info(err, "error");
});
something like this
and use files.forEach()
Stop mate, you're not helping.
thats how you loop all folders
how can i make my page look better (it isnt that small i just made it small so u can see the all this) im not so good with html and all that
@violet mesa You can't control that on top.gg
ok
you need to make your own css though
use readdir(Sync) and enable withFileTypes in options
https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options
it will now return an array of Dirent objects
you can use Dirent#isDirectory to check if the file entry is a directory
https://nodejs.org/api/fs.html#fs_dirent_isdirectory
if it is, repeat the step again until there are no more files to loop through
how do i make dark mode with css if anyone can help
Body's background color.
how do i check if a messaeg is from a webhook in python?
So i kinda made my own javascript environment built in v8, designed to be used for embeddable scripting over the network
its extremely fast and safe for people to use, made in C++, vid below
how do i check if a messaeg is from a webhook in python?
@eternal osprey what have you tried
if message.author.id == 759169739746050069
webhooks dont have id's?
they do
they do
oH they do
would this work tho?
every single entity is a snowflake
sure, if you want to check for a specific webhook
oh yea now that i think of it
owh yeah, thanks!
throw an error if args[1] is not equal to a value in the json file. how can I do it?
what
{
"name":"Hello"
}
/test hello = return yes.
/test hi = return false.
If the value I entered is not equal to any value in the json file, it will give an error.
{
"aatrox": "266",
"ahri": "103",
"akali": "84"
}
If I write yasuo it will give an error. If I write akali it will return true.
sorry for so much questions and interapting everyones stuff but how do i do css in the top.gg thing
if(args[1] !== config.thing.type){
}
You'll need to call for the json file as a config or whaterver, the thing is what its listed under in your json file, and type is the specific thing in that list.
but the json file is in my folder
const donusturme = require("../../JSON/sampiyon_adi_id_donusturme.json")
args[1] !== donusturme.type
if i think i did something wrong
You called it right, so now you need to call for a specific thing.
if(args[1] !== donusturme.aatrox) {
}
You have to name every single one of them.
what you gave as an example and what you gave what you have right now are two different things
wow
Or is there a way to check all of the data in a json folder?
while this checks for object value
this checks for object key
luckily for you js is retarded and objects are just fancy dictionaries and you can access object keys at runtime with no issue at all
using Object.keys
Okay nevermind.
I am just stupid
can relate
Haha
const Discord = require("discord.js");
module.exports.config = {
name: "help",
aliases: ["h"]
}
module.exports.run = async (client, message, args) => {
How can I create a kick command bc I got stuck here again?
@misty sigil
do you know basic js?
then you'd know the code just goes in the async function
so how am I supposed to find the right one?
what?
what?
@misty sigil but how am I supposed to slap the kick code in there
I did and I got an err
cuz discord wasnt defined
wdym
just put const Discord = require("discord.js") at the top of the fucking file
we went over this
like 4 hours ago

like 4 hours ago
@misty sigil I did that
Whoa there, clearly they have that line though
wait
but the moderation commands doesnt worj
they just want to be spoonfed how to create a kick command.
brb
they just want to be spoonfed how to create a kick command.
@umbral zealot stfu I wanna know what function / async
is
what do you mean
@umbral zealot nothing
what
I'm very confused as to what your actual question is
@autumn aspen do you mean the function of the async keyword?
Because async just tells the interpreter that the command should run asynchronously (in the background) while other tasks get finished
@autumn aspen do you mean the function of the async keyword?
@eternal sandal idk ask stan lol
we're all thoroughly confused at this point. Let's give him a minute to formulate his request.
yes but he told me to look up for the right function
Have you tried fetching the user object and running user.kick() or whatever the actual name of the function is
users can't be kicked
@eternal sandal its member.kick() actually
members can
users are user objects (e.g. tag, avatar)
members are guild specific
with roles and the punishment methods
yes but he told me to look up for the right function
@autumn aspen he told you to "look up the function", which means "search for it in the documentation of discord.js"
Code:
const Discord = require("discord.js");
module.exports.config = {
name: "kick",
aliases: []
}
module.exports.run = async (client, message, args) => {
if(!msg.member.hasPermission('KICK_MEMBERS')) return msg.channel.send(":x: **You don't have permission to kick members!** :x:");
if (message.mentions.users.first() === message.author) return msg.channel.send(":x: **You can't kick yourself!** :x:");
if (message.mentions.users.first().id === '731927983274721301') return msg.channel.send(":x: **You can't kick me!** :x:");
let toKick = msg.mentions.members.first();
let reason = args.slice(1).join(" ");
if(!args[0]) return msg.channel.send('Please mention someone to kick.');
if(!toKick) return msg.channel.send(`${args[0]} is not a member!`);
if(!reason) return msg.channel.send('Specify a reason.');
if(!toKick.kickable){
return msg.channel.send(':x: **I cannot kick someone that is mod/admin or is/have higher role then me/you!** :x:');
}
if(toKick.kickable){
let x = new Discord.MessageEmbed()
.setTitle('Kick')
.addField('Member Kicked', toKick)
.addField('Kicked by', msg.author)
.addField('Reason', reason)
.addField('Date', msg.createdAt)
.setColor(0xa54bff);
msg.channel.send(x);
toKick.kick();
}
}
Error:
(node:3780) UnhandledPromiseRejectionWarning: ReferenceError: msg is not defined
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\kick.js:9:5)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:3780) 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:3780) [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.
Help
boom
i want to check if a variable is a object but i also want to check if it is in this format {}
with roles and the punishment methods
@misty sigil I much prefer manually swinging the banhammer. Physically
there is the pb
same
@autumn aspen "msg" is not defined

change msg to message
its message
read the error
Liking you more and more
please
lol
i want to check if a variable is a object but i also want to check if it is in this format {}. how is this possible?
not a place for (dead) memes but ok
lol
its dead because he died
ikr
maybe if (JSON.stringify(obj)) == "{}")
that wont work
i want to check if a variable is a object but i also want to check if it is in this format
{}. how is this possible?
@shy turret in JavaScript, every object is in the format of {}
its dead because he died
@misty sigil no..just.no
can you explain it further
@eternal sandal no, objects can also be in this format []
that's not an object that's an array.
aka arrays
That's an array
arrays are objects
yes but if i use typeof varname == "object" and the varname is an array...
that's irrelevant. In javascript, everything is an object. It's an object-oriented language.
oh you mean that?
But {} is an object object. [] is an array
and every object is a dictionary
Oh, you mean you want to know if something is an array or an object of key-value pairs?
[] using typeof is also an object
use if (typeof obj == "object" && !Array.isArray(obj))
I thought you meant check an empty object
lol
clarity please
how do i change the color of the box?
feel like an idiot now
lol
background-color:
You could also check for the return value of Object.keys(obj)
that would show the elements inside the array
again, arrays are objects
sorry, not elements, indexes
elements would be Object.values(array)
background-color:
@shy turret i need to choose the box thingy tho
I am also making a bot dashboard but if I do something like this, it won't give an error in the console:
xhr.send(JSON.stringify({}));
but this will:
xhr.send("not a {} or []");
SyntaxError: Unexpected token FIRSTCHARACTEROFTHEBODY in JSON at position 0
in some expressjs file
looks like it only accepts json, not sure
by the way, check for null for your other thing, null is also an object
make it support non json or just send {"error":"error here"}
not familiar with xhr so i can't help
xhr.send(what becomes req.body)
then something is trying to parse it as json
https://discordapp.com/channels/264445053596991498/272764566411149314/759179682456928298
please can anyone help
probably something in your dashboard template, dunno
i cant tell if it is my code or expressjs now because ive done some debugging xD
oh frick
wait nvm
def expressjs
wtf is body-parser, idk if it will fix the prob
i dont use body-parser
bilgili türk varmı
then how do i prevent the error
@shy turret bro where are you from
@snow crescent buyur kanka
@livid otter kanka transfermarkt diye bi site var bildin mi
duymadım ne işe yarıyo
learn html and css
;-;
duymadım ne işe yarıyo
@livid otter futbol ile ilgili transfer olan oyuncuları söylüyor
@snow crescent i dont need to tell you 🙂
api ile veri çekmek mi istiyosun
i just need one thing and im leaving html and css
set background-color to whatever
XD
api ile veri çekmek mi istiyosun
@livid otter denilebilir transfer olan oyuncuyu bot ile bize anlık olarak atmasını istiyorum
api dökümanları varsa okuyarak yapabilirsin büyük ihtimal tarifi de vardır orda
ama api desteklemiyolarsa başka site denemen lazım
the background is this tho
so if i change that it will change that
api dökümanları varsa okuyarak yapabilirsin büyük ihtimal tarifi de vardır orda
@livid otter dökümanlar nerede yazar
çok bilgim yok denilebilir
siteyi bilmediğim için yorum yapamiyorum ama genelde footerda api ya da developers linkleri olur
rica ederim
@grizzled raven
english only here
why
@sonic lodge can u help me
change background-color
guys
aside from json, whats the best db?
database
then only apply it to the box
css selectors
.example-class {
background-color: red;
}
#example-id {
color: red;
}
/* change divs with class "example-class" */
div.example-class {
background-color: red;
}```
ok
find the class that contains the box and style it
for pre in prf:
prefix = pre["prefix"]
if prefix == None:
prefix == '.'
else:```py
saying prefix referenced b4 assingment
the program reaches prefix == None without finding a prefix in the guild
?
prf = collection.find(guild_id2)
for pre in prf:
prefix = pre["prefix"] # <-- this line is NOT reached, causing "prefix" to not exist```
just add prefix = None above all of that or something
.example-class {
background-color: red;
}
#example-id {
color: red;
}
/* change divs with class "example-class" */
div.example-class {
background-color: red;
}```
@sonic lodge where do i put that?
div.longdescription {
background-color: red;
}
in the <style> tags?
is this good
ok
<style>
div.longdescription {
background-color: red;
}
</style>
```this doesnt work
oh
never mine
ty
works!!! ❤️
Siruse
Serious*
No
I cant read the description
just color works on the div iirc
Hi im on discord making a bot currently it uses node v12 i need v14 i host my bot on heroku through github and i need to update node to v14 which im having trouble with yes I tried npm i n -g and all that so if anyone can help please do
😭
if (message.content === `<@${client.user.id}>`) {
message.reply('Prefix: - ')
}```
im used this command ind bot.js but tagged in phone not working
or sometime pc
sometimes mentions come as <@!XXXXX>
with an extra !
because discord is weird like that
it means the user has a nickname in the server iirc
so you have to check if content equals <@XXX> and also if content equals <@!XXX>
@sonic lodge it used to be like that, but then apparently they changed it, and idk how it is now lol
wat
@quartz kindle Is set to if contains instead of equals?
how big can what be
did the process crash?
the cache just disappeared?
yeah lmao
that makes no sense lol
ikr!
how are you measuring that cache?
erm, lemme pull it rq
the problem is, even the ram went down
ram is process.memoryUsage
it also went down to 281
rss or heapused?
@bot.command()
async def dep(ctx, arg: int):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.message.author
if users[str(user.id)]["wallet"] >= arg:
users[str(user.id)]["wallet"] -= arg
users[str(user.id)]["bank"] += arg
await ctx.send("succesfully transfered the cash")
elif users[str(user.id)]["wallet"] < arg:
await ctx.send("you dont have enough for that")
why dis no work
rss can disappear if its memory is swapped by the system, but the data shouldnt be gone like that
can you access client.channel_cache?
lemme try
hoe does grafanae worke?
It works with numbers and a bit of magic math
what the heck?
how am i still getting metrics?
im so confused
not even evaling 1+1 to console is showing up
but im still getting metrics
and events recieved
wot??
OOOOH
im stupid
ignore me
@bot.command()
async def dep(ctx, arg: int):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.message.author
if users[str(user.id)]["wallet"] >= arg:
users[str(user.id)]["wallet"] -= arg
users[str(user.id)]["bank"] += arg
await ctx.send("succesfully transfered the cash")
elif users[str(user.id)]["wallet"] < arg:
await ctx.send("you dont have enough for that")
```why no work??????
@opal plank idk howw to help sorry
F
something somewhere did client.channel_cache = undefined?
lmao
noob
your bot dying
donut you didnt ask a question
im unsure how this can just stop working after a couple hours
k
if oyu drop your car off at the shop and say "its broken" they arent gonna konw what to do
the code doesnt work its discord.py
no errors
just doesnt work
can you help me fix?
no cuz you havent asked a question
if you want someone to help you need to provide the problem, the expected output, the current output, what youve tried and any relevant code
but im asking for help cause idk whats wrong
well no one else knows either
türk varmııı
english only here
how can i turn secs into mins?
or like if its less than a min
it says it in secs?
divide by 60?
if its bigger than 60, divide by 60 and say minutes
if its smaller than 60, say seconds
isn't really coding 😛 you should've been taught this in math/physics
Hello! I just started an open source project!
its a trading card based rpg
I'm using discord.js
Is it necessary to use a foreach loop to get the user's listening activity and the name listening activity?
no?
How would I make the bot's status be how many users they are watching?
I've tried client.users.size but it doesn't work
This is discord.js
user.presence.activities.forEach((activity) => {
if (activity.type === 'LISTENING' && activity.name === 'Spotify') {
message.channel.send(activity.details)
}
})
How can I send a message if there is no spotify listening activity?
How would I make the bot's status be how many users they are watching?
I've tried client.users.size but it doesn't workThis is discord.js
@errant hornet What is your version of discord.js
client.users.cache.size
np
Now how would you make it change status after few seconds?
var activities = [ `hello world!`, `hello dbl!` ], i = 0;
setInterval(() => bot.user.setActivity(`${activities[i++ % activities.length]}`, { type: "PLAYING" }),5000)
Thanks again
note that the above method has a hard limit in the amount of status changes you can have
the limit is 9007199254740991
:^)
teach me your power in calculating that
Number.MAX_SAFE_INTEGER
just get the stuff you need instead
hey
TypeError: this.client.player.searchTracks is not a function
at Play.run (C:\Users\matte\Downloads\VirtualBot2.01-master\commands\Music\play.js:44:43)
at module.exports.run (C:\Users\matte\Downloads\VirtualBot2.01-master\events\message.js:236:8)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
this is happening
if anybody wants to help dm me
pls dm me i really need help
@earnest phoenix are you sharding?
ok so I have a small website for my bot and it's help command. But when I click on a button to go to another page of the site the search bar adds the file type extension...is there a way around this? It's in html and css
nvm got it
@earnest phoenix be patient 
just like me i assume a bunch of people saw the issue, we just dont know what it may be
and im getting kinda fustrated
because the music has never worked for me
im sorry
did u look at the file to see whats on it?
what the play.js?
/Downloads, i doubt it lmao
@earnest phoenix That's not a function
._.
thing
called
github
🤦
Theres high chance that the package deprecated some stuff
remember like 3 days ago
Player does not contain the function searchtracks
You defined it wrong.
did you init it?
i mean, you prob did
otherwise the thing would've error'd on declaration
though....
Javascript

high chance it might be undefined cuz you forgot to install dependencies
how about you post it on https://paste.awoo.rocks/ like everyone else?
its hastebin
const tracks = await this.client.player.searchTracks(args.join(" "), true).catch(() => {});
is only reference of such
Are you using it incorrectly?
lemme look
const tracks = await this.client.player.searchTracks(args.join(" "), true).catch(() => {});
if(!tracks || !tracks[0]){
return message.error("music/play:NO_RESULT");
} else if(tracks[0].fromPlaylist){
trackToPlay = args.join(" ");
isPlaylist = true;
} else if(args.join(" ").match(/(?:youtube.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu.be/)([^"&?/\s]{11})/)){
trackToPlay = tracks[0];
} else {
try {
if(tracks.length > 10) tracks.splice(10);
let i = 0;
const embed = new Discord.MessageEmbed()
.setDescription(tracks.map((t) => **${++i} -** ${t.name}).join("\n"))
.setFooter(message.translate("music/play:RESULTS_FOOTER"))
.setColor(data.config.embed.color);
message.channel.send(embed);
await message.channel.awaitMessages((m) => m.content > 0 && m.content <= 10, { max: 1, time: 20000, errors: ["time"] }).then(async (answers) => {
const index = parseInt(answers.first().content, 10);
trackToPlay = tracks[index-1];
}).catch((e) => {
console.log(e);
return message.error("music/play:TIMES_UP");
});
} catch(e){
console.log(e);
return message.error("music/play:NO_RESULT");
}
}
;-;
Super is fine in JS
I'm sure, just haven't seen it yet
guess git clone doesn't "just werk" rip
i dont see why even bother extending it
You got a bit of this backwards. 😐
and not map it
There may be reasons, and maping is inefficient unless it's a must.
it has a package that does some of it
To search through a list, you be best with a for iteration unless of course mapping is must.
its discord-player
effecacy
its already exporting the whole thing and using it with async run()
might as well call the whole thing with a export
Did you make the bot?
"discord-player": "^2.3.1",
😛
Might be that
yeah figured as such
I'm a Google Wizard 🪄
ok im scared
?
would you look at that
Also
its the same
lol
oh
i said my flashdrive broke
i had it on there and had to get it back
yeah good luck with that mate
i just want a cool bot
not interested in that bs
Make one
you copied it
git clone != making a bot
you didnt make anything
I sued someone recently for copyright theft.
yeah i did
lol
I sued someone recently for copyright theft.
@unique patio but did you win?
Yeah
no this is open and everyone copys it
100%
wow fr?
DCMA rights take-down
open repo doesnt mean you can use it
yeah
Check this
check the DCMA
Noice
no everyone uses it
My bot gone nuts but I've fixed it
its called atlanta bot
TY Github btw lol
Hard-work should be respected
Love helping people but scrubs no ty
niiice
😄
i should've done the same tbh back when one of my repos got taken
i just private'd it afterwards
Yeah depending on how you set up licensing
Git protects you
and will remove content, I have many places my originals resume holdings
So in case of such I can have on date/file all my works
I use GNU license
and its attached license
You're better off using none.
🙂
Just put Copyright @ Auger
i use MIT lul
Not understanding licenses will get your stuff stolen
with loop-holes and defaulting to no copyright
atleast in USA
puts you as the holder
Well it's open but GNU states you have to credit me
the stuff i actually care about is all in private repos anyway
Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors pro...
Good to read through the different licenses
if a leak happens, well
many exist
Big leaks happen all the time, even worse when someone sells your code to other companies to sell off
thank god the lib i need the most is gpl v2 and not agpl
Who's to be pinched?
this way i can make an api with it without licencing






