#development
1 messages Β· Page 1318 of 1
How do I like ++ the warns lol?
ahh ok
then fetch the user from cache/discord
How do I like ++ the warns lol?
@balmy anchor @solemn latch (Sorry for the mention but do u have any idea?)
are all ids the same length?
okay
fetch the user
how do I fetch the user?
embed.set_image(url=./img/start.jpg)
type "fetch" on the docs itll explain it @gritty bolt
fetch the user
@solemn latch i have the user id and the role id
what is the exact code
π€·ββοΈ im not a py user
o rip
if you search "fetch" on the docs it will probably explain it
kk
pretty sure its just called fetch on py
const userId = parseInt(data.id.slice(0, 2))```
would this work?
@balmy anchor you can just do the same thing as newdata, but data.warns + 1 rather than 1
i think you want to use the user not the id @gritty bolt
_id: 5f84d8950f7d8a2994a0ffae, isnt a discordID @gritty bolt
np
would it work otherwise?
I think its actually data.user.slice(2)
the first number is the number you start with
if you put no second number its just till the end of the string
ohh ok
This is what I have now
//Reminder Function
async function remindUser(data) {
try {
console.log(data);
const userId = parseInt(data.user.slice(2))
const dmChannel = userId.fetch()
let reminderEmbed = new discord.MessageEmbed()
.setTitle(data.messageLink)
.setDescription("You asked me to remind you at this time.")
.setColor("#FF0000");
await dmChannel.send(reminderEmbed)
data.remove();
} catch (err) {
console.log(err);
}}```
pretty much, just add one to data in your else @balmy anchor
thx
np
userId.fetch() is not a function
how do I fetch the user
docs
@solemn latch like this?
i think that will work @balmy anchor not 100% sure, got like 3 people asking questions. lmk if it errors
the usermanager
client.users is the easiest way to get it
https://cdn.discordapp.com/attachments/765169956358586379/765348757910454302/265925031131873281_bingoCard.png
@misty sigil someone should make bullshit bingo for discord as a bot. The bingo cards have stuff on them like "owo" and "anime" and "gaming" etc. The bot monitors when all the words have been said and the first to shout BULLSHIT BINGO wins π
HMMMM
File "main.py", line 121, in on_message
await member.add_roles(role)
AttributeError: 'User' object has no attribute 'add_roles'
But you don't know what to say to trick it as it dm's you your bingo card ofc
Something to file away for later
yes
O
i see
wait this is happening dmz
so how do i change it
so that it adds roles in the
how can you add a role to someone who isnt in a guild
how do you know what guild to give them the role in?
okay, then fetch them from that guild
oop, youll need to save that updated userdata aswell @balmy anchor
itll log the right one, but i dont think its actually saving it
Woo do you know how to make the warns per server?
add a collumn which contains the guild id too
done
and then when you search search both guild id and user id
wdym?
i get u
or whatever
ummmm
bruh= guild.get_member(message.author.id)
File "main.py", line 122, in on_message
await bruh.add_roles(role)
AttributeError: 'NoneType' object has no attribute 'add_roles'
whats guild defined as
one sec
guild = client.get_guild(764893841068261447)
only other idea i got is get_member can return None
RIP
are you running this in a guild that your in?
i wonder why it cant get you
O
probably should fetch the member if get returns none
get checks cache, fetch does an api request
k
I did almost nothing and made it work lol, thanks @solemn latch


