#development
1 messages · Page 1406 of 1
type=discord.ActivityType.watching)
await client.change_presence(activity=activity)
loop_function.start()
is dat it??
@slender thistle would u like to be introduced to the most complicated easily fixable vision wise error you've ever maybe almost seen?
make my bot say how manu guilds its in and switch to 》Playing Prefix -《
Surprise me
Many*&"
alr sec
Then keep going
So you want to switch between two statuses of different types
from discord.ext import tasks # Function automatically called every 5 minutes @tasks.loop(minutes=5) async def loop_function(): # Set the activity as "Watching" + the amount of guilds, and users the bot is watching over. activity = discord.Activity(name=f"over {len(bot.guilds)} guilds\nand {len(bot.users)} users!", type=discord.ActivityType.watching) await bot.change_presence(activity=activity) # Start the loop loop_function.start()
Like dat
Codeblocks 😩
Man
Reading that is making me feel illiterate
from discord.ext import tasks
# Function automatically called every 5 minutes
@tasks.loop(minutes=5)
async def loop_function():
# Set the activity as "Watching" + the amount of guilds, and users the bot is watching over.
activity = discord.Activity(name=f"over {len(bot.guilds)} guilds\nand {len(bot.users)} users!", type=discord.ActivityType.watching)
await bot.change_presence(activity=activity)
# Start the loop
loop_function.start()
Oh hey
this is right
so... how do I use it
Do people not know docs, stack overflow, and Google exist
Here if any 1 wants if its correct and if u need it
import os for filename in os.listdir("./cogs"): if filename.endswith(".py"): bot.load_extension(f"cogs.{filename[:-3]}") print(f"Loaded {filename}")
loop_function?
@slender thistle yes
What do you use for copying these
import os
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
print(f"Loaded {filename}")
yes
Code examples of discord.py rewrite. GitHub Gist: instantly share code, notes, and snippets.
heree
Command raised an exception: NameError: name 'cashIcon' is not defined
advantage of webhooks over messages ?
Any 1 have any embed code for discord.py??
That i can use xdd
we dont spoonfeed code
stop begging dude i alr sent u the direct docs for embed
yup u can see that
i sent 3 imgs
did u see them>
?
well no, I don't see a proper scope understanding
just because you defined it in getCash doesn't mean it will exist in the command where you use it
@bot.event # on_message takes a message argument async def on_message(message): # Prevent endless loop if message.author.id == bot.user.id: return # If the message is not in a guild if not message.guild: # Define the log channel with guild ID and channel ID logchannel = bot.get_guild(GUILDIDGOESHERE).get_channel(CHANNELIDGOESHERE) # Send a message as embed in that log channel embed = discord.Embed(title="Modmail", colour=0x000, description=f"**From:** {message.author.mention}\n\n*{message.content}*", timestamp=datetime.utcnow()) embed.set_footer(text=message.author, icon_url=message.author.avatar_url) await logchannel.send(embed=embed) # Process commands await bot.process_commands
unless you actually return it
oh god
Holy shit
Because it errored out on cashIcon, which came first
advantage of webhooks over messages ?
and the interpreter gave up after that
@bot.event
# on_message takes a message argument
async def on_message(message):
# Prevent endless loop
if message.author.id == bot.user.id:
return
# If the message is not in a guild
if not message.guild:
# Define the log channel with guild ID and channel ID
logchannel = bot.get_guild(GUILDIDGOESHERE).get_channel(CHANNELIDGOESHERE)
# Send a message as embed in that log channel
embed = discord.Embed(title="Modmail", colour=0x000, description=f"**From:** {message.author.mention}\n\n*{message.content}*", timestamp=datetime.utcnow())
embed.set_footer(text=message.author, icon_url=message.author.avatar_url)
await logchannel.send(embed=embed)
# Process commands
await bot.process_commands```
idk
Any 1 here have any
discord.py
embed code
I can use plss xdd
Read the fucking docs
what docs??
srry im new to dis xddd
You will never learn by copy pasting
Can we delete Lucas' channel
whated his 3 years old outdated series
or whatever else
then watched some other serieses
now hes copy pasting codes
trying to make a bot
I don't see people refer to him often here but holy Jesus does it become a clusterfuck when they do
which he hasn't even imported discord yet
Bruh
😆
Smh
@weary torrent do you have a line in ur code where it says
import discord
from discord.exe import commands
?
"frustratingly & passionately fun"
what library have u developed?
dblpy
yeah i've used that to make my bot show how many guilds its in
in the top.gg website
right isn't that what u use it for?
@weary torrent do you have a line in ur code where it says
import discord from discord.exe import commands?
@wise quartz Yess
have you pip installed discord?
Have you installed discord.py
i bet he pip installed "import discord.py"
what is it about?
Moderation
I have a problem
I don't know how to turn on the bot
But I code it
host it
How did you make it without even testing it?
😐
Idk
i was bout to ask that
can u send code?
What library
YEs
all except token
I made it with visual studio code
if u even have one
yas
Vs code is an ide not a library
dont sweat on him man he made an ENTIRE moderation bot without testing it....
Brrrr
i mean who needs testing
const BaseCommand = require('../../utils/structures/BaseCommand');
const Discord = require('discord.js');
module.exports = class KickCommand extends BaseCommand {
constructor() {
super('Kick', 'Moderation', []);
}
async run(client, message, args) {
if (!message.member.hasPermissions("KICK_MEMBER")) return.channel.send("Nu poti folosi aceasta comanda.")
const mentionedMember = message.mentions.members.first();
let reason = args.slice(1).join(" ");
if (!reason) = "Niciun motiv dat";
const kickEmbed = new Discord.MessageEmbed()
.setTitle(Ai fost dat afara din ${message.guild.name})
.setDescription(Motiv: ${reason})
.setColor("#5708ab")
.setTimestamp()
.setFooter(client.user.tag, client.user.displayAvatarURL());
// !kick @user dm ads
if (!args[0]) return message.channel.send("Trebuie sa alegi pe cine vrei sa dai afara. `!kick @user motiv`");
if (!mentionedMember) return message.channel.send("Utilizatorul mentionat nu exista pe server.");
try {
await mentionedMember.send(kickEmbed);
} catch (err) {
console.log(Nu am putut trimite mesaj utilizatorul.);
}
try {
await mentionedMember.kick(reason)
} catch (err) {
console.log(err);
return message.channel.send("Nu am putut exclude utilizatorul mentionat.")
}
Ah discord js
10/10 code blocks
Very epic
i bet 100000000Jeff bitchinzoz dollars he copy pasted it from somewhere
I am 13yrs
@earnest phoenix what does your main file (index.js or app.js) look like
Wtf
index.js
home many files do u have
what does it look like
He used discord js unicode
you mean test it?
I want to learn
Ok so, you only have 1 file for your bot, it being that code?
pay me 50$ i'll make you a fully functional multi-purpose bot in an hour@earnest phoenix
lmao
i'll even host it
for extra 20
deal?
Bruh
learn you some codes?
Then go look up how to use js before copy pasting code that uses module exports, which means you need a command handler for that to work
use this to show your code better
sometimes it's tricky
can you modify the scroll bar in overflow CSS property?
to understand what ur saying
^^
```<code language>
code
```
he needs some milk
agree
example: js
```js
console.log("hi");
```
this becomes:
console.log("hi");
learn markdown bois
what bot do you have?
@earnest phoenix so the code there uses module exports, which to bluntly simplify allows you to split your code into numerous files
print("hi")
yes
python is easier
python is hell
so is every other programming language on earth
whatever you can imagine
So you need to get the bot at least online first, look at the docs for discord js on how to do that
Python cringe
lmao yes
python is hell
js is hell
everything is hell
HAIL BRAINFUCK
Nice
we doin something better here
script? python ain't a scripting language
Me bouta spend 4 hours making a hello world using assembly
dude python is like the king of all languages
code
@earnest phoenix wdym
anyone?
learn him some code guys
yes you can
or better use JSFuck
it is a multi-purpose lang and supports functional and OOP programming
give me a minute
Me bouta make a discord bot in basic 😎
though I'm not really sure what effect this has on other browsers, it seems to work on firefox (in sense of disabling the scroll bar and still being able to scroll
Not spoonfeeding, this took me hours to figure out
html {
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox */
}
html::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}
@earnest phoenix this disables the scrollbar, but you are still able to scroll
if that's what you're referring to
well ok...
@earnest phoenix what library
discord.js
@rustic nova 
i love this emote
Ok, so do you just want a command that returns a link or that checks if a user voted


use dbls api
send an image, react to it with 2 reactions and get the reactions after 10 or so minutes

i want a command ex. se!vote, and a vote will be submitted for my bot
no one help me
😦
@earnest phoenix what do u wanna learn
you aren't asking for help you just want us to give you free code
f ing or some
because you're asking something that should be known already when here, try heading over to #502193464054644737 and reading "how to make a bot"
ok
forget it
You can't have users just type a command and have them voted, they need to go to your bot page, then click the vote button themselves

why not
How can i set a webhook when someone vote in website, it alert me?
there is a way to do that without users having to visit a page but it's really terrible and invasion of user privacy
its basically hacking/stealing info
no not that
0auth go brrrrr
the guy who replies to this is gay
Epic
definitely not allowed lmao
thats stealing info
Yeah prob against both discord and topgg tos
in my embed field i want to keep a value with a formatting but because i use
` to start my embed field im not able to get that format can someone help?
@junior wharf u gay
```.addField(**Top 10 Richest Users in Jet's Dream World**, 1) ${winner1} - ${winner1msg}`
@ivory seal use a \

