#development
1 messages · Page 481 of 1
npm install whatever@githubusername/repo
@earnest phoenix yeah can you help me cause me not good at yt
like step by step by step
ytdl-core works fine for me 👀

@bright spear you using python
@earnest phoenix yeah
because i dont know how to do it
No I use js
thats why
its just youtube dl
come on
i know nothing about it
at least give me help
Google can help you out
@vernal rivet Nein noch nicht
Is there a way
I can make an image
wait to send?
I am doing it on an embed
but it is sending before the embed
so it looks werid
ok, Haben Sie sich die Discord.js Dokumentation schon angesehen?
Uh, is the image supposed to inside the embed or outside it? @vernal rivet
like the thumbnail?
np
Lol yw I guess
to imgur
lol
@remote heart
do you guys know how to make an invitation for the bot, like when the bot joins the server, it sends a message about the help server? kartoffel is wanting to know how to do that
i would guess an event
guild create event
ok
you can dm the owner (bad) or find the first channel your bot can post to and send (best but gets annoying)
or not send a welcome message 
the owner just invited it not like they need a welcome message
no like when you invite aki, you are invited to the aki server
sends
what if its a guild message, would that still be annoying?
Yeah
ok
@remote heart Von dem, was ich von jedem höre, ist, dass ein Einladungssystem ein GildeCreate Event braucht, aber es wird Leute nerven, was für dich schlecht sein kann, wenn sie genervt werden
Hmm
How do I assign a command
to one person
I know I need their ID
but I forgot how to
isn't it
if( something here !== "486674992981999648")
xD
@lusty dew like, only one person can use the command?
Yes
Cause
this is ow I have it set up
if(message.content.includes(`${secret}`))
let embed = new Discord.RichEmbed()
.setDescription(`Also secret`)
.addField("ha it is secret")
.setImage(`${image}`)
message.channel.send(embed)
}
}
if( message.author.id !== "486674992981999648")
return
do the if(message.author.id !== "486674992981999648"){ let embed = new Discord.RichEmbed() .setDescription(`Also secret`) .addField("ha it is secret") .setImage(`${image}`) message.channel.send(embed) }
@vernal rivet No
Oh wait
yes
I forgot
if it is assigned to them
the secret code
then add an else statement
lol
my brain
ok
np
Oh wait
i am here everyday
How can I add another person
@earnest phoenix whats up?
wat u need help with @earnest phoenix ?
ummmm.....
u dont need to fill everything
lemme check the docs for a while
if(message.author.id !== "hers", !== "mine")
ytdl
monika i would say do if(message.author.id !== "id1" || !== "id2") i think
You might need the message.author.id on both sides of the ||
you could also go by the role id
i was just gonna say wat u said advith
However spoon-feeding isn't allowed here so I suggest you try learning js and googling answers to questions
so
It's not specific to discord bots
do you guys know the format code for wav?
yes, i would suggest learning from codecadency
C:\Users\User\Desktop\LoverBot v3\commands\secret.js:8
if(message.author.id !== "486674992981999648" || !== "479603748382179329"){
^^^
SyntaxError: Unexpected token !==
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
you guys talking to me?
@lusty dew yes put message.author.id on both sides
yes
@earnest phoenix no, nobody here knows the answers to your questions
i'm trying to get my bot to download 326kps audio

what sooo thining about it?
you realise youtube limits their audio
id be surprised if its over 256kbps
yes
well, i didnt know that
you learn things everyday
I has a question
i mean, here are the audio only options for a popular music videoon youtube
highest is 160kbps
they can do
@quartz dune afk
well fuck
that is an actual person
Oh well anyway
it will set there name to [AFK]<Therename>
and when someoen pings them
it tells them they are afk
and how long they been afk
yeah its very very simple
Can you help me?
you store (for example in database) who uses the AFK command, and when somebody mentions a user, check if they are marked as afk
lol
@vernal rivet Wie mache ich so ein Event?
@sick cloud just add the package to package.json then use npm i
du würdest `` bot.on ("guildCreate", guild = {
}); ``
Es ist genau so, wie du es gemacht hast, wenn dein Bot online ist, er wird eine Nachricht an die Konsole senden, etwas wie "Ich bin bereit", aber stattdessen auf dem Async, ersetze es durch Gilde, glaube ich. Überprüfen Sie die Discord.js Dokumentation dafür
Ich muss jetzt schlafen, es ist wie 12:40 Uhr für mich, viel Glück mit Ihrem Bot, sagen Sie mir, wenn etwas passiert @remote heart
help me, for which it does not work!
if (message.content.startsWith(p + 'fortnite')) {
//!fortntie
let username = args[0];
let platform = args[1] || "pc";
let data = ft.getInfo(username, platform).then(data => {
let stats = data.lifetimeStats;
let kills = stats.find(s => s.stat == 'kills');
let wins = stats.find(s => s.stat == 'wins');
let kd = stats.find(s => s.stat == 'kd');
let mPlayed = stats.find(s => s.stat == 'matchesPlayed');
let tPlayed = stats.find(s => s.stat == 'timePlayed');
let asTime = stats.find(s => s.stat == 'avgSurvivalTime');
let embed = new Discord.RichEmbed()
.setTitle("Fortnite Stats")
.setAuthor(data.username)
.setColor("ffa500")
.addField("Kills", kills.value, true)
.addField("Wins", wins.value, true)
.addField("KD", kd.value, true)
.addField("Matches Played", mPlayed.value, true)
.addField("Time Played", tPlayed.value, true)
.addField("Avg Survival Time", asTime.value, true);
message.channel.send(embed);
}).catch(e => {
console.log(e);
message.channel.send("Не удалось найти это имя пользователя в базе данных");
});
}
Are you sure args[0] is not !fortnite?
Not really an error
?
Post the full error
That's not the error
Там просто показано, где команда ломается. Кинь полный текст ошибки
Excuse me for the Russian
Is it possible to make a ready-made version, without errors?
Nope
C:\Users\nikita\Desktop\PlanBot\index.js:91
let data = ft.getInfo(username, platform).then(data => {
^
TypeError: ft.getInfo is not a function
at Client.bot.on.message (C:\Users\nikita\Desktop\PlanBot\index.js:91:23)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (C:\Users\nikita\Desktop\PlanBot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\nikita\Desktop\PlanBot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\nikita\Desktop\PlanBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\nikita\Desktop\PlanBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\nikita\Desktop\PlanBot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\nikita\Desktop\PlanBot\node_modules\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (C:\Users\nikita\Desktop\PlanBot\node_modules\ws\lib\receiver.js:409:14)
You gotta learn and do it yourself
We won't code it for you...
And it's pretty self explanatory
ft.getInfo is not a function
?
...
Такой функции не существует
poorly
no
In terms of
"I wrote it" or "I copied it"
so what's the error code?
Ты по-русски говоришь?
да
@vernal rivet Verstehe ich nciht so ganz
И что за ft вообще?
Ты это устанавливал? https://www.npmjs.com/package/fortnite
@bright spear Can I ask you
Would his way of defining ft be good
I am not a js coder sooo
The one I linked above
Well, the package page tells to use this:
// Bring in the Fortnite module
const Client = require('fortnite');
// Create an instance of the client with your API Key
const fortnite = new Client('Your-API-Key');
Yeah it seems fine
стойте !
Я просто не знаю как ты обозначил Fortnite в своем коде
Is .getinfo a thing tho
стой, это API ===> https://api.fortnitetracker.com/v1/profile/{platform}/{epic-nickname}
message: "No API key found in request" нууу
?
const Fortnite = new Client('https://api.fortnitetracker.com/v1/profile/{platform}/{epic-nickname}'); ^
Literally what I could find is https://fortnitetracker.com/site-api
Meh, looks like getInfo is not for this package
hmm its need api key
Looks like it should be .user
?
hmm i think its need an api key to use
The example says .user though
Hey anyone knows how to fetch a bot in discord.js ?
?
i want to fetch bot info in discord.js
use the dblapi js module
it can fetch bot
The example says .user though ???
yes
@cinder stratus from the example
dbl.getBot("264811613708746752").then(bot => {
console.log(bot.username) // "Luca"
});
yes but it can only fetch dbl bots
@jolly mist the example in the package says .user not .getinfo
@cinder stratus what do you want then?
@cinder stratus there's no way to get a bots info other than from a bot list
There's no central system with all bots
@jolly mist getInfo не существует. Есть user
But not stuff like prefix and description
no i meant that i want to fetch any bot by client id of bot
A.K.A ft.user
@cinder stratus you cant
@cinder stratus what info do you want though
Почитай пример на странице
@slender thistle #memes-and-media 
стой
bot icon and bot name
Don't mind me, I was just telling the guy to use user instead of fetchInfo
So basically just a userinfo command? @cinder stratus
@cinder stratus what are you using? djs stable or master?
Because he seems to not understand some parts of what we tell him
(node:6448) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
at new User (C:\Users\nikita\Desktop\PlanBot\node_modules\fortnite\src\User.js:13:73)
at C:\Users\nikita\Desktop\PlanBot\node_modules\fortnite\src\Client.js:61:24
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6448) 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(). (rejection id: 1)
(node:6448) [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.
stable
@bright spear i got this 
Lol k
@jolly mist Ты на чем используешь toLowerCase, можешь напомнить?
username, discrim, avatar hash, bot and something else
И вообще, кинь полностью код
it takes an ID
if (message.content.startsWith(p + 'fortnite')) {
//!fortntie
let username = args[0];
let platform = args[1] || "pc";
let data = ft.user(username, platform).then(data => {
let stats = data.lifetimeStats;
let kills = stats.find(s => s.stat == 'kills');
let wins = stats.find(s => s.stat == 'wins');
let kd = stats.find(s => s.stat == 'kd');
let mPlayed = stats.find(s => s.stat == 'matchesPlayed');
let tPlayed = stats.find(s => s.stat == 'timePlayed');
let asTime = stats.find(s => s.stat == 'avgSurvivalTime');
let embed = new Discord.RichEmbed()
.setTitle("Fortnite Stats")
.setAuthor(data.username)
.setColor("ffa500")
.addField("Kills", kills.value, true)
.addField("Wins", wins.value, true)
.addField("KD", kd.value, true)
.addField("Matches Played", mPlayed.value, true)
.addField("Time Played", tPlayed.value, true)
.addField("Avg Survival Time", asTime.value, true);
message.channel.send(embed);
}).catch(e => {
console.log(e);
message.channel.send("Не удалось найти это имя пользователя в базе данных");
});
}
which api
Я так понимаю, это уже в другой команде проблемы
Ибо я toLowerCase здесь тупо не вижу
а можно готовый вариант ???
Нет
oh
а чо ?
Я сам не ебу
User.iconURL
У тебя где-то toLowerCase() используется на том, что тупо не существует
is this right to display bot icon
У тебя где-то toLowerCase() используется на том, что тупо не существует ???
эту
(node:6448) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
at new User (C:\Users\nikita\Desktop\PlanBot\node_modules\fortnite\src\User.js:13:73)
at C:\Users\nikita\Desktop\PlanBot\node_modules\fortnite\src\Client.js:61:24
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6448) 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(). (rejection id: 1)
(node:6448) [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.
а хз чо тут написано
Блять, ты можешь на Hastebin кинуть свой полный код?
бота ?
Да
ща
ok
return message.channel.send(embed);
client.channels.get("488241752319197184").send(`**${message.author.username}** Added ${User.username} It Will Be Tested Soon`)
it is wrong
Returning before doing something 
ok trying
why are you learning on a bot then
why are you tagging me the shitpost channel
and you should learn js on a non bot project tbh
js question, is it possible to get the date format for 7 days ago like this 2018-8-31 using js Dates?
Can someone teach me coding?
youtube can
https://codeacademy.com @queen fog
how can i set 2 bot prefix?
my source is
const prefix1 = ["w."]
const prefix2 = ["W."]
client.on("message", async message => {
if(message.content.indexOf(prefix1 || prefix2) !== 0) return;
const args = message.content.slice(prefix1.length || prefix2.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
try {
let commandFile = require(`./commands/${command}.js`);
commandFile.run(client, message, args);
} catch (err) {
console.log(err)
}
});
plz help me T.T
then..?
w. , W.
use toolowercase
if (prefixes.includes(msg.content.slice(0, 2)) return commandFunction();;
my internet down
fu*k
if (prefixes.includes(msg.content.slice(0, 2)) return commandFunction();
^^^^^^
you can also use something like to check for the prefix as well
const prefix = ["w.","W."];
if (new RegExp(`^(${prefix.join('|')})`).test(message.content)) {
// Do something here
}
wouldnt that option be slower?
i thought if you used regex like that it's slower than just comparing it with includes
trying to shit around with java and hit an issue.
im never getting the JDA finished laoding message.
ideas?
intellij is also telling me that builder.buildAsync(); is being deprecated
nevermind, it just took bloody ages. like about 2 minutes its workig now
@earnest phoenix Use a for loop and regex
@earnest phoenix i'm updated it!
thank you everyone ><
(node:7589) DeprecationWarning: Collection#find: pass a function instead
(node:7589) DeprecationWarning: Collection#find: pass a function instead
Are you using find like: .find('name', 'name')?
yes
That's the issue
You have to pass a function
dont do that
hence the error
so what i use to find
A function
arrow function
?
😕
^
role => rolename
^ thats gonna find a role named whatever
ok
Also that's basically the same with users, guilds, etc
/shrug
can you do deconstruction in python?
//me
#---SETNAME---#
@commands.command()
@commands.is_owner()
async def setname(self, ctx, *, name: str):
"""Sets the bot's name!
Parameters:
name - The name to set.
Requirements:
Bot ownership"""
await ctx.me.edit(username=name)
await say(ctx, ":white_check_mark: - Name changed!")```
The name doesn't change. Help?
(Discord.py, rewrite, discord.commands.ext)
why not just do ctx.send 
I want the bot to change usernames, yet it doesn't do so.
Oh
I experimented a lot around and this one seems to not raise errors (errors mostly focused around the usage of "self"), though still the username remains the same.
are u sure username is a parameter
very weird
Using ClientUser.edit raises an unavoidable wave of errors focused around "self".
Either that it's not defined, or, when it is, that Owner.Owner has no avatar option.
Though it also has an "edit" option, and ctx.me hints to the same, just in a member instance.
So far, only ctx.me worked at all and didn't raise an error.
You still need ClientUser
How did you even use it...
#---SETNAME---#
@commands.command()
@commands.is_owner()
async def setname(self, ctx, *, name: str):
"""Sets the bot's name!
Parameters:
name - The name to set.
Requirements:
Bot ownership"""
await discord.ClientUser.edit(self, username=name)
await say(ctx, ":white_check_mark: - Name changed!")```
This is the past code.
sighs
Of course it's self.bot.user
Thanks.
For anyone who can find it useful, this is the command:
#---SETNAME---#
@commands.command()
@commands.is_owner()
async def setname(self, ctx, *, name: str):
"""Sets the bot's name!
Parameters:
name - The name to set.
Requirements:
Bot ownership"""
await self.bot.user.edit(username=name)
await say(ctx, ":white_check_mark: - Name changed!")```
😄
how do I remove and add roles for user in JDA?
Use the docs
How do I check a member's permission value?
# ---EVENT INVITEFILTER---#
async def on_message(self, message):
with open("../DSB_Files/filters.json", "r") as file:
invfilter = json.load(file)
try:
invfilter = invfilter[str(message.guild.id)]["invite"]
except KeyError:
invfilter = False
if invfilter:
if "discord.gg" in message.content or "discordapp.com/invite" in message.content:
if message.author.permissions != 8192:
await message.delete()
await message.channel.send(f":exclamation: - Please do not send invite links, {message.author.mention}!")
elif not invfilter:
pass```
Trying to make an invite filter check if the member has permissions to delete other's messages. The current code doesn't work.
in discord.js you can do message.member.hasPermission();so im sure there is the same method in python
message.author returns a "User" class
message.member returns a GuildMember class
which has the data for roles
iirc message.member.roles is some sort of map
bur using hasPermission is overall better
How exactly should I use .resolve? I have a relative path ../../Data/asset.mp3. How would I turn it into an absolute path?
require.resolve ?
why do you need an absolute path?
some modules / methods
Discord.js has weird quirks
need absolute paths
ah k
not just that
fs.readdirSync requires a absolute path iirc
its relatively common
well, common enough
The file is an mp3 file, require gives errors as it's not a .js file. I think
hi
@nimble star Question still up?
public class Manager {
public static List<Guild> guildList = new ArrayList<Guild>();
public static void initialize(JDA bot) {
for(int i = 0;i < bot.getGuilds().size();i++) {
Guild guild = new Guild(bot.getGuilds().get(i).getId());
guildList.add(guild);
}
}
}
why does it doesnt add any guild into guildList
I need to get my friend to test it.
It's also if 8192 in message.author.guild_permissions:
Either that or ==, depending on your needs 😄
yes
its return array and have size 1
because my bot only at my server
and its returned my server it if i do bot.getGuilds().get(0).getId();
then its not added to guildList array
idk why
I don't think == would do the job, since the permissions aren't equal.
Oh well, ignore me
it should be continue;
I never touched those, so eh
# ---EVENT INVITEFILTER---#
async def on_message(self, message):
with open("../DSB_Files/filters.json", "r") as file:
invfilter = json.load(file)
try:
invfilter = invfilter[str(message.guild.id)]["invite"]
except KeyError:
invfilter = False
if invfilter:
if "discord.gg" in message.content or "discordapp.com/invite" in message.content:
if message.author.permissions.value(8192):
await message.delete()
await message.channel.send(f":exclamation: - Please do not send invite links, {message.author.mention}!")
elif not invfilter:
pass```
Nope.
Doesn't work.
value is an int
This value is a bit array field of a 53-bit integer representing the currently available permissions.
message.author doesn't have a permissions ...thing
Because it's guild_permissions
if not message.author.guild_permissions.value(8192):```
That's not how it's done
fuck now i understand why discord.commands.ext is so much better
because you dont need 2 years to figure out how to check permissions
Why don't you check for the permission like guild_permissions.administrator instead?
These things exist too
finally, thanks
i need to remember that guild_permissions.(permission name) is a thing
😄
$look
discord.py hasn't been updated for ages
It has
you are using async branch
rewrite one exists
Now, that one is updated
And do not do pip install discord-rewrite
discord.py is surprisingly very active in development
To install d.py rewrite, you have to use
pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]
ok
Is it safe to use that, considering it's a re-write? Or has the re-write finished?
It is never finished
It's up-to-date
You will have to update your code to that version, though
No I mean as in there's going to be no huge changes that suddenly come out of nowhere?
Not really
Except if discord forces them to
Not in public releases, at least
Is there a docs on discord.py
async
What;s the docs for rewrite?
oh lol ty
hmmm
this what ?
What?
this code for what ?
Why are you reposting it even? 
Rainbow roles are prohibited
I mean, you could do it but get ready to face the consequences eventually
Ye
There is a bot called Ghost something
and it gets you banned for using it cause of rainbow roles
Anyway
Good morning
const Discord = require('discord.js');
const Manager = new Discord.ShardingManager('./index.js');
Manager.spawn(2)
isn't this how you shard?
@remote heart Im Discord.js doc im Abschnitt client gibt es eine Sache namens gildeCreate, die den Namen des Ereignisses darstellt. und wie Sie ein Ereignis einrichten, ist ähnlich wie bei der Erstellung des Bot.on ("message", message = {
}); ``
what
@lusty dew
🤔 How many servers is your bot in?
Not many
I was just wondering
lol
One day I hope to come to the point of needing to shard
so it would be good to know
before hand
no its completely different
async def prefix(ctx):
with open("../DSB_Files/prefixes.json", "r") as file:
cpredict = json.load(file)
cpre = cpredict[str(ctx.guild.id)]
return ["D.", "/", "@ancient mirage ", cpre]
bot = commands.Bot(command_prefix=prefix(ctx), description=description)```
How do I make it know what 'ctx' is, or be able to identify the guild ID at all?
Hello. When I added my redbot clone to the list it kept glitching and not allowing the bot to work. I was accepted, but I removed it because it kept crashing. Error: https://pastebin.com/ZxnkdGpV Help? (there was no other logs)
👀
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found``` im still receiving this error
@quasi halo that error tells us nothing
the command exist
thats all it said tho .-.
@gleaming glen Botumdaki Komutlar Bunlar Ana İşlevi NSFW Olmamasına Karşın nsfw Komutları var Kabul Edilir mi?
yes
güzel
but this channel is english only as well afaik
no
my bad I mixed with the #memes-and-media channel
I would have done better if I had the chance
yea looks good
material design <3
it looks good to me
thanks
yw
If I write 300 characters description, I would like to add to DBL
absolutely
pls uptime @old python

that is a dbots command anyway
How do you say "if message.content.includes("thanks")" in a DM?
its the same thing lmao
why does my site's long desc js not work?
i'm importing this: https://codepen.io/Joshuliu/pen/eMqppw.js
<script src="https://codepen.io/Joshuliu/pen/eMqppw.js"></script> is in my long desc
@primal adder is your bot cert?
yes
my code isn't wrong right?
i have
it didn't work
it's as if i never even pasted it in
which leaves me to thinking that my code is wrong
but it doesn't look wrong at all
hmm... that might be it
hmm... so it is the code's problem
yes
you have some function server code at the top but its commented out
did you not check the console
well
lesson 1: dont comment out code you need
lesson 2: if you have a js issue check the console
anyone know how to generate a graph as a png then embed it in an embed? (node.js)
wrong channel
uh, anyone..?
I dont understand how to fix my error. @west raptor tried to help but she said to ask #development. If you need me to add you ask me to dm you the link.
no
oh
idk, i have an array of numbers (downloads per day) and wanna make some kind of graph showing those downloads
@sick cloud use canvas
@frank forge i have no idea what you just sent me. i dont see anything remotely relevant to a discord bot in there
Where is youtube DL core located
@quartz kindle too much hard work
i just want a simple graph
also how do you remove from the end of an array?
its not that hard, just make something with x dimensions and draw a bunch of lines with % coordinates
to remove from the end i believe its .pop()
okay
how i can change color in this hello
change the colour in what
this hello
whatever
ty
🤔
Can someoen help me make a pornhub command 👀
I am trying to do what I did with steam
But it returns this
when I console log body
<Buffer 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0a 3c 21 2d 2d 5b 69 66 20
6c 74 20 49 45 20 37 20 5d 3e 20 3c 68 74 6d 6c 20 63 6c 61 73 73 3d 22 69 65 ..
. >
ty
@lusty dew you can make a message attachment from it
ok
@sick cloud ?
turn the buffer into an image
How can I use a variable in a let statement? This is nodeJS. Example:
let yeet[VARIABLE_HERE] = 1;
First of all, it's always good to ask one question before you post here
Does this make sense
No...
Good
smh
@earnest phoenix is yeet an object?
No, yeet is the start of the variable name.
It doesn't matter if it is or not, because as it is, this doesn't make any sense, thus improper syntax
you can do this
let yeet = {}
yeet['hello'] = "world"
console.log(yeet['hello'])
// => "world"
Next question: what do you want to do
Would hello be a preset variable? @sick cloud
@earnest phoenix can you stop shitposting in this channel while i'm trying to help someone
np
What?
What blind assumption is this now
I'm trying to rationalize with what he is saying
don't post here unless your helping someone or being helped
go to #general or #memes-and-media
I'm trying to help him
Kind of weird that you just said that out of nowhere but okay.
you aren't helping at all.
I asked two questions
its been resolved anyways, out. kthx
SyntaxError: Unexpected token [
at new Script (vm.js:73:7)
at createScript (vm.js:245:10)
at Object.runInThisContext (vm.js:297:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)```
One was answered, still waiting on the other
is rate an object tho
rate is just text
base is a preset variable
@earnest phoenix what do you want to do..
I don't want to assume
@earnest phoenix set this:
rate[VARIABLE_HERE]
to this
1
rate is just text
I have infront of it
Ehm
?
Can you fix that
...
What you just showed doesn't look right
Maybe you missed the backticks or something
......
alright then
ur on mobile
See what I mean
heh
You should know by now that mobile only does one format per message
I don't really see this a lot, so no
Anyways, the syntax you are using is for an object[key] reference
Is rate an object?
no...
ive said it before
rate is just text
!
Then you don't want that, then
What are you trying to do? The notation you are using is for setting a certain value in an array or object.
I'm still confused as to what you want*
Do you just want to assign a string to a variable or what
${rateUSD}
THIS IS A VARIABLE IN TEXT, CORRECT?
DO YOU UNDERSTAND THAT?
jesus
No
..
rateUSD could be anything
..........................
Not just a string
Well assuming I just said it was a variable
it probably is
Okay, let's assume it's s string
Explain exactly what you want to do
do you see the rate in it?
Yes
mk
do you see the rate in https://i.gyazo.com/thumb/1200/a35a42a9ecb0b431b56e833d1593fb8c-png.jpg
${rateUSD} this doesnt mean its a variable in text. this only means its a variable being accessed inside template literals `
...
mk
fucking jesus
Hey, it's hard to follow along when you're not referencing proper JavaScript
I'm trying my best here
Everyone is
if rate is an object, and you want to create a new property and assign it a value, then its rate.base = 1
It's not an object, tim
(͠≖ ͜ʖ͠≖)👌
its not an object how many fucking times have I said ITS JUST TEXT
my god
if rate is an object which contains a property called base, to access it its rate.base or rate["base"]
I appreciate the help
but if your going to help just read
rate is nothing
I hope you realize that the code you have makes it look like an object
if rate is just text, then rate[bla] is not valid javascript
It was an [insert text here]
That is how you would reference an object value in JavaScript
have you never seen that before?
heh
No, because that's not valid JavaScript you showed me
its not javascript lol
Referring to the code you showed
why dont you try to explain what you want again... slowly...
mk
with as much information as possible
^
and code examples if possible
let is how you would set a variable... are we all clear on that?
let rate = 1; do we understand that using ${rate} would output 1?
No
only inside template literals
........................................................................................
Right
fucking god
It will output 1
let me explain it to you
Not like that it wont
it will
if u put it in a
message.chanel.send or wutever
Dude
let rate = 1;
console.log(rate) //works
console.log(${rate}) //doesnt work
console.log(`${rate}`) //works```
I'm not going to argue basic JS with you
do you understand now?
I already knew that my fucking god
JUST LISTEN
STOP TALKING
mk?
are we clear that it would output 1?
again, it will only work inside template literals
that is what I am refering ti
to*
Im pretty sure i know basic js
I don't assume anyone know things these days
Because I'm always wrong
@earnest phoenix I swear to god
shut up for 1 minute
ok?
you just asked for me to explain it
so
mk
I'm listening
I'm just here to correct any misconceptions as soon as I see them
it would output "1" (shut the fuck up tim)
now I want
let rate = 1;
but AFTER rate is a variable
so it owuld look like
${rateINPUT}
understand?
no
Nooe
yes
do you want to change rate?
you want to concatenate?
console.log(rate+input);```
You wasted our time for basic string concatenation.....and getting mad when we tried to help
.....
no thats not what i want tim
fucking god
its either im really dumb
I want to put a variable after rate
so if it was
let yeet = 1;
it would be
let rate1 = 1
understand?
Tim, uhm
Thats not what he wants to do at all
He wants to change the name of the declaration
The way you are approaching this is not good practice.
Sei4or unless your helping I would love you to leave and type your shit in #memes-and-media
Ill look at it never
You can't do what you want to do
wur
wut
You must declare a variable with a name
i know
the name will be
name + old variable
lol
so if i understand correctly, you want js let rate = 1; let abc = 1; //create rate1 = 1 //using rate + abc
is this what you want?
then yes, its a dynamic variable
rate doesnt exist
only abc does
rate is just text I need infront of the var
it is not a object
variable
or anything
so yes, a dynamic variable declaration
sure
nah the only options are eval and a window global
hes right lol
let input = 1;
eval("let rate"+input+" = 1");
console.log(rate1)```
or with template literals js eval(`let rate${input} = 1`)
but why dont you use an object instead? its pretty much the same thing and much easier
I cant
why?
let me try something
if it doesnt work ill explain
Caused some kind of error...
before you try it with discord, why dont you try it in the console using console.log?
and check for errors there
apparently eval doesnt work with let
at Object.<anonymous> (C:\Users\charl\Desktop\MM\index.js:3:16)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)```
but it works with var
havent i helped you enough already?
how are you getting it?
By doing
And I thought he knew basic JS
Tim mind if I DM you code?
I still dont know why this wont work in my bot
just post it here
but it works outside of it
What are `` in JS btw?
I would rather not...
Thanks
instead of "blabla"+variable+"blabla" you use them to do blabla${variable}blabla
👌
const Discord = require("discord.js")
const request = require("node-superfetch")
module.exports.run = async (client, message, args, ops) => {
var porn = args[0]
try{
var { body } = await request.get(`https://www.pornhub.com/video/search?search=${porn}`)
console.log(body)
}catch (err){
message.channel.send(`Oh no, Looks like you have an error. Error:${err.message}`)
}
}
module.exports.help = {
names: ["pb", "pornhub", "porn-hub"]
}
Like that
what does body give you in the console?
Buffer
here
let me show you
<Buffer 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0a 3c 21 2d 2d 5b 69 66 20
6c 74 20 49 45 20 37 20 5d 3e 20 3c 68 74 6d 6c 20 63 6c 61 73 73 3d 22 69 65 ..
. >
That
try console.log(body.toString("utf8"))
but you're not getting a json response, you're gonna get the full html page source
as a string
H