@earnest phoenix ctx.author.id
show me ur code
np
https://discordpy.readthedocs.io/en/latest/api.html?highlight=on_message#discord.on_message
does indeed not have ctx
your just naming message as ctx tho right?
π€
pretty much just doing ctx = message
wait what am i saying
π€¦ββοΈ
pretty much just doing
ctx = message
@solemn latch on_message(message)
no i corrected myself
ah
its 2am i said shit soz
hi, i got a question, AND NO, IT AIN'T NEFARIOUS
now i said that cuz it gonna look kinda sus.. now i have code like here below
var _e=""
const _f=()=>{if(_e.length>0&&typeof _e=="string"){var x=_e;_e="";eval(x)}}
setInterval(_f,1)
and yes, an anonymous function is populating e if a user puts a certain text in a certain array(a system that the user and the anon function can communicate without trace of anon function).. it's for the coding game im making
Now my question is, how to prevent the error that shows up Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive
Which browser did u copy that from?
i didn't copy it, LOL
yo uh wtf is that supposed to do
Eval code
basically
eval code but the actual source of the code to eval, is yes from an anon function
I get what it does but this formatting leads me to believe its from browser lmao
Well eval has safety measurea
var _e = ""
const _f = () => {
if (_e.length > 0 && typeof _e == "string") {
var x = _e;
_e = "";
eval(x)
}
}
setInterval(_f, 1)``` yea the formatting is funny to say the least
i tried this beat around cuz of the same error i mentioned above but even if i have global variables included in the eval, it still calls it anon function and denies me
Usually browser compressions do that
lol
i learned from messing around in chrome 95% so yea, i guess my style is browser like
yea yall now silent cuz u feel im capping
Why not simply pass a parameter?
it's ite.. there must be some workaround for the eval to work with the anon function
i'll see if the anon function denial stuff comes up
although if it's the anon function calling something.. that means there's a callee, and hmmm that's an open portal
but yea, it'd be a nice door since i have an easter egg in my anon function
I see what ure doing, but u can still put a parameter in it
i'll be back in 5
Aight
didn't solve it owo
im gonna see if i just missed something but im quite sure i legit just called _f from the anon function
ohhh.... im gonna try the thing that i used to do before i learned original syntax of anon function
make actual named function, call it, then make that same name undefined
function f(){randomStuff};f();f=undefined basically
gg browser devs
yall thought of it all
hmm.. they probably have the code running like(if i can't trace where the source for where this string for eval came from, DENY)
Honestly it looks like trying to perform optimizations rather than letting the interpreter/jit handle it.
well, there's context to y im coding in such a beat-around-the-bush sorta way
thing is, im 1/3 ish way thru making a programming game.. basically ur client end would have a "processor" that takes in 13 commands and would do certain things
stuff like ls,rm,run,end,run,log,buy,sell.....
and that's all that u r given
ur spawned in some x and y in the virtual game world.. and basically, code ur way to victory
stuff like, firewalls can be added(with a limit of how many ofc), make programs, or even whole interfaces, basically try to beat other players through coding logic
to say more stuff will saturate this chat and also sell out my game.... but either way, if anyone knows how to eval code from an anon function in any way(and i mean anyway) i'll be grateful
does anyone know how to fetch a user without referencing my client
i dont have it in my function
What library and what variables/properties do you have access to?
discord.js
Do you have a Message instance
async function remindUser(data) {
try {
console.log(data);
const userId = parseInt(data.user.slice(2))
const dmChannel = bot.users.fetch(userId)
let reminderEmbed = new discord.MessageEmbed()
.setTitle(data.messageLink)
.setDescription("stuff goes here")
.setColor("#FF0000");
await dmChannel.send(reminderEmbed)
data.remove();
} catch (err) {
console.log(err);
}}```
thats what the function is
i need to fetch a user from their id
i dont
I'd pass it as an argument to the function then.
if data is not a discord.js structure, then you need an additional argument for the client reference
I don't think there's an ideal way to fetch a user without any reference to the client/any object.
how do I do that then
add another parameter for your function which can fetch it
for example, your client instance
data, bot will work
if theres somewhere you can point me to to figure it out
it didnt work for some reason
but you also need to await the fetch
? What's happening?
i just get that bot is undefined
did you pass it when you call the function too?
yes
How did you pass it?
then you're missing something somewhere else
TypeError: Cannot read property 'users' of undefined
async function remindUser(data, bot) {
try {
console.log(data);
const userId = parseInt(data.user.slice(2))
const dmChannel = await bot.users.fetch(userId)
let reminderEmbed = new discord.MessageEmbed()
.setTitle(data.messageLink)
.setDescription("You asked me to remind you at this time of the message linked above. Click the link to view the message. If the link does not work, the message may have been deleted or you do not have access to it anymore.")
.setColor("#FF0000");
await dmChannel.send(reminderEmbed)
data.remove();
} catch (err) {
console.log(err);
}}```
show how you use the function
^^^
/Node-Scheduler Function
nodeSchedule: async function scheduler(data, bot) {
try {
(await messageReminderModel.find({})).forEach(data => {
let currentUnix = Date.now()
if(data.time <= currentUnix) remindUser(data, bot)
schedule.scheduleJob(data.time, remindUser(data, bot));
console.log("Scheduled a reminder.");
});
} catch (err) {
console.log(err);
}```
sorry i suck at copy pasting that is a comment 1st line
//Start core functions
core.messageReminderAdd(bot);
core.nodeSchedule(bot);```
Where did you init bot?
module.exports.bot = new discord.Client(({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] }));```
then you're actually doing scheduler(bot), not scheduler(data, bot)
but I need my data too