oh you want to insert a ` character inside a template string amirite?
Backslashes are basically like "treat the next character as a character"
also use map
nope
to do that you just type a \ then <whatever character you used to create the string but want it inserted inside the string as well>
Lol
Specifically,
for character in text:
if character == ' ':
new_text += ' '
continue
i = random.randint(0, 1)
if i:
new_text += character.upper()
else:
new_text += character.lower()
Its like the if statements I used to write
What, if True:? 
I did that once lol
you were smoking onions
kekw
lmfao
I still have that code somewhere
im confused
any example ?
uhh 0.0.0.0 is not supposed to be a real IP
it basically means literally any IP
(you might have seen it before on mongodb atlas's security stuff)
i wanna post on every vote
that webhook is not workin'
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
They have that in their code 😩
i know this
am now normal gapple
Isn't that what you want?
at first i must configure webhook, i don't know how
Are you logging into the dbl api with your bots token
no
@earnest phoenix also please for god's sake NEVER REVEAL YOUR IP IN A SCREENSHOT
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
Is yourDBLTokenHere defined
yes, my server counter is updating...
Ok
Well, your code should work then
Open the edit menu for your bot, at the bottom it allows you to do a test vote
Click that button while your bot is running
Does it work?
i didn't fill these
Well, that'll do it
bot dev
Read the docs
ask mods
Tbh I've only done that once, and I removed it soon after so I don't 100% remember everything
But ye, read the docs
Anyone here have any.
8ball commands but embed??
for a discord bot??
mmm, i read docs, im confused, i'll glad someone post a full example code for webhooks(voting, setup webhooks)
No one will give you any ready-to-use code @weary torrent
Asking for code to copy paste doesn't teach you anything
Its the lazy way out
ye doesn't work
.addField(`**Top 10 Richest Users in Jet's Dream World**`, `1) \<``${winner1}``> returns TypeError: "1) <" is not a function
Learn how to make code so you don't have to ask
You're not willing to learn to make things yourself, are you? An 8ball command is literally just choosing between multiple responses.
true
just take a array chose a random value in that array and thats 8ball
atleast thats how i do it
bruh
IM LOOKING FOR 8BALL CLMMAND BUT WITH HENTAI AND ITS EMBED xdd
Nit just an 8ball command no xdd their easyy aff
i meant this:
`this is a template string's normal text. This is a backtick inside a template string --> \`.`;
you 👏 make 👏 stuff 👏 yourselves
@weary torrent look at the docs for how to make an embed, I've said this 5 times
still gives errors
with what?
I even sent a link
what are you smoking there?
Everything
send code
im just trying few things give me a sec
.addField(`**Top 10 Richest Users in Jet's Dream World**`, `\`.``)
if i just do this for testing , makes the next three lines as a string
was it fs.createWriteStream or fs.makeWriteStream?
Because you escape one of the ` \
wdym
this guy understood nothing i sent
` Text \` ``
One of the ` is escaped so it becomes part of the string, you are left with 1 ` that does not get closed
fuck markdown try putting a slash before the backtick to tell markdown not to make it a code block
What are those called anyway
backtick
backticks?
` is called a backtick
ok i got it
.addField(`**Top 10 Richest Users in Jet's Dream World**`, `\`${winner1}\``)
i did somethikng like this
the winner1 will now be in a code block
congrats
you just learnt escaping characters
ty

i learn tons of new things from this server lol
i only stay here for #development lol
BRO I JUST REALIZE THERE IS NO <html> TAG IN MY WEBPAGE
HOW DOES ONE FORGET SMTH LIKE THAT
Congrats!
yo I need help with making a website for my bot dm me im willing to give credits and pay
anyyonnnnee?????????
Did the event even trigger
good job

nope
dateObj = new Date(time3 * 1000);
hours = dateObj.getUTCHours();
// Get minutes part from the timestamp
minutes = dateObj.getUTCMinutes();
// Get seconds part from the timestamp
seconds = dateObj.getUTCSeconds();
formattedTime = hours.toString().padStart(2, '0') + ':' +
minutes.toString().padStart(2, '0') + ':' +
seconds.toString().padStart(2, '0');
console.log(formattedTime)
``` time2 and time 1 are unixtimestamps which are recorded when a user joins/leaves a vc but when i stay in vc for like 10 secs it conosles something like `21 : 29: 08`
i haven't been in a vc for 21 hrs lol
new Date(time3 * 1000); unix timestamps are already milliseconds
no need to do * 1000
that could be the issue
@ivory seal
yes
just use new Date()
ye but wait
applicationsDB.deleteOne({ _id: application._id }); - Node.js, Mongoose.
Why this just doesn't work? There are clearly applications with the defined ID in the database and the applicationsDB is the valid schema.
I tried deleting in mongo shell with the same method, didn't work.
However, in shell, deleteOne({ _id: 'ObjectId("some id")' }); worked.
What is that ObjectId thing even?
someone here experienced with ML.net?
@stoic girder the id is a unique ID generated by MongoDB when you insert data into the DB. if you want to have a predicted way to get stuff make your own ID (i like using Guild IDs or UserIDs) that you can easy get
I know the ID in my function, I just want to delete the record by it
did you tryed findoneanddelete?
it can
its possible that your application._id is undefined bcs the code is still processing it
my freakin filezilla is broken
i've been saving the file for past 5 minutes
and it didnt upload it to my server
small tip: use winscp 
where scratching my head why tf the code run the same stuff over and over even tho i updated the code
if something would make me switch from filezilla it would be a ftp client with dark mode
write your own
lol
wai what
it uses windows Default colors
yeah and dumb filezilla doesnt for some reason
well its not a forced thing
if you set all windows app to dark mode 3rd party apps that support it also work
ah devs just dont wanna support it
i checked forums already
applicationsDB.deleteOne({ _id: ObjectID(application._id) })
doesnt work even like this
my brain died
@stoic girder does application._id alone work?
yeah
console.log of delete function has this _conditions: { _id: 5fbe25679e7da80abc657889 }
also did you make sure that application._id is valid?
findOneAndDelete({ _id: application._id }) does this work?
{ "_id" : ObjectId("5fbe25679e7da80abc657889"), "status" : 0, "user" : "616713407537610819", "guild" : "740784052696776767", "answers" : [ ], "date" : ISODate("2020-11-25T09:35:35.486Z"), "__v" : 0 }
here's the application object from mongo shell
it has that weird object id thingy
yea
nope
i mean i could make my own autoincrement id field
but its not really needed
{ "_id" : ObjectId("5fbe25679e7da80abc657889"), "status" : 0, "user" : "616713407537610819", "guild" : "740784052696776767", "answers" : [ ], "date" : ISODate("2020-11-25T09:35:35.486Z"), "__v" : 0 }
strange it should work tho
did some research and found a stackoverflow page that does exactly the same
is applicationsDB your model?
var mongoose = require('mongoose');
var id = mongoose.Types.ObjectId('4edd40c86762e0fb12000003');
maybe try this
ye
it should work. if you look into the answer on the Stackoverflow
has to be a string
typeof says object
@earnest phoenix would recommend reading the rules again
@stoic girder what exactly did you get if your console.log(application._id)?
5fbe27f7302b57594a5ac66a
as a string?
but typeof says object
also it is inside of brackets?
nope
console.log(application._id); - 5fbe2825b9bbd75db9f16868
i tried JSON.stringify and findOneAndDelete but didnt work
strange
so freakin weird
try findByIdAndRemove maybe it helps
just pass the application.id as option
findByIdAndRemove(application._id)
``` it should find it even when its a object
applicationsDB.deleteOne({ _id: mongoose.Types.ObjectId(JSON.stringify(application._id)) });
wtf?
tried this thing
idk what it is even
but doesnt work
lol
applicationsDB.findByIdAndRemove(application._id);
nope
what am i doing wrong
are you sure its the correct model?
im using the same model to insert and update the applications without problems
in same command
but if application process is cancelled i wanna delete the application row
ok got it
i just copied this from docs
applicationsDB.findByIdAndRemove(application._id, function (err, docs) {
if (err){
console.log(err)
}
else{
console.log("Removed User : ", docs);
}
});
and it worked
but without the callback
it didnt
w h a t
maybe my damn ftp betraying me again
or be like me and upload into your Production bot while restarting the Development instance all the time
np
applicationsDB.findByIdAndRemove(application._id); - doesn't work
applicationsDB.findByIdAndRemove(application._id, function(err, app) {}); - works
no errors for first one
i guess it requires that argument but doesnt throw an error when you dont supply it
const member = message.mentions.members.first() || message.member;
const user = await Levels.fetch(member.id, message.guild.id);
const neededXp = Levels.xpFor(parseInt(user.level) + 1);
if(!user) return message.channel.send("You don't have any messages in this server. Try sending some messages first, then try again!");
const rank = new canvacord.Rank()
.setAvatar(message.author.displayAvatarURL({ dynamic: false, format: 'png' }))
.setCurrentXP(member.xp)
.setRequiredXP(neededXp)
.setStatus(member.user.presence.status)
.setProgressBar('#216096', 'COLOR')
.setUsername(member.user.username)
.setDiscriminator(member.user.discriminator)
rank.build()
.then(data => {
const somerank = 'https://media.discordapp.net/attachments/735897160943534121/778864919092789259/PicsArt_11-19-02.11.02.jpg?width=1442&height=320';
const attachment = new Discord.MessageAttachment(somerank, 'rank.png')
message.channel.send(attachment)
});
}
catch(err){
const error = new Discord.MessageEmbed()
.setAuthor('Oh no!')
.setTitle('An Error has Occured!')
.setDescription(err)
.setFooter('This is a code error. DM my Dev to solve the problem! (<owner)')
.setTimestamp()
message.channel.send(error)
}```
It says me this
fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
what can i do?
i did that too, but this error don't show me
Can you show your script?
So I analyze the two of them
Because I really can’t understand the problem
i dont have script
i deleted the files because a error
i need to did it againg
sry
i dont think this is an error in your script, something is unable to load a front
which bot do you have?
also its an warning not an error
If someone want to do a reply comand here is help
@earnest phoenix wow O: can you maybe do also a ping command for us!
good idea 
thanks man
why are you kidding me?
dont hardcode your token
????
also im fairly certain you copied that code from somewhere
we are not, we actually want to see your work 
i somehow doubt that, but aight
Now i will do status command
good luck 
Thx
what?
first off
tsc isnt a thing
Typescript is
also javascript wont be supported in the future?
wtf u on about?:
discord js
where did you even read that?
Wouldn't it then be discord.ts 
source
also ts IS js if you arent aware
there isnt a "no support"
they are the same, just with interfaces and sprinkles
before you continue with the discord js guide
forget discord js and learn tsc
javascript wont be supported in the future(discord js), so I would start directly with the right language
then why say something as wrong as this?
learn tsc
that was a typo
by lying to him?
lie
also you comparing a library with a transpiling command from ts
thats not an official source
like i said dude, you dont seem to know what ts is
now i can't learn again ts
ts doesnt exist, it gets compiled into JS
no
you seem the one to be lost dude
congrats
TS is just JS but with a compiler and not supporting TS pretty much means not supporting JS
this
Or vice versa
that is what I am saying
no you arent
I don't speak Romanian
ok
i speak english and romanian
i am 13 yrs old
🙂
forget discord js and learn tsc
first this comparison. discord.js is a library, tsc is a transpiling command. You are comparing oranges to cars(not even apples)
javascript wont be supported in the future(discord js)
Im still waiting for an official source for this
You are probably Romanian and get taught English in School.
i live in romania
My point proven.
i learn english at school
🤦
I have showd you from where I got it from 🤷♂️ It is just a common thing people say in the offical discord js server, there is no official source on it yet, but I dont see the problem. All I was saying is, why not start directly with ts. That is all.
???
you should mvoe to general, this chat isnt development related anymore
then simply explain why, your example and approach to that were horrible
Because they work on something else(ts could be the future, maybe not) and I think it is a good idea to start with ts, when you are at the beginning. He obviously just started with the djs guide and I thought it would be an idea to tell him that he could also start learn ts and create a bot, instead of just using normal js^^
i also doubt they'd be moving their support to ts only
first: i contacted them a bit ago, they didnt want nor need interfaces for ts that i offered
second: the majority of the users that use d.js are, to put it bluntly, not very knowledgeable in js
third: its discord.js, its stupid to move from js after the whole community the brought up on js, if they were to move it'd be forcing all those users into learning ts
TS is just a tool for easier development
You're a tool
ily2
also the fact that they are updating their lib has no correlation with Ts whatsoever
why is v13 better TS wise when compared to v11 or v12?
It'll be written in TS
you may have had good intention but what you said made no sense
i doubt they'd be using TS to write v13 tbh
its a major change
if you want an actual TS lib, use detritus, while its good their docs are a bit lacking in my opinion
there are other actual TS libs out there too if you look for them
isnt TS just a fancier version of JS
hence another reason i doubt d.js would move to ts since they are already the main lib for js users
it is
but you gotta learn ts
تبي كرديت بي اسهل طريقه
but why do I see people using both JS and TS?
they have been using js this whole time and made a community around it, what would be the reason to port it all to ts?
تعال خاص ادخل /السيرفر بس
my English sucks, I really need to take some time to reread what I am writing
استلم الف٥٠ كرديت
Wait, discord.js-next isn't v13?
@opal plank لا بس اسولف
english
#general-int arb
nope

v12.1.2.00.2020.exe.working_september.no_cheat_engine.png
const member = message.mentions.members.first()
const embed = new Discord.MessageEmbed()
.setDescription(member.user.joinedAt)
gives out undefined.
@feral aspen then member isnt defined
I just defined it
I did !userinfo <user> and it doesnt say when his account was created at.
if there are no mentions it wont return anything
But I mentioned.
first() returns the first item the collection OR undefined
log it before sending the rest
also why u using member to get user?
use user right away
const member = message.mentions.members.first()
const embed = new Discord.MessageEmbed()
.setDescription("**・Joined At:** ${member.user.joinedAt}")
I do !userinfo <user> and it doesnt return, it returns undefined.
not that dude
try{
const member = message.mentions.members.first() || message.member;
const user = await Levels.fetch(member.id, message.guild.id);
const neededXp = Levels.xpFor(parseInt(user.level) + 1);
if(!user) return message.channel.send("You don't have any messages in this server. Try sending some messages first, then try again!");
const rank = new canvacord.Rank()
.setAvatar(message.author.displayAvatarURL({ dynamic: false, format: 'png' }))
.setCurrentXP(member.xp)
.setRequiredXP(neededXp)
.setStatus(member.user.presence.status)
.setProgressBar('#216096', 'COLOR')
.setUsername(member.user.username)
.setDiscriminator(member.user.discriminator)
rank.build()
.then(data => {
const somerank = 'https://media.discordapp.net/attachments/735897160943534121/778864919092789259/PicsArt_11-19-02.11.02.jpg?width=1442&height=320';
const attachment = new Discord.MessageAttachment(data, somerank)
message.channel.send(attachment)
});
}
catch(err){
const error = new Discord.MessageEmbed()
.setAuthor('Oh no!')
.setTitle('An Error has Occured!')
.setDescription(err)
.setFooter('This is a code error. DM my Dev to solve the problem! (<owner)')
.setTimestamp()
message.channel.send(error)
}```
i got this warning
fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
That is one long function for something so simple
const member = message.mentions.members.first()
console.log(member);
console.log(member.user.id)
const embed = new Discord.MessageEmbed()
.setDescription("**・Joined At:** ${member.user.joinedAt}")
@feral aspen use that at let me know your log
it logged a lot of stuff
it logged my id
But how can I do the member.user.joinedAt thing
oh im retarded
joinedAt isnt a member of user
its a member
remove .user
just member.joinedAt
you need to understand those are 2 different things
user is your user
member is you as being part of the guild
imagine your nickname for example
why inst your nickname the same in all guilds?
Cause 1 only..
each guild hold info about you, but its only part of the guild
user is your "account" info per se
user has a creation date
member has a joined date
user doesnt have a joined date since it isnt part of a guild
member doesnt have creation date because its part of a guild
np
Is there a .ultis module for Python? If so, how do I install it?
ultis?
Since it’s python if there is anything like that it will be a pip package. You can find them on https://pypi.org but I am not really sure what kind of module you are looking for? @hasty mulch
It was discord.ultis
Utils
Yeah
The exist, just not to the same extent.
My bot declined cause i mentioned nsfw command in dewcription 😒
Unfortunate

Isn’t the utils class part of discord.py?
yes

from discord import utils
^ LIPD read that
^
🤨
Ah, fuck this. It’s a fucking outdated cog
I was looking for a starboard cog, but it’s too outdated
Just create one instead?
I don’t know where to start as I have never worked with reactions before
you can look at R. Danny's source code for starboard lol
That’s the one I just gave up on
pretty simple, listen to on_raw_reaction_add where you specifically check for \⭐ , when the message contain 4 or more \⭐ , add it to the database along with the person who reacted on it using message.reactions and reaction.users
I just learned API and autoposts, both a challenge with getting it right
And me a cog listeners don’t seem to work well
by don't seem to work well, wdym by that
I tried getting an on_message listener working, and it just wouldn’t work, even with the intents
what's the code
Uhhhh, let me look back
import discord
from discord.ext import commands
import asyncio
bot = commands.Bot
class DMCog(commands.Cog, name="DM Webhook Set-up"):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
if message.content.startswith('nya!dm'):
await message.author.remove_roles(message.guild.get_role(767654541541244970), reason="DM Webhook created")
print('Role removed successfully!')
pass
def setup(bot):
bot.add_cog(DMCog(bot))
why are you using on_message to create command instead of using ext.commands?
The bot’s default prefix is r!
and then
I wanted it to listen to this command so the role automatically got removed after it was sent cause the role had webhook perms
and you can't use ext.commands why?
Is there any way to replace Enter with /n
I have strings that uses enter rather than /n
its kinda pain to do it manually
Shiv never suggested it to me, I guess for a reason
Hi
there's literally 0 reason to use on_message instead of using ext.commands, use @commands.command() to create a command in a cog
The commands are different
The bot I’m using has the prefix r! while the command I want to trigger the removal is nya!dm
pass a list into your command_prefix instead, it will make nya! as an alias
so you only want nya! as a prefix for a single command?
Correct
use a check where it checks for ctx.prefix, if it's nya!, return True, else, raise an error
could also use a global check where it allows only that command to have nya! as prefix
https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.check
So, run it as a regular command, with the ctx.prefix?
ctx.prefix won't be nya! unless you set it in the Bot object
which would apply it to the entire bot
Which I don’t want
Actually
which is why i suggest using a global check, where you just make nya! as an alias in your command_prefix, and allow only that command if the ctx.prefix happens to be nya!
also dont do this in your cog, bot = commands.Bot, you're only suppose to do this in your main file, your bot instance is already passed in __init__
That code hasn’t been touched in about a month, I say. I have been told this already
But, can we get back to the starboard thing? The original reason why I came here
yea just say the problem, i already told you the general idea, what's the issue
I don’t know how to bind ctx.send with a listener
ctx are command specific, not events, you would need to use get_channel
https://discordpy.readthedocs.io/en/latest/faq.html#how-do-i-send-a-message-to-a-specific-channel
quick question: are discord IDs fixed length?
🤩
hm thx
Yeah, I know that, I’m saying after I pull the listener and all that, how do I call on the results into a ctx.send?
I kinda solved my own problem cuz I'm a genious
message.channel.send(`\`\`\`${args.slice(0).join(" ").replace(/\n/g, '\\n')}\`\`\``)