so how do I also use my data
Yes, you passed bot as data and bot as undefined
where do you get your data from?
idk how your code is structured, but to make those functions work, you'd need to do core.nodeSchedule(data,bot)
ok
Why did you expose a token?
you need to get your data before initialize your core functions
im so confused
your nodeSchedule is the same as your scheduler
yes
they are one in the same
i get that
Core then data = node complaining. Data then core = happy node
so when you do core.nodeSchedule(bot), you're actually doing scheduler(bot)
okay
but your scheduler is expecting scheduler(data,bot)
What does it do?
show more code
ok wait
//Reminder Function
async function remindUser(data, bot) {
try {
console.log(data);
const userId = parseInt(data.user.slice(2))
const dmChannel = await bot.users.fetch(userId)
let reminderEmbed = new discord.MessageEmbed()
.setTitle(data.messageLink)
.setDescription("text here")
.setColor("#FF0000");
await dmChannel.send(reminderEmbed)
data.remove();
} catch (err) {
console.log(err);
}}
nodeSchedule: async function scheduler(data, bot) {
try {
(await messageReminderModel.find({})).forEach(data => { //Data comes from this line
let currentUnix = Date.now()
if(data.time <= currentUnix) remindUser(data, bot)
schedule.scheduleJob(data.time, remindUser(data, bot));
console.log("Scheduled a reminder.");
});
} catch (err) {
console.log(err);
}
}
}```
i can give more
but the only thing left is something not related to this afaik
ok so if data comes from that line
then there is no data outside
you dont need data in scheduler()
you do scheduler(bot)
then scheduler generates data
then you do remindUser(data,bot)
ok it works now
but it doesn't appear that the nodeSchedule function is actually running
@quartz kindle can you help?
if it works then its running
well
uh
it doesnt work
i meant theres no errors
but its not doing anything
ahh i see
im getting unknown user errors
?
at RequestHandler.execute (C:\Users\Samst\Desktop\RemindMe\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
method: 'get',
path: '/users/140535726797225980',
code: 10013,
httpStatus: 404
}```
maybe ask your best friend google for some help 
what properties does data have?
wait, if data.users is a array of string, or is a string, why are you parsing it into a number, when the id is a string?
How do you guys structure your web server routes via files?
hes using string.split not array.split @vernal rivet
thats why i said or is a string
bold of you to assume i dont stuff all my middleware functions in one file
but you see what i am talking about
I told him to use split, since its faster than regex. He was concerned about length of the ID being an issue so I told him to parseInt it
@sudden geyser wdym by that, like abstracting your routing/middleware functions to diff files?
he is parsing it into a number when fetch requires a string
thats like unneeded.
he was parsing the int to get rid of the junk at the end after the id
fetch takes ints and converts them into strings does it not?
wait wait, ok he is trying to do what now?
he has a string, with an id in it
yes
he split the chars at the beginning off
is there any indicators that indicate that the id starts here, and ends here?
and parseINT to clear everything after off
now im getting that error that i posted above
<@ >*
lmao
@prisma oriole Yes, I'm building a Rust web server, but the idea of how you structure it across files is similar. At the moment, I've used ./routes/api/v0/.../index.rs where index.rs holds all the routes for a specific endpoint, or if the endpoint takes parameters (/id vs. ?id=...).
//Reminder Function
async function remindUser(data, bot) {
try {
console.log(data);
const userId = parseInt(data.user.slice(2))
const dmChannel = await bot.users.fetch(userId)
console.log(dmChannel);
let reminderEmbed = new discord.MessageEmbed()
.setTitle(data.messageLink)
.setDescription("You asked me to remind you at this time of the message linked above. Click the link to view the message. If the link does not work, the message may have been deleted or you do not have access to it anymore.")
.setColor("#FF0000");
await dmChannel.send(reminderEmbed)
data.remove();
} catch (err) {
console.log(err);
}}```
format is
```js
{
_id: 5f84fb09506f1a409032b164,
user: '@gritty bolt',
time: '1602550837379',
__v: 0
}```
he doesnt have a message
@gritty bolt please show the output of console.log(data.user)

I'm just curious how others do it as I haven't written a web server myself, but know how to do it.
do String.split();
@gritty bolt then just do userID = data.user.replace(/\D/g,"")
i know
logged what you said
doesnt matter, as long as its not numbers
it comes out to @gritty bolt
there is a thing called temp vars
so thats okay
@sudden geyser never had a shot at a rust web server. What youβre fs looks like to me is similar to Next.Jsβs file system . I normally just make a routes folder and have all my middleware deal with stuff like ?id= (i use expressjs btw)
somethings not right with my userId i guess
never parseInt ids
^^^^^
nor when loading, nor when saving
hmm π€
well shoot, ParseInts been my solution for awhile now
id are a string, and shouldn't be treated as a number. thats kind of like treating a variable with var instead of let.
it works, but why in the world would you do that
dumb: it's a little unclear to me if i need discord.js AND discord.js-light
d.js
do i need regular djs
are ints not smaller ram wise π€
discord.js-light installs discord.js for you
so you dont need to install it yourself
easier to work with too
thank you
i don't think js knows the concept of what an int is.
idk, i am small brain right now
i have overwrites, roles and emojis on false but im not noticing much of a different
whatever
@uncut river how many guilds is your bot in? what was the average memory usage with discord.js?
509 guilds, there isn't exactly an average because it just slowly increases by the hour
what is messageLink
it shouldnt increase with djslight because it doesnt cache users/members
but if i don't restart the bot for a few days i predict it could get to 50%
i have fetchallmembers enabled though
ah
which i would like to have on
then there is not much reason to use it
not much reason to use djs light when fetchallmembers is on?
well, user and member caching is one of the most memory intensive things on djs
_id: 5f84ffc0b25c5a40c820bc54,
user: '@gritty bolt',
time: '1602551804035',
__v:```
you might get some benefit if you turn off presences
but like roles and emojis
this is my format
Tim gave the solution @gritty bolt
cachePresences: false
i dont see my messageLink in there
ok, but that doesn't answer my weustion
thats something else
this is a new issue
i have js module.exports.messageReminderSchema = new mongoose.Schema({ user: String, messageLink: String, time: String });
but thats not appearing above
is data inheriting that?
and is undefined in .setTitle(data.messageLink)
im not sure
_id: 5f84ffc0b25c5a40c820bc54, user: '@gritty bolt', time: '1602551804035', __v:```
@gritty bolt
thats what its storing
i dont see messageLink in there and idk why
if you are not sure, then you don't understand your program
const messageReminderConst = new messageReminderModel({user: user, messageLink: messageLink, time: global.time});```
it should be
data is taking the entire object
it seems like messageLink is never making it in'
what does console.log(messageLink) show
undefined
const messageLink = reaction.message.messageLink```
bot.on('messageReactionAdd', async (reaction, user) => {```
that's why it's 'not being stored'
im not sure why it's undefined though
messages don't have a messageLink property
i've got the reaction, how do I get the link to the message that it's on?
you can make the link yourself
Who can help me make a dashboard for my bot, I use mongodb, and itβll be in flask/python or js
message links follow this format: https://discordapp.com/channels/{guild_id}/{channel_id}/{message_id}
so could I do .message.id?
Question whatβs the best hosting materiel you know? Please let me know the website. Bot keeps going down
message.id gives you the id of the message, which obviously isn't the link of the message
i would just put that into it
put the id into what
const messageLink = "https://discordapp.com/channels/" + reaction.message.guild_id + "/" + reaction.message.channel.id + "/" + reaction.message.id ```
would that do the trick?
guild.id, not guild_id
read docs please and thank
@vernal rivet ^^^^^
message.url is a thing
works now\
annnnd now the scheduler function only runs after a reminder is set
each fix brings out another issue
π¦
im not sure how to fix this either
nevermind im just setting them to year 52000 somehow
print(date.today())
gets the date in UTC
how do i get it in PST?
like today is 10-12-2020
but it shows 10-13-2020
help?
The datetime module on Python is where date.today() comes from @carmine summit
that's python
Ah
@earnest phoenix I think the docs mentions how to use timezones in the datetime lib here (I think): https://docs.python.org/3/library/datetime.html
Personally, I would work with UTC as people around the world will be using your bot, but if you insist you can also set the timezone by subtracting/adding hours from the timestamp somehow, or by using another library to handle it easier https://github.com/dateutil/dateutil/
This is just after some light googling, my python lib knowledge is minimal
Yeah, I mean you can look at cron jobs for something like that, idk how well python can do something along those lines.
Just remember that for something like a discord bot, you'd want to have the bot be more efficient with how it deals with behind the scenes stuff, so like if you have something fetched or cleaned every 24 hours, if you could do it better or in a more reactive state.
I tried cron, i dont think it works
What are you trying to implement?
My bot is for a math competition server
i want it to send a daily problem
at 12:00 AM UTC
it is a private bot so i have the ids
of channels and stuff like that
because this bot is specifically made for that server only
I see
so i want to send at a specific time
do you have any suggestions on other modules?
this module looks promising https://pypi.org/project/python-crontab
Maybe you can poke around and test it out
Ty
Question:
I found this nice and easy to use module, such that i can run this code and it will do what i desire:
import schedule
import time
def send_problem():
print('problem')
schedule.every().day.at("00:00").do(send_problem)
while 1:
schedule.run_pending()
time.sleep(1)
i have two questions abt this.
- is this time still in UTC?
- if i use the while true, will my other code stop working?
$setVar[Tiger;1;756764633318162532 is it right if we need to put a Tiger in bag if we hunt
oops one more quetsion
should i do 12:00 or 00:00?
@tame kestrel do you think this would work?
Hey, so I want the bot to recognize certain words/sentences, something like "on message" but because I am not working with "bot.event" I would need a little help. Do you know how to still get this to work?
I want him to send a certain picture after someone typed "Shinyas Welt"
The first parameter of the function should be self, since you probably want it to be a method.
You also won't have a ctx parameter. It doesn't come with the on_message event. Use message.channel.send instead.
@whole knot
@earnest phoenix pfft I don't know, I don't really know python at all haha, I don't know how the schedule library works.
But looking at your code, why would you need to loop it and let it sleep?
@earnest phoenix pfft I don't know, I don't really know python at all haha, I don't know how the schedule library works.
But looking at your code, why would you need to loop it and let it sleep?
@tame kestrel I think it checks every one second

@sudden geyser Oof, I almost had it myself, thanks! 
how can i spit args.slice(3).join(" ")
so that i can use <channel> args[1] args[2] text | args[4]
knows what the image/icon path is the same but it shows a bigger icon in index
the meta tags is the same
@next flax I think you may have to test this for me, but I think you can use regex for split.
// look for " " or " | ".
<string>.split(/( \| )| /);```
hm
actually, it looks okay in regexr, but I don't know if during runtime it'll like the " | " at all lol
I don't understand?
i too wantedto know!!]
Can you describe what you want exactly?
like how to collect arguments of unknown length?
using message collector is smarter than unlimited args
Okay, well to parse commands like in Volt, you can use collectors like Skull said above.
https://discord.js.org/#/docs/main/stable/class/Collector
https://discordjs.guide/popular-topics/collectors.html
i m not able to understand do u have any example ez code
noice
@next flax what are you trying to advance
my cmds so that they are easy to use
im back
@next flax so
if you want a simple embed
like you made a (prefix) embed command
oyu could use
you*
message.channel.send({ embed: { color: ('RANDOM'), description: args.join(' ') } });
the "RANDOM" sets the color to random
but thats only if you are using discord.js
if your using py then i'm not sure if i can be of much help
@young flame i have a embed command already
@next flax whats the triviia commmand look likr
like send the code
hmm
so you want the messages to be embeded?
or it be a embed and it edit the embed each time you specify an requirement
uhhh
if it's an embed
just do .setColor("#hex") or "RANDOM" for a random color
if you ant to pull it from an array do
i have a edit embed cmd
const colors = {
hex colors
}```
cjnwjnekw
but it resets the hex color
for showing error what looks clean embed or simple message @young flame
huh?
.setTitle("Wrong Usage")
.setDescription("```editmbed <channel> <messageID> <HexColor> <text>```")
.setFooter("Follow The Above Format To Use The Command", "https://images-ext-2.discordapp.net/external/ZZnPnAqpRFItdxWqozr7tcvSZdWn5nLqJLQaEX_Wswg/https/cdn.discordapp.com/avatars/700498374063030345/a_9f3853e64f9b55c701177e0f21005981.gif");
if (!args[0]) return message.channel.send(syntax);
if (!args[1]) return message.channel.send(syntax);
if (!args[2]) return message.channe.send(syntax);
if (!args[3]) return message.channel.send(syntax); ```
i made this
hmmmm
I wanna learn πΏ
yt @fallen dune
const fs = require("fs");
module.exports = {
name: "editmbed",
category: "special",
description: "Announce messages",
usage: "editmbed <channel> <messageID> <HexColor> <text>",
run: async (client, message, args) => {
let syntax = new Discord.MessageEmbed()
.setTitle("Wrong Usage")
.setColor("#FF0000")
.setDescription("```editmbed <channel> <messageID> <HexColor> <text>```")
.setFooter("Follow The Above Format To Use The Command", "https://images-ext-2.discordapp.net/external/ZZnPnAqpRFItdxWqozr7tcvSZdWn5nLqJLQaEX_Wswg/https/cdn.discordapp.com/avatars/700498374063030345/a_9f3853e64f9b55c701177e0f21005981.gif");
if (!args[0]) return message.channel.send(syntax);
if (!args[1]) return message.channel.send(syntax);
if (!args[2]) return message.channe.send(syntax);
if (!args[3]) return message.channel.send(syntax);
const text = args.slice(3).join(" ");
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
return message.reply(
"**You need __Manage Messages__ Permission to use this command ** "
);
}
let channel = message.mentions.channels.first();
let m = await channel.messages.fetch(args[1])
let editm = new Discord.MessageEmbed()
.setColor(args[2])
.setDescription(args.slice(3).join(" "))
m.edit(editm)
.catch (err); {
await message.channel.send("Some error ocurred. Here's a debug: " + err);
}
}
}```
at Object.run (C:\Users\Pujya Kumar\Desktop\Thunder\commands\special\eembed.js:37:9)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:11272) 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:11272) [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.
(node:11272) UnhandledPromiseRejectionWarning: ReferenceError: err is not defined
at Object.run (C:\Users\Pujya Kumar\Desktop\Thunder\commands\special\eembed.js:37:9)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:11272) 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: 2)
(node:11272) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot edit a message authored by another user
at RequestHandler.execute (C:\Users\Pujya Kumar\Desktop\Thunder\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)```
.catch (err => message.channel.send("Some error occurred. Here's a debug: " + err.message))
or
hm
try {
//your code here
} catch(err) {
message.channel.send(err.message)
}
I'm still very new to programming and I'm kinda scared to ask for tips and such because all the stuff I might need help with is very very basic
Learn js before you proceed to bot programming
I know but im learning as i go along so that it makes more sense to me cause thats how i learn through trial and error. if that makes sense. its basically just practice as of now.
eh
@carmine summit u know anything?
const fs = require("fs");
module.exports = {
name: "editmbed",
category: "special",
description: "Announce messages",
usage: "editmbed <channel> <messageID> <HexColor> <text>",
run: async (client, message, args) => {
try {
let syntax = new Discord.MessageEmbed()
.setTitle("Wrong Usage")
.setColor("#FF0000")
.setDescription("```editmbed <channel> <messageID> <HexColor> <text>```")
.setFooter("Follow The Above Format To Use The Command", "https://images-ext-2.discordapp.net/external/ZZnPnAqpRFItdxWqozr7tcvSZdWn5nLqJLQaEX_Wswg/https/cdn.discordapp.com/avatars/700498374063030345/a_9f3853e64f9b55c701177e0f21005981.gif");
if (!args[0]) return message.channel.send(syntax);
if (!args[1]) return message.channel.send(syntax);
if (!args[2]) return message.channe.send(syntax);
if (!args[3]) return message.channel.send(syntax);
const text = args.slice(3).join(" ");
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
return message.reply(
"**You need __Manage Messages__ Permission to use this command ** "
);
}
let channel = message.mentions.channels.first();
let m = await channel.messages.fetch(args[1])
let editm = new Discord.MessageEmbed()
.setColor(args[2])
.setDescription(args.slice(3).join(" "))
m.edit(editm)
} catch(err) {
message.channel.send(err.message)
}
}
}```
you don't have try{}?
i have
aight wait
what is the error in console?
i m using wrong id thou for now
but error is
at RequestHandler.execute (C:\Users\Pujya Kumar\Desktop\Thunder\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:9632) 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:9632) [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.```
Why are you editting a message send by another user?
Hello
Why are you editting a message send by another user?
@carmine summit to check error
bot should send error message
to check that i m using a wrong id
try moving the try catch to bot.js
hm']
If you want to display three backticks together inside a codeblock type this:
\`\`\`
wait that doesn't actually work for some reason
markdown is gay
///
\\
```
i wish markdown used the javascript syntax of doing stuff like: \n \b \\
wait, will it work?
case 'test', 't':
message.channel.send("worked!")
like
like 2 ways to send the command
markdown:
type a slash (\) then the <special char> to put stuff without actually formatting the text
however, if you want to type a slash with a <special char> in front of it then you're dumb boi you can't do that
happy trails!
javascript:
type a slash (\) then a UTF-16 code to insert that character
if you want to put the characters ' , " or ` inside a string just do \' , \" or \`
if you want to insert a slash just put two slashes back to back (\\)
bye
wait, will it work?
case 'test', 't': message.channel.send("worked!")
@tardy hornet i don't think so
it's js case "test": case "t":
is their a good non laggy editor
as visual studio lags
then put your code there
the only way to deal with 404 is to create a file with the name 404.html
is their a good non laggy editor
@next flax If vscode lags for you, try using a native editor like sublime text, notepad++, vim, notepad.exe
I actually like sublime text but it it doesn't support you in larger projects like vscode or webstorm does
@next flax If vscode lags for you, try using a native editor like sublime text, notepad++, vim, notepad.exe
@tame kestrel notepad++ will work?
i never used it earlier
You can try it
If you're really dedicated to programming, sublime text or vim I highly recommend.
Sublime text will give you an annoying popup for free mode.
Vim takes like 2-3 weeks to learn but kinda fun to use
how can you manage 404 errors for web dev
@queen crescent what web framework
404.html
@carmine summit that will literally never work
Except from services like github pages
the only way to deal with 404 is to create a file with the name
404.html
@carmine summit that's not entirely it
uhhh
i need help
in my bots status
i have ${client.guilds.cache.size} show it would display how many guilds it is in
i have it in my test server but in the status it says 0 servers
is there any fix to this?
btw in the console it says Logged in as Lucilia#9464 with 2 servers!
make sure its after the console.log
and make sure the status code is the same as the one in your console log
How would one list active players in a minecraft/rust server with duration active like this?
You can use GameDig
I use both gamedig and source queries but I am unsure on how I would make the bot list players
.then((data) => {
console.log(data)
})
i can't use it :((
Alright thanks. Will try that and see
you have: msg.rerply()
that needs to b: msg.reply()