yes, it is infact an irony
i've no idea what you're asking here, you want to just send the result into a channel?
just use get_channel what's wrong with that?
But what do I put in the parentheses?
the channel id
After I type send(
your message
I'm gonna make a troll bot based on Potatoes 
........
which library
Not you @sharp rock
which?
<member>.roles.add(<guild>.roles.cache.find(r => r.name === '<role name here>'))
@sharp rock
Spoonfeed go brrr
nice
thxxx
i share my kick code
hmm
wait
or..
example attachmen
const { Client, MessageAttachment } = require('discord.js');
// Create an instance of a Discord client
const client = new Client();
/**
* The ready event is vital, it means that only _after_ this will your bot start reacting to information
* received from Discord
*/
client.on('ready', () => {
console.log('I am ready!');
});
client.on('message', message => {
// If the message is '!rip'
if (message.content === '!rip') {
// Create the attachment using MessageAttachment
const attachment = new MessageAttachment('https://i.imgur.com/w3duR07.png');
// Send the attachment in the message channel
message.channel.send(attachment);
}
});
// Log our bot in using the token from https://discord.com/developers/applications
client.login('your token here');```
example
rip
how can i replace token with something else in eval command in discord.js
here's a better solution
don't give eval
to people you don't trust with eval
mindblowing, right?
not mindblowing
cause i already did that
your token can be extracted and altered in an infinite number of ways, there's no way you can detect all of it
@earnest phoenix but i think theres something like replace
yes
your token is a string though
insert a space into the token, boom the replace doesn't work anymore
this isnt working thats why i am asking let evaled; if(evald.includes(client.token)){ let string1 = evald; let string2 = client.token; let string3 = 'Njhsvsgsvfu____________hdbfhfb'; evaled = string1.replace(string2, string3); } else { evaled = evald; };
why are you trying to hide to token
(you can't hide it effectively)
cause everyone did that
...so?
They only hid the token string
And if you aren't dumb enough to play with your token publicly, you shouldn't need to worry about your token being leaked
if only people you trust have access to eval then your token isn't a problem
bad idea

i have one more problem
my bot is using too much ram what can i do ?
refactor your code to be less intensive
switch to using djs light / eris
@earnest phoenix how to refactor code ?
or how about locking your eval command to you only
@astral yoke did that
so why do you wanna attempt to hide the token
Try using T!eval in #commands
go through you code and see where there are derps and fix them
cause everyone was doing that
derp means
so then just get the argument and check if it contains token or not
that isn't effective because it's a string, it can be transformed
you don't need to worry about the token if eval is accessible to only you
@earnest phoenix if i add delay to commands would it use more ram ?
no
what kind of question was that lmao
what i was hinting at was, for example, creating two objects when you could be creating one
at a small scale you wouldn't think it makes a difference
but when your code is being executed thousands of times a minute, it builds up
i need some how someone that knows discord (.js), to make a bot with me
ok
tfw java
ok
cant you remve stuff from eval?
wdym
in rust you can like make lua evals
but wdym remove stuff
you want to make a public eval?
Ive seen it done
you need a custom js engine
using node is not safe
a barebones engine that has no built in modules
there are many ways to do that, Brain did it afaik
tim so smart why
you can also eval in another process
i guess you can try node's vm module
seems to do a good job at disabling all forms of I/O
Hi! I coded a command which locks every channel if the server is in raided condition to stop it from spamming, so when I type the lock ever channel command. It spams the same message lol. So I want it to only send one
**
make the cooldown 6 days
Like?
You probably have send method inside the loop?
like making the coooooldwn 6 days lng
No ima send the code
it spams one channel, or all locked ones?
@commands.has_permissions(manage_channels=True)
async def lockall(ctx):
for channel in ctx.guild.channels:
overwrites = {ctx.guild.default_role: discord.PermissionOverwrite(send_messages=False)}
await channel.edit(overwrites=overwrites)
await ctx.send("Licked every channel!")```
See, you do have it inside the loop
@coarse minnow it spams one channel
Unindent the ctx.send 1 level
?
@client.command()
@commands.has_permissions(manage_channels=True)
async def lockall(ctx):
await ctx.send("Licked every channel!")
for channel in ctx.guild.channels:
overwrites = {ctx.guild.default_role: discord.PermissionOverwrite(send_messages=False)}
await channel.edit(overwrites=overwrites)
I believe
Uh, that indentation
Done
So there are four channels in my test server, it spammed that same message 4 times
@earnest phoenix I did it but it did the same
Oh wait
Holy fuck
Should be aligned with the for ... line
Is there a way to limit python RAM usage with a start parameter like on java?
wdym by a start parameter in Java
Can I solve this problem somehow?
Yes, don't use codeblocks with emojis
I don't understand you a little
(
You are using emojis in codeblocks, you cannot use them in codeblocks. Use codeblocks around them
😃 ```
you can if you use the actual emoji
This works
:MarioFP: This doesn't work.
Clear enough?
Oh mb I didn't read that far up
ummm this was working yesterday,
I think you are in the wrong directory
It's weird
the vote event isn't triggering when i voted my bot
I am maybe stupid, what you mean "codeblocks"
@static marsh this is a codeblock
this is a normal message
```this is the codeblock message```
this is a message
dbl.webhook.on('vote', vote => {
console.log('triggered')
console.log(vote.user)
let user = client.users.cache.find(user => user.id === vote.user).tag
client.channels.cache.get("764317983131828277").send(`Thank you ${user} for voting Isla on top.gg`)
});
any idea why this is not being emitted when i vote my bot?
did you configure it in your bot's page?
configure wut?
im there
yea
what did you put there
in the authorization box,i put the password
and in url?
nothing
then thats why
so i need to put a http url or something?
where is your bot hosted?
on heroku
then your url is https://YOURPROJECTNAME.herokuapp.com/dblwebhook
oh
and in your code, you have to use webhookPort: process.env.PORT
is there another way to test the vote event except from waiting 12 hours everytime
im new to this i need help wheni do "node bot.js" in the terminal to start it. it says "TypeError: Discord.client is not a constructor" can somone help
ah
im new to this i need help wheni do "node bot.js" in the terminal to start it. it says "TypeError: Discord.client is not a constructor" can one of u help
you misspelled something in your code
Discord.Client should have an uppercase C
thank you sir
at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=beatsdcbot.herokuapp.com request_id=712431bf-bf44-4abc-b3de-c6c040d7d075 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
what reward vote role?