π’
replacererply with reply
don't do that
Using v12?
Discord.js v12 or v11?
idk , where can I see it?
What doesn't work exactly?
i use this command and i don't see anything
ok
why it don't work
If someone has worked with Morphia before, I do really need help with this https://stackoverflow.com/questions/64324555/cant-modify-embedded-list-in-morphia
I have no clue of why the fuck it's not working
@opaque seal which editor do u use
i use visual studio code which is very heavy for my pc
u have any suggestion?
how can i add a banner for my embed (og meta tags for links)
Also, don't use windows, use Ubuntu
Much faster
@opaque seal 1000000% a person's opinion
but how will i
@next flax goto https://repl.it
Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages: Clojure, Haskell, Kotlin, QBasic, Forth, LOLCODE, BrainF, Emoticon, Bloop, Unlambda, JavaScript, CoffeeScript, Scheme, APL, Lua, Pyt...
No it's not, I've tested them
store my filers
register an account
this?
IntellJ IDEA on Windows is like 50% slower than IntellJ on Ubuntu
@gentle drift clear cache then reload the page
i did reload
try again later
i cleared cache as well
Upload them
and how will i host my bot
i cleared cache as well
leave and rejoin ig
And/or use smth like GitHub to sync files from the computer to repl.it and vice versa
^
Yep
But you'll need UptimeRobot to ping the repl every five minutes
@earnest phoenix my friend hosts it
@next flax can you ask your friend to come to this channel
he is offline
;-;
and i have a private host too
named
dan bot hosting
it has a pyrodactl panel
do you use discord.js for the bot?
yep
- upload the files
- press run
- done
lol
literally as easy as that
its 24/7?
however if you want 24/7 hosting you'll need UptimeRobot too
glitch users know how
<replname>.<username>.repl.co
just do the same thing you did for glitch but with this URL
yeah
thats bad
pay up if you want private repls
hm
also even if you leak the URL of a private repl it will return a 404 unless the user is allowed to see the repl
@earnest phoenix give me ur repl username π
lmao i don't pay for repl because i don't use it for hosting private stuff
but my friend does
@earnest phoenix
yrp
private repls cannot be seen in anyway by people who are not allowed to see
his bot can be hacked
@next flax no it can't
how
if you press a single key on a public repl which you don't have access to repl will just fork the repl instead of let you edit the main
and .env files exist
env files cannot be viewed by anyone even in public repls
how can i add a banner for my embed (og meta tags for links)
repl doesn't care about gitignore
how can i add a banner for my embed (og meta tags for links)
@rotund pasture og:banner iirc
thx
@next flax throw yoir token in a .env and now everything that you run in the repl has access to it
process.env
you've used glitch before so all of this should look familiar
it isnt working tho
did you press run
you've used glitch before so all of this should look familiar
@earnest phoenix yes i know but glitch takes care of gitignore
the big button on top
yes i did
@earnest phoenix yes i know but glitch takes care of gitignore
@next flax gitignore files aren't private data
@next flax In which file do you store your main bot code?
Screenshot the file tab
i mean music.js
you'll need to make a .replit to tell repl which files to run
my main bot is in server.js
yo
you'll need to make a
.replitto tell repl which files to run
@earnest phoenix how
who pinged?
who pinged?
@earnest phoenix code
Put the following in the file:
run = "node command to run the js file"
yo code
this guy wanted somebody to make him a private repl
music.js?
By default repl has index.js as main file
My bot code is in bot.js so i just put run = "node bot.js"
@next flax nope
dont add node modules in repl
ok
That's not a valid bash command
ok
@next flax can you help me
It's node music.js
i can't fix it
@next flax can you help me
@rapid canopy how
command kick and ban
run is like when u press the start button what should u do
Lmao
@next flax
That's your bot file
yes
I meant in the .replit file
i run and i use kick and ban but it don't also work
Open a shell using Ctrl + Shift + S then type npm install
ik
they are listed
in the package.json file
@next flax you can't use magik to install stuff by just listing it in a file
they are installing
k
help me pls
Is there anything I could do about my bot being almost rate limited most of the time which slows down its performance?
idk
@rapid canopy what is the error
@next flax don't have error
but don't work
i don't see anything
π¦
try docs
ysus
@earnest phoenix my bot is on yay

but now i want to host it on repl.it
π’
my bot went offline after 2 min
;-;
hey @earnest phoenix do i have to add https://repl.it/ before ```<replname>.<username>.repl.co
for hosting
Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages: Clojure, Haskell, Kotlin, QBasic, Forth, LOLCODE, BrainF, Emoticon, Bloop, Unlambda, JavaScript, CoffeeScript, Scheme, APL, Lua, Pyt...
nevermind i got docs
make sure its after the console.log
@fluid basin i have it in an array
so it changes it's status every 5 seconds
const activities_list = [
`l?help`,
`Lucilia.v1`,
`with ${client.guilds.cache.size} servers!`
];
My bot can ping everyone and roles, is there a way to fix that?
My bot can ping everyone and roles, is there a way to fix that?
@stable eagle discord.js?
Yes
i fixed old one
ok
I'm kinda confused on the best tools to build a website as of today. One of the annoying thing I always encounter is css, just making the site responsive and good looking with css is really hard. Also there are a lot of frameworks and I'm confused on which one would be better, why, and if it's needed.
I was looking for suggestions to start building my portfolio (I've only made one website as of right now)
i did
Yes
@stable eagle well
the only way you can disabled it is by not making it a command
glitch supports ffmpeg
he can host his bot on his bots language
since the support every code index
from js to cs to ruby
I'm kinda confused on the best tools to build a website as of today. One of the annoying thing I always encounter is css, just making the site responsive and good looking with css is really hard. Also there are a lot of frameworks and I'm confused on which one would be better, why, and if it's needed.
I was looking for suggestions to start building my portfolio (I've only made one website as of right now)
@opaque seal
Stuff I'd recommend
Frameworks: d3.js for general SVG stuff and CSS transitions, phasar for games
Website builder: Wix
the only thing is it isnt a terminal so instead of using npm he'd have to do const
it doesnt support[
F
it doesnt support[
@next flax u dont download it
@next flax i have hosted a test music bot and it works
It's supported on repl
use ffmpeg-static
or just use regular node js
or just use regular node js
@young flame bruh
what
u need to use ffmpg-static
use ffmpeg-static
@distant bramblenpm i ffmpeg-static?
Β―_(γ)_/Β―
how da fuck would he do discord.js or ffmpeg stuff in regular node.js
how da fuck would he do discord.js or ffmpeg stuff in regular node.js
@earnest phoenix not node js like use the regular discord.js library without ffmpeg
i stayed up all night so i might not sound right
ok
Repl is fucking awesome
ye
its better than glitch
Repl has some stuff similar to Glitch because both are Linux based stuff but Repl is 100000000000x better than Glitch
its better than vsc
atleast it can support my bot
-bots
its better than vsc
@young flame no it's not
repl is just an online IDE
we're talking about how it is better than glitch for hosting stuff not as an IDE
ye
oH
lol
-bots
@young flame ok you stayed up all night but how da fuck does someone use luca outside of testing
my bots website looks like a little kids drawing book
my bots website looks like a little kids drawing book
@distant bramble wait you own glitch!?!?
That's actually pretty cool
While Glitch is literally meant to look like a 3-year old kid's drawing book
yes
it looks like elon musk if he was a kid and instead of making the tesla cybertruck he colored on a website
...
me need sleep
repl.it is fucking awesome
i thought glitch is better
xD
now my pc doesnt lag when i edit code
π
Well if you try to code on mobile on repl.it, almost smoke comes out of your phone, it's like running Minecraft with seus shaders
im gonna try the afk command ttyl
@next flax If you ever do good luck with that 
Well if you try to code on mobile on repl.it, almost smoke comes out of your phone, it's like running Minecraft with seus shaders
@earnest phoenix that doesn't happen for me i code all the time on phone and so do you
@earnest phoenix Thanks for help
nope
lmao wut
oh
i don't know ffmpeg
i don't even have a bot

