#development
1 messages Β· Page 927 of 1
Check line 57
Then show the last few lines
wait oops
i forgot to save
but a new thing popped up
wait let me try to fix this one sec
is there something wrong with this code? it doesn't seem to be removing "Stranger" role when i enter this command on them but it does give the friend and ps2 division eu role
@client.command(pass_contxt=True)
@has_permissions(manage_roles=True)
async def ps2friendeu(ctx, member: discord.Member):
roleFriend = discord.utils.get(ctx.guild.roles, name="Friend")
roleps2EU = discord.utils.get(ctx.guild.roles, name="Planetside 2 Division EU")
roleStranger = discord.utils.get(ctx.guild.roles, name="stranger")
await member.add_roles(roleFriend, roleps2EU)
await member.remove_roles(roleStranger)```
i have checked time and time again to see if it's because the name of the role is wrong, it's not
Is the role name Stranger or stranger?
In your code you are using stranger
mfw, i kept looking at the left one not the right one
thank you for seeing through my stupidity
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});```
help
what password do you want
?
make one
I am trying to use dblapi but it just give me Error: 401 Unauthorized back
```what password do you want?
Are you providing a/the correct auth token?
@hasty sparrow actually the removal of role does not work but adding of role does work. i forgot to check if it was removing and it isn't
@earnest phoenix its your choice
Are you providing a/the correct auth token?
@hasty sparrow I regenerate but it not showing the new token
Check whether it can find the role
well if it can add the role, surely it should be able to remove the role
It can't remove roles it can't find
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'minecraft-server-util'
Require stack:
- C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\xAutentiqz\\Desktop\\Discord Bot\\index.js' ]
} ```
i get this error now
Did you install the minecraft-server-util module?
how do i make a bot command work only on specified guilds
@slender thistle @hasty sparrow this may sound weird but i think i fixed it by adding a message at end of the command and now it's actually removing stranger role
That is weird indeed
legit just added a await ctx.send
and it's working now
anyway thanks guys for the help
i've been stuck on that for days
using erela.js, I tried to make my bot play music. The play command works, the "startTrack" event is triggered, ut the bot doesnt actually play anything.
const Discord = require("discord.js");
const fetch = require("node-fetch");
module.exports.run = async (bot, message, args) => {
let target = message.mentions.users.first();
if(!target) return message.reply(":no_entry_sign: **Specifica pe cine vrei sa plesnesti!**");
const random_slap = [
'https://tenor.com/view/slap-handaseishuu-narukotoishi-barakamonanime-barakamon-gif-5509136',
'https://tenor.com/view/no-angry-anime-slap-gif-7355956',
'https://tenor.com/view/animepound-slam-gif-4880762',
'https://tenor.com/view/anime-manga-japanese-anime-japanese-manga-toradora-gif-5373994',
'https://tenor.com/view/hotd-slap-hit-anime-hitting-gif-5318916',
'https://tenor.com/view/rosario-vampire-anime-slap-butt-gif-3412059'
]
const file = random_slap[Math.floor(Math.random() * random_slap.lenght)]
let pEmbed = new Discord.RichEmbed()
.setColor("#0061ff")
.setAuthor(`${message.author.username} ii da o palma lui ${target.username}`, message.guild.iconURL)
.setImage(file)
.setTimestamp()
.setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL)
.setURL(file);
message.channel.send(pEmbed)
}
module.exports.help = {
name: "slap"
}
Bot sends the embed but with no file, help ?
oh, right
@boreal latch the bot is sending the image too but the gif doesn't load, is that a bug or i have done something wrong ?
how should i define url ?
how do i make a bot command work only on specified guilds
@slender wagon try
if (message.guild.id !== "ID") return;```
just type what i just typed xd
replace ur .setImage with what i just typed
.setImage(url = file)
^^
ok
what r u guys trying to do
oh wait
u dont need to actually do that
.setImage(file) is actually already correct
but its not moving?
oh it doesnt load
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node .
The bot is active and ready to go!
(node:38204) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
at C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:41:31
at C:\Users\xAutentiqz\Desktop\Discord Bot\node_modules\minecraft-server-util\src\index.js:125:23
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38204) 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:38204) [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. ```
@earnest phoenix u spelt length wrong
whats the fix for this
u spelt it as lenght
define it
he already fixed that
@zenith terrace i solved that already
Oof ok
any idea?
i used giphy for my slap command
@earnest phoenix send whole code again
or maybe try imgur
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node .
The bot is active and ready to go!
(node:38204) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
at C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:41:31
at C:\Users\xAutentiqz\Desktop\Discord Bot\node_modules\minecraft-server-util\src\index.js:125:23
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38204) 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:38204) [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. ```
you think i should change the tenor gifs with giphy? This does not make sense for me, gifs are gifs
i tried with tenor once
send whole code Sabin
doesnt load either
so i tried with giphy and it worked perfectly fine
maybe its my bad, but i dont actually know
const Discord = require("discord.js");
const fetch = require("node-fetch");
module.exports.run = async (bot, message, args) => {
let target = message.mentions.users.first();
if(!target) return message.reply(":no_entry_sign: **Specifica pe cine vrei sa plesnesti!**");
const random_slap = [
'https://tenor.com/view/slap-handaseishuu-narukotoishi-barakamonanime-barakamon-gif-5509136',
'https://tenor.com/view/no-angry-anime-slap-gif-7355956',
'https://tenor.com/view/animepound-slam-gif-4880762',
'https://tenor.com/view/anime-manga-japanese-anime-japanese-manga-toradora-gif-5373994',
'https://tenor.com/view/hotd-slap-hit-anime-hitting-gif-5318916',
'https://tenor.com/view/rosario-vampire-anime-slap-butt-gif-3412059'
]
const file = random_slap[Math.floor(Math.random() * random_slap.length)]
let pEmbed = new Discord.RichEmbed()
.setColor("#0061ff")
.setAuthor(`${message.author.username} ii da o palma lui ${target.username}`, message.guild.iconURL)
.setImage(file)
.setTimestamp()
.setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL)
.setURL(file);
message.channel.send(pEmbed)
}
module.exports.help = {
name: "slap"
}
the way I did it would be
let file = Math.floor((Math.random() * slap.length));```
@tight plinth can u help me i am getting ignored
this isn't even right
but you should try and see anyways, @earnest phoenix
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node .
The bot is active and ready to go!
(node:38204) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
at C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:41:31
at C:\Users\xAutentiqz\Desktop\Discord Bot\node_modules\minecraft-server-util\src\index.js:125:23
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38204) 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:38204) [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. ```
DEFINE IT
then in .setImage
.setImage(random_slap[file])
ReferenceError: MessageEmbed is not defined
mm
You didn't define it in line 31 in index.js
or 41
ok
const {MessageEmbed} = require('discord.js')
@earnest phoenix try giphy, click a gif, click url logo thing, and click "copy the gif itself"
this is how to define smth in ks
works for me
ok thanks
hi
I spoonfeed u coz apparently u cant read docs/u dont know js
i have no idea why tenor doesnt work though
good luck
ty
link itself should look like this
@zenith terrace thank you for the help dude
it seems like this netdata is wildly inaccurate. Says my cpu usage is 3% when its actuall between 13-16%, and says my memory is 31% when its 63% :/
@boreal latch it worked, tyvm
Dank Memer already is in this server
@earnest phoenix no problem, glad i could help!
use #commands or #265156322012561408
name: 'ban',
description: "ban players",
execute(message, args){
message.channel.send('(user) has been banned from the server');
}
}
client.on("message", (message) => {
if (message.content.startsWith("$ban")) {
if (!message.member.roles.find("Owner", "Admin", "Mod"))
return;
// Easy way to get member object though mentions.
var member = message.mentions.members.first();
// ban
member.ban().then((member) => {
// Successmessage
message.channel.send(":wave: " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou :point_right: ");
}).catch(() => {
// Failmessage
message.channel.send("Access Denied");
});
}
});```
will this work
umm whats wrong with that code https://ta.is-inside.me/l4XyCee8.png my bot isnt running
idk
@indigo cloud no
ok what do i need to fix it
show your main file
its mine main file
const giphy = GphApiClient(process.env.giphy_api);
client.on('message', message => {
if (message.content === '^gif') {
giph .search("gifs", { q: args })
.then(response => {
var totalResponse = response.data.length;
var responseIndex = Math.floor(Math.random() * 10 + 1) % totalResponse;
var responseFinal = response.data[responseIndex];
message.channel.send(
${message.author}Heres Your Gif! π,
{
files: [responseFinal.images.fixed_height.url]
}
);
})```
can you pls correct it i am new to it i just copied it from somewhere now facing problem
discord.js π
no
rip
can you pls correct it i am new to it i just copied it from somewhere now facing problem
interesting What kind of problems are you facing tho?
it would help if you explained what happens when you run it, if it shows any error, what error, etc...
with erela.js, my bot doesnt play any sound if I do the play commands. Here is my code: ```js
let args = message.content.split(' ').slice(1)
const { channel } = message.member.voice;
if (!channel) return message.channel.send("Woops, You're not connected to a voice channel!")
const player = client.music.players.spawn({
guild: message.guild,
voiceChannel: channel,
textChannel: message.channel,
});
const res = await client.music.search(args.join(' '), message.author);
if (!res || !res.tracks || !res.tracks[0]) return message.channel.send('No result found!')
player.queue.add(res.tracks[0]);
message.channel.send(`Enqueuing track ${res.tracks[0].title}.`)
if (!player.playing) player.play();
everything works fine
i haven't made the response right
const giphy = GphApiClient(process.env.GIPHYTOKEN);```
And now create a command for this and put in this:
```giph .search("gifs", { q: args })
.then(response => {
var totalResponse = response.data.length;
var responseIndex = Math.floor(Math.random() * 10 + 1) % totalResponse;
var responseFinal = response.data[responseIndex];
message.channel.send(
${message.author} Heres Your Gif! π,
{
files: [responseFinal.images.fixed_height.url]
}
);
})```
i was following this can you pls make it right for me @quartz kindle
π€¦ββοΈ
how to create cmd and put response in that
ohh
what about create cmd i dont know how to make it correctly

@quartz kindle are you there
if (message.content.startsWith("$ban")){
// do other thing
if (!message.member.roles.find("Owner", "Admin"))
return;
// Easy way to get member object though mentions.
var member = message.mentions.members.first();
// ban
member.ban().then((member) => {
// Successmessage
message.channel.send("π " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou π ");
}).catch(() => {
// Failmessage
message.channel.send("Access Denied");
});
}
will this ban command work?
how
then you need to check for permissions, not for roles
ok
and instead of copying code, try to actually learn it, so you can do it yourself the way you want to
I made my bot load command modules but since they use functions from the main script, they error
what should I do
my first idea was put all the functions in a module and require that module in the command modules
ahhh, just make a screenshot
@earnest phoenix link them or pass them as variables
@lofty lagoon you didnt install it properly, download it from the node.js website, install it (make sure the Environment variables box is checked), then restart your computer
the modules are dependent on each other
so im just putting the functions in a module
idk what language you're using, but most languages are very flexible in the ways you can import/export/link/pass modules and functions around
so theres probably many different ways of accomplishing what you're trying to do
so whatever works for you
this function is declared in the main script
the main script requires this module
so how would I get this function from the main script in this module
how can i install discord.py for my project i searched and i dont found anything
pip3 install discord.py
@lofty lagoon you didnt install it properly, download it from the node.js website, install it (make sure the Environment variables box is checked), then restart your computer
@quartz kindle I try with cmd and it's work
I think I need to restart my VSC
@earnest phoenix how much python do u know
i can use libs but i cant import libs with library
Require stack:
- C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:7:12)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\xAutentiqz\\Desktop\\Discord Bot\\index.js' ]
}```
any fix for this?
i was following codelyon tutorial
install the module
You can't import libraries with libraries?
k
yes
import discord
its not working
Any errors?
"resource": "/C:/Users/asus/Documents/bot projem/bot.py",
"owner": "python",
"code": "import-error",
"severity": 8,
"message": "Unable to import 'discord
this is error message
Have you learnt Python before this
The bot is active and ready to go!
C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:58
let mainrole = message.guild.roles.find(role => role.name === "Member");```
^
any fixes?
Because I will say this, Discord Bots should not be your first project
@indigo cloud Have you read the docs
its very basic projects i dont need to save
message.guild.roles.find is not a function
Have you read the docs 260
both of u go learn ur languages more
well no
Well read the docs
We won't spoonfeed you
when you haven't even tried
to learn
and i told u dont use a yt tutorial
in v12 its roles.cache.find()
smh
@quartz kindle Can you link the docs
I don't believe they are actually learning properly
@indigo cloud ^
I will say this and I don't know if you will agree Tim but Discord Bots should not be your first project
You first need to know the basics
as in, error management, basic projects
I cant get LL to work properly aaaaaaaaaaaaaaaaaaaaaaaaaaaa
Copying and pasting will get you nowhere
anything that isn't making a calculator that adds 1 + 1 and ends up being 11 shouldn't be your first proyect
lmao
lmao
how i can do that with a npm?
wtf is that
glitch icon
so if I do my play command with this code https://cdn.lumap.me/6hlrktfn.png (args exists), it returns that there is "no data" in the console
why
dafuk
its broken
gonna restart my node
idk if its the same thing, but i found this https://www.npmjs.com/package/glitch-canvas
so yea, i think im gonna use this netdata thing. seems i can configure and customize the charts/graphs/gauges etc as i please. and it uses bootstrap and fontawesome (which i have used for years) so quite happy to have something else that uses those π
@chinesesymbolnameguy (@modest maple)
Well read the docs
@unique nimbus peter i agree but sometimes people need a person to explain to them im not defending them or telling u to spoonfeed but maybe try and explain
or do they not know their languages
cos thats another story
however asking for people to give you the code to fix the error
is not the way to go
If they want to learn they should ask "How can I do X in Y"
Then someone can help them
People needs to realise in #development nobody should spoonfeed code
to fix someones mistakes
i wish my dog ate from a spoon wth π
They can guide the person
tbh, i find it easier sometimes to just write out the code; however, i then expect the people i give the code to, to actually read the code, and try understand why mines works when theirs didnt.
that part is critical imo
^
like I totally understand if you are using YouTube to see how someone does something
they can be misleading
however to use the code
and you dont learn anything by watching them
and not understand it
i legit watch nothing on tv, but am on youtube all day listening to tech news podcasts and tutorial videos on things im wanting to learn about π
You should not copy code
so id rather read docs
Docs are fine until they are shitty
yea
i wrote a little app (emo) that is basically a semi transparent overlay window that stays above all other windows, so i can watch videos in my code editor π
if (command === "help"){
let comandos = require("./help.json")
.addField("Infomativos", comandos.test)
.setColor(amarillo)
.setImage('https://media1.tenor.com/images/b19dc42af98ef98658e28b53eec2fbfd/tenor.gif?itemid=12880591')
}
(node:1086) UnhandledPromiseRejectionWarning: ReferenceError: comandos is not defined
its ok
only image i have of it over a thing lol
idk why dont work
oh wait you did
let comandos = require("./help.json")
{
"test": "test"
}```
why are you adding a field into a required file?
your required file returns an embed?
i swear, one of these days, someone in here is gonna hit the dumbest genius idea ever and become infamous π
'omg you can do x and it does y and z too? win'
lmao ok
so?, how i get comandos.test ?
your problem is this line:
let comandos = require("./help.json")
.addField("Infomativos", comandos.test)```
whats happening here is:
did you define an embed?
you are requiring a file, and immediately trying to add a field onto the required file/module/json w.e
i dont see new Discord.MessageEmbed anywhere
shit xd
so when your calling addField with comandos.test, comandos is never fully defined, cause your still adding onto it
hence:(node:1086) UnhandledPromiseRejectionWarning: ReferenceError: comandos is not defined
@hardy vector is not the problem
let comandos = require("./help.json");
let embed = new Discord.RichEmbed();
embed.addField("Infomativos", comandos.test);```
he never did rich embed
is more likely what you want to be doing..
- requiring the tile, creating an embed, and then using the file data to add a field into an embed
and rich embed is for v11
yea buts hes trying to add fields π
ok, well MessageEmbed for v12
yea
i found some bot that was made just for searching the djs docs and its such a joke
the entire bot runs on 10 lines of code
i made my own one with node fetch
so stupid
i doubt its 10 lines
ok more like 20
but
my version was 20 lines
so
and the bot literally does the same thing tho
so have you guys heard of deno
the new JS, and TS runtime built my nodejs fouder
*founde
*founder
i cant type
yes, we have heard about it
ok
ur right tho
i personally hate denos module system
a domain dies and uwu oops all ur code is dead
technically deno is still bot related since its also a js runtime maybe someday we make bots with deno and not nodejs
lmao
i guess thats the only negative thing i can say about it
having the module ecosystem centralized may be bad because privacy and capitalism and idk what the complaints are but at least its reliable
yea
and also that existing modules gotta do extra shit to work with deno
idk why but this work
if (command === "help"){
let embed = new Discord.RichEmbed()
.addField('InformaciΓ³n', comandos.informacion)
.setColor(amarillo)
.setImage('https://media1.tenor.com/images/b19dc42af98ef98658e28b53eec2fbfd/tenor.gif?itemid=12880591')
message.channel.send(embed)
}
so I made this, but the bot says "Now Playing: undefined" and no sound plays https://cdn.lumap.me/n2nd3hff.png
(my song is never gonna give you up of course)
this=client
@tight plinth Have you tried logging ...songs[0].info?
Then it's not in this guild
I was never able to ping it , but other people were able
gan u giv us bot id?
How can i get it
https://cdn.lumap.me/3jl2zuz2.png well its here
try doing <@id>
it should ping your bot
see
Common prefix
ik , im okay with not using it here , but i dont know why it says that its offline
when i search it , it says online , when i click on it , it says it offline
weird
if you click on the bot , it says itsoffline
oh
for me it says that its offline
i tried reloading the page too
oh , now its back
how to get playlist info with shoukaku
website sucks I guess?
Probably a caching issue
and for a issue like that you can go to #general
read channel topic
(@twilit rapids heres a bot with ur pfp)
@steep arrow yeah those numbers are not right. But I found out the numbers on your profile are always up to date
Timo Music
yes if you don't update it it won't change
Refresh status
caching things
maybe I don't get you but if you set a status as js ${client.users.cache.size} users it won't update automatically
isn't rebooting enough?
probably it is
but idk what the problem is, I don't know much about those whole caching thing
if that's the problem, then yea
you need to smh js let users = 0; bot.guilds.forEach(g => { users += g.memberCount; }) that would work
and then use users
variable
@steep arrow
^
but that will 99,9% sure not give the right amount
for example, popular bots will be in more than 1 guild so they will be counted more than one time
idk another proper way tho, as I don't have a large bot and am not using users size
users += g.memberCount
I know
that appends into the value, so example js let cash = 182; cash += 18; console.log(cash) // returns 200, int
yes but if Mee6 is in guild 1, than users = guild1.memberCount
then, it will add the membercount of guild 2, and Mee6 could be a part of that memberCount too
then you can map to only look for users
well in <client>.users#size has the bot itself too
I'm currently implementing music commands into my bot and I have made 3 commands so far (play, skip, and stop). But when I try to use ?play (song link), my bot tells me I must be in a voice channel (which I am)
play.js:
function plya(connection, message) {
var server = servers[message.guild.id];
server.dispatcher = connection.playStream(YTDL(server.queue[0], {filter: 'audioonly'}))
server.queue.shift()
server.dispatcher.on('end', function() {
if (server.queue[0]) play(connection, message);
else connection.disconnect();
})
}
exports.run = (client, message, args) => {
if (args[1]) {
message.channel.send('Please provide a link');
return;
}
if (!message.member.voiceChannel) {
message.channel.send('You must be in a voice channel')
return;
}
if (!servers[message.guild.id]) sevrers[message.guild.id] = {
queue: []
}
var server = servers[message.guild.id];
server.queue.push(args[1]);
if (!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection) {
AnimationPlaybackEvent(connection, message);
})
}
yes but human users an also be in more than one server with the bot. That doesn't solve it
@earnest phoenix I don't see guildMember.voiceChannel in the docs https://discord.js.org/#/docs/main/stable/class/GuildMember
so it's always false
well theres another way then just do loop in guilds and loop in bot.guilds of users
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([!+[]+!+[]]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[!+[]+!+[]]+[!+[]+!+[]]+(+((+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+[+[]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+!+[]]])+[])[!+[]+!+[]]+[+!+[]])()
this equals 3! that is all.
no you don't get me. Anyone could be in more servers with the bot. If the Mee6 owner counts his users by adding memberCount to it every time, I will count as 4 or something
i mean
and of course, you can ignore that fact as a bot owner but it won't be very precise
like loop bot.guilds { loop guild.users { if user is already added } }
wobt spoonfeend
Users are only cached users tho
Can you show some code.
The only way to get true numbers is memberCount, which you cant filter
yes that's a nice solution (are guild.members always cached?)
Also looping every member is highly inefficient
And no
Not every member is cached
guild.users doesn't exist btw iirc
this shard down servers reducing the number WTF anormaly
thats how i get my counts
help t
<Guild>.memberCount returns the total amount of members in a guild according to the API which is going to be your best shot if you want the exact amount.
idc if it isnt a full counter π
why are you guys even doing this?
yes but the problem is @sudden geyser, that it isn't very precise if you want a a total user amount
nobody cares how many users your bot has
like literally no one cares about that shit
^
How is it not precise?
nobody cares how many users your bot has
@copper cradle yes idc about my own bot but can still help others with it
zSnails it's just fun to have for stats.
my bot has like 140k users, but thats totally irrelevant as only like 8 people use it π
well then why do you care about precise numbers then?
if Mee6 wants to count its users using that code, it will count me as 4
no one checks for that
lol I'm just helping others
still
and of course, you can ignore that fact as a bot owner but it won't be very precise
@nocturne grove client.users
but it's not my intention to just tell them half working code
@lyric mountain yes but it has to do with caching
well, that's a drawback of djs
tbf, any large scale app that doesnt cache things is wasting resources
Like I said you can just loop over the guild and add up the memberCount number prop to get a more accurate number.
heck, i cache things in my shitty little mongo database for my bot
@sudden geyser except if a user is in 2+ guilds
it makes sense to have a cache for things. no point arguing about it π
depends on the situation what is more accurate tho, memberCount loop or client.users
Correct!
the new guild member gateway intent is there to deal with caching
and if guild.members isn't complete too, there is no exact way I think
https://cdn.lumap.me/umc6lly4.png so I got playlists implemented, but playlists doesnt play any sound, while normal search does
dude, just get a database, and check yourdatabase for how many actual useers you have if you want 'accurate'
all other means of getting counters from discord are always gonna be inaccurate
as not all guild members give a shit about your bot
chances are, 1-5 per guild care
if that
I don't want anything in my bot about this. And why should someone with a random bot want to have a db with all users?
xp module
yes, but as I said, not everyone
not all users, but the ones who actually use your bot. that is the most important counter after all
your bot could be in every server discord has, but if no one uses it, its a waste of every slice of time spent, and every possible method of calculating user counters
totally depends on what you want. My vision is that people only want to flaunt with their users size so the number should be as high as possible
yea, people love inflated numbers.. a dude in here admitted the other week to inflating server count to try get bot approvval π
in my opinion, counting your bot's tickets/counters/leaderboards/giveways etc. is much more interesting
discord denied him, cause it was obvious af what he did lol
π
yea, get a leaderboard, thats a good means of keeping track
daily message/activity counters
and if you want to flaunt with something, guild size is okay I think
log who votes for your bot
rn my inventory command sends it like this
sword
sword
fishing rod
sword
how can i make it so that it sees if there is multiple of an object
and says (3x) Sword
oh that's not what I meant but could be :p
i use quick.db btw
add (x3) before the word Sword? π
rn my inventory command sends it like this
sword
sword
fishing rod
sword
how can i make it so that it sees if there is multiple of an object
and says (3x) Sword
@hardy vector use an object instead of array
no lol i want it to check
yes but he can't count everything himself @neat ingot
read above
idk quick db sry π¦
dude
idk too
but the logic is gona be something like:
get data from database
show data from database
does it look like mysql?
your already getting data i guess to show the inventory
umm no
okay srry then
just get the items into an array, then use itemarray.map(item => counter)
so surely there is a property that donates how many of an item a person has?
no it just uses sqlite
oh it's not that hard I see
hes storing the items individually, and just has to iterate over them and count
yea its sqlite wrapper
but I still gtg, cya
u learn no sql
i like it bc its easy
learn sql its not hard anyway
can you use SQL with discord.js?
SELECT i.name, (SELECT COUNT(i2.id) FROM items i2 WHERE i2.id = i.id) AS amount FROM items i
yes
obviously
holy shit SQL be looking like english
const items = ['sword','sword','rod','sword']
const item_object = Object.create(Object);
items.forEach(item => {
if (!item_object[item]){
item_object = 1;
} else {
item_object++;
}
})
SQL IS ENGLISH
dunno if that helps any. but if you have an array of objects, that demonstrates how to count the number of duplicate elements
but this is my items variable js let items = db.get(message.author.id)
const items = ['sword','sword','rod','sword']
const item_object = Object.create(Object);
items.forEach(item => {
if (!item_object[item]){
item_object = 1;
} else {
item_object++;
}
})
@neat ingot why not simply use map?
idk how to use map is it hard?
because for each is easier for nubies to comprehendo π
ah
oh lemme copy code you wrote
lmo
lmao
can you use the object thing inside an embed .addField(ietms, item_object)
jesus
yea, as long as you reference it properly. for example:
embed.addField("Sword", item_object.sword)```
for (let i = 0; i < bot.guilds.size; i++) {
console.log(i + " only OGs remeber this");
}```
const removed_dups = [...new Set(array)];
i like using that for removing duplicate elements from arrays
but idk if there is a nice shorthand for counting dup elements
that code you sent earlier is the shortest one can get
f
const counts = arr.reduce((acc, value) => ({
...acc, [value]: (acc[value] || 0) + 1
}), {});
``` found that on stackoverflow. which is just all kinda crazy complex π
or you could filter it too i guess
const counts = arr.filter(e => e === "sword").length;```
ah, the reduce
so I made a really simple play command using shoukaku, but I have a problems with playlists: when I add then, they got added to the queue, but songs dont play at all (BUT songEnd events are triggered) wtf
here is code
const node = this.shoukaku.getNode();
let data;
if (urlcheck(args.join(' '))) {data = await node.rest.resolve(args.join(' '));} else {data = await node.rest.resolve(args.join(' '), "youtube");}
if (!data) return console.log('no data');
if (this.shoukaku.getPlayer(msg.guild.id)) {
if (data.type === "PLAYLIST") {this.queue.get(msg.guild.id).songs=[this.queue.get(msg.guild.id).songs,...data.tracks]}
else { this.queue.get(msg.guild.id).songs.push(data.tracks[0])}
} else {
if (data.type === "PLAYLIST") {
this.queue.set(msg.guild.id,{songs: data.tracks})
} else {
this.queue.set(msg.guild.id,{songs: [data.tracks[0]]})
}
}
const player = await node.joinVoiceChannel({
guildID: msg.guild.id,
voiceChannelID: msg.member.voice.channelID
});
const cleanFunction = (param) => {
console.log(param);
this.queue.delete(msg.guild.id)
player.disconnect();
}
player.on('end', cleanFunction);
player.on('closed', cleanFunction);
player.on('error', cleanFunction);
player.on('nodeDisconnect', cleanFunction);
await player.playTrack(this.queue.get(msg.guild.id).songs[0].track);
await msg.channel.send("Now Playing: " + this.queue.get(msg.guild.id).songs[0].info.title);```
rip formatting
fuck formatting
@tight plinth Shouldn't it be ...this.queue.get(msg.guild.id).songs?
where
if (data.type === "PLAYLIST") {this.queue.get(msg.guild.id).songs=[this.queue.get(msg.guild.id).songs,...data.tracks]}
Currently it's songs = [songs, ...tracks], which results in [[...], ...]
from the looks of your code the duke is correct
Yea
lemme try
where can i get dbl web hook?
what do you mean where can you get one?
thx for noticing me of this
nvm
but it doesnt solve my problem
Can someone plz help me
3|start | 2020-05-13 12:43:05.377 WARN 25700 --- [ parallel-2] s.n.m.impl.connections.AudioWebSocket : Connection closed due to [4006 SESSION_NO_LONGER_VALID] Session is no longer valid.. This could indicate an issue with the magma library or your usage of it. Please get in touch. https://github.com/napstr/Magma/issues
3|start | 2020-05-13 12:43:05.377 INFO 25700 --- [ parallel-2] s.n.m.impl.connections.AudioWebSocket : Closing```
In this error
on the dbl website, you can define which path and url to use for your webhook, but you still need to have a server somewhere waiting to recieve calls
They told that their is no issues with magma
that only leaves 'your usage of it' then π
Means
idk though dude, i've never used any audio processing libs π¦
could be a super common error around these parts π
shoukaku probably best in js
still doesnt play anything
shoukaku is an audio processing lib right?
Bt I am using lavalink
It only fails for playlists?
yes
oh wait
now it does too for regular songs
yay
depression time
I already solved this issue 2 times now
and its still broken
I checked, this.queue.get(msg.guild.id).songs[0].track exists
so...
(node was booting up)
(lemme retry once again)
Reason: No reason π
nope, still nothing
and nothing in logs too
ly lavalink.jar logs
hmmm
did someone have already encouter this error
java 14.0.1,ubuntu
The maintainer of Lavalink recommends using Java 13 https://github.com/Frederikam/Lavalink#requirements
how to install java 13 to ubuntu then
java 14 is extremelly nightly atm
I git guides for java9,11&14, but not for 13
most people still use 8, I'd recommend 11
why please
why please
@earnest phoenix show code
@lyric mountain
you forgot a )
ok thanks
see where the error marking is
Error console at the bottom literally telling you what the error is and how to fix it
never EVER let a red underline stay unfixed
red means error
if you hover your mouse over it it'll tell u what's wrong
you can sometimes
ok I begin sorry
something the ide decides to be fucky but it works fine when you compile manually
okay I have a little question and until now I haven't got a real clear answer, so I'm asking again:
const messageContent = await require('./file1.js').execute(message);
message.channel.send(messageContent);
// the file1
module.exports = {
execute(message) {
message.react('π');
return message.slice(2, 2);
},
};```
Imagine I have something like this (this is total nonsense) and the bot can't react to the message with the emoji. Is there a way to stop the execution in the first file if file1 gives an error like 'cannot react to message'?
(This is just an example, I know I could've checked permissions first in this example)
something the ide decides to be fucky but it works fine when you compile manually
@topaz fjord well, that's why I use intellij
intellij is also fucky
new type inference algorithm apparently borked some people's projects when compiling using intellij
okay I have a little question and until now I haven't got a real clear answer, so I'm asking again:
const messageContent = require('./file1.js').execute(message); message.channel.send(messageContent);// the file1 module.exports = { execute(message) { message.react('π'); return message.slice(2, 2); }, };``` Imagine I have something like this (this is total nonsense) and the bot can't react to the message with the emoji. Is there a way to stop the execution in the first file if file1 gives an error like 'cannot react to message'? (This is just an example, I know I could've checked permissions first in this example)
@nocturne grove check the perm beforehand
but command line build worked fine
there's no other way, except by using try-catch
tfw quotes can't handle code blocks
new type inference algorithm apparently borked some people's projects when compiling using intellij
@topaz fjord what?
tfw quotes can't handle code blocks
they can
@lyric mountain I just said this was just a stupid example :/
well, my answer will be the same
in my implementation it's not about discord perms either
so why don't u show the real case?
but that doesn't matter for my question
not on mobile then
https://www.reddit.com/r/androiddev/comments/c5gzyz/psa_new_type_inference_algorithm_is_enabled_by/ this is what I'm talking about
105 votes and 14 comments so far on Reddit
because that doesn't make sense and I did sometimes again and that didn't get answered the way I meant
yeah it can be fixed but it's still annoying that you have to do it manually
You could also throw an error inside your called method and handle it in the calling method or return something alongside/other than the message
which is what I answered as second option
oh sorry I didn't see your second answer
How can i learn an emoji creator ? (V11)
@nocturne grove when you call require('filename') this is a syncronous process. this means that nothing else will process until it has finished loading. no single line of code after that can cancel the loading of it.
oh, i think i was scrolled up? rip
oh sorry I meant to use await for that one
sorry if you got answer already π
no you're right but I just forgot to do that in the example
Any1!?
What is an "emoji creator"?
You could also throw an error inside your called method and handle it in the calling method or return something alongside/other than the message
@hasty sparrow yes so just return 'thisIsANiceError' and use a linejs if (messageContent == 'thisIsANiceError') { return message.channel.send('was an error'); }
Already thought about that but hoped for something without using an extra line.
Thanks tho, all
please reword your question @earnest phoenix
@hasty sparrow *author
isnt it just emoji.author or emoji.user or something?
ninjad π
@hasty sparrow yes but I can handle the error in the 'function' file itself
when I catch an error there, I can do:
console.log(err);
return 'somethingThatMeansError';```
A callback-ish approach might be cleaner, where you return an object like { err: Error, message: string }
lua ooft
ye
sublime text ~ooftx2
strange that your lua files are showing sublime icon π
I have each bot command separated into its own module and I require all of them in the main script, but they use functions in the main script and they return nil when used
he probably sat it himself
how can i set classification of a role in jda ?
guild.createRole().complete().getManager(). ?
isn't there a way to make it so a required module that loads after functions are declared, automatically uses the functions
guess that would depend on the scope of the functions
idk enough lua to be of any real help tho π
-- main script
local function x()
end
require(module)
-- module
x()
requiring a module after a function has been declared does not recognize the function
in javascript it'd be as simple as passing the loaded functions to the newly loaded module
nah probably not in that case, as the required module has its own scope seperate from the local
again, idk much lua, but isnt it possible to just pass the function to the module? for example require(module)(x), where your required module returns a function that you call and provide the function arguments
problem is the functions needed vary lol
heck, you can probably pass the entire scope into the required module too, something simiimlar in javascript might be like:
require('modulename')(this);
// in module:
module.exports = function(scope) {
}
even if they vary, they all have to be defined within the main script, right? then used within modules?
just define them within some class or namespace and then pass reference to the object to your new required thing?
const MyNameSpace = Object.create(Object);
MyNameSpace.x = function(){
return 'I AM X !!';
}
require('modulename')(MyNameSpace);
// in module:
module.exports = function(namespace) {
console.log(namespace.x());
}```
something like that perhaps?
again, no idea if that kinda thing is even valid in lua π
3|java | WARNING: An illegal reflective access operation has occurred
3|java | WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (jar:file:/home/lumap/lavalink/Lavalink.jar!/BOOT-INF/lib/xnio-nio-3.3.8.Final.jar!/) to constructor sun.nio.ch.EPollSelectorProvider()
3|java | WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
3|java | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
3|java | WARNING: All illegal access operations will be denied in a future release```does anyone have ever got this issue with lavalink & java 11?
it doesnt stop my bot to run music or anything, its just here
what is an illegal reflective access?
i'd try to google around and find out what that means
what if its like, you know how come youtube videos cant play in some countries? maybe its to do with that?
I have no idea
ngl: thats gibberish to me
lol
makes it sound pretty hacky lol
seems its a java thing though, so certainly not my thought about it being caused by videos not being able to play in certain countries π
Hey guys, can I send a private 1 use invite to people that signup on a form?
client.on('guildMemberAdd', (guildMember) => {
guildMember.addRole(guildMember.guild.roles.find(role => role.name === "member"));
})```
no errors and it didnt add the role
Can't make private invites
parameter is member
member.user can able to add role
@hasty sparrow why not?
Ask Discord Β―_(γ)_/Β―
@torn nebula what?
it's member not guildMember
client.on('guildMemberAdd', (member) => {
member.addRole(guildMember.guild.roles.find(role => role.name === "member"));
})```
so that
member.user.addRole
client.on('guildMemberAdd', (member) => {
member.user.addRole(guildMember.guild.roles.find(role => role.name === "member"));
})```
try
@hasty sparrow what do you mean? You can
iam im waitng fr someone to join to test
it doesnt matter what you call your variable, weather its member, guildMember, or lazypolicedog.
its still going to be the same object, with the same data
you just referenced it differently.
@lapis ocean Maybe I misunderstood what you meant with private
@hasty sparrow I just mean a 1 time use invite that is delivered privately to an individual.
Ah yes, that is possible
How would you suggest I achieve this?
I see 2 ways, not sure if both are possible.
- Pre Generate a list of 1 Time Use Invites. And when someone signups on our website we send them 1 of those.
You pretty much said it yourself, create the invite with limited uses and send it via DM
@hasty sparrow can't send a DM if they are not on our Discord server already
Especially if they are not even on Discord to begin with
Solution 2. Somehow make the form communicate with the bot, and somehow make the bot send an email to the user
still doesnt work @torn nebula
I am not the most genius, and I am not a developer. So I know there must be a better solution.
No way I came up with the best solutions in 5 minutes of thinking.
Actually I just busted my brain building a bot with a whole different solution to this.
And now just realized that there are 1 time use Invites.
So I kinda wasted my brain cells lol
You would have to update the list of available invites whenever a user receives one through the form
That's with solution number 1.
Not elegant at all. It would be more elegant to generate the invite in real time. But maybe less stable, because then I am dependent on the bot (more moving parts). If the codes are pre generated indeed the bot could be offline as long as the form works everything is fine.
Solution 2 may be overengineered
Bro, I just built a very overengineered bot for this
Busted my brian for 3 days
Look what I built. And I don't even know how to code basically.
So I made a bot that: 1. Sends a PM to the new user once he joins.
- Generates a link with his userid as a query string parameter.
- Made a form that catches this userid parameter.
If you already have a working solution, then what are we even discussing rn lmao
- The form sends the iid as a Webhook to discord.
- The bot catches this and assigns the role.
A working solution for what?
It's a stupid solution.
I spent 3 days and built something really retarded.
Better a stupid one than none at all
I had no idea invites could be limited by number of uses.
But it's not elegant because the user must join Discord first.
sounds familiar
I spent days writing code to tear apart a tag as a string to pull out the integer and restring
It's really hard for me because I don't code.
without knowing i could pull the mention
LOL, I am doing stuff like that all the time because I have no developer experience, and miss all the time simple solution to problems
And try to come up with some convoluted way to solve it.
its just the normal learning curve though
that sthe fun of coding
you look back at something you wrote a month ago
and crunch it into 1 line
Yeah well, it was fun, and painful as well.
Generally anytime you see an indefinite repeating variable or condition
there is a smarter way to code it
and writing that line of code feels great
So I guess I will generate a list of 1 time use Invites for my server, and deliver them to people that signup on the form
I think this time it was better that I just showed you my real code implementation (https://discordapp.com/channels/264445053596991498/272764566411149314/710504276379828245), as the function file includes a promise. I now found it I can reject a promise and the code underneath the await 'theFunction' will never get executed. But is that a proper way? Or will it forever wait instead?
are socket hang ups a client or server issue?
are socket hang ups a client or server issue?
@near ether both
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'discord.js-commando'
Require stack:
- C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:1:28)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\xAutentiqz\\Desktop\\Discord Bot\\index.js' ]
}```
any fix for this?
Same issue as earlier today
well seems clear, it can't find that module
Install your modules
np
extract:discord.js-commando: sill extract discord.js-commando@github:discordjs/Commando extracted to C:\Users\xAutentiqz\Desktop\Discoord-Bot
why is it stuck on that
when i download commando discord
give it time
use npm to install packages
wait
[Node.js] With the canvas-constructor, how can i add a custom text font? Can you show me an example code?
looks like you download and extract to your bot folder
[JavaScript] With the canvas-constructor, how can i add a custom text font? Can you show me an example code?
@balmy knoll javascript or node?
@lyric mountain node.js sorry
just require the font .ttf file
require it then
Yes wait
let mage = new Canvas(500, 250)
.registerFont('https://cdn.glitch.com/.ttf file link', 'Notosans Black')```
This is the code that i'm using
ain't that working?
With the canvas-constructor
you can use example
.setTextFont('28px Impact')
Yes but i want use a custom font @torn nebula
@rotund prism you may have to over complexify who and how you are removing the role, like maybe having the roles be made into numbers, like 1 being starnger, because sometimes things just have to be brought up to the system in a new perspective.
what?
sorry i was talkign to someone that was a few hundred messages up
it's fine now, i've fixed it. it works perfectly fine. i was looking to try to make it into role id's
ok cool
@lyric mountain Ok, but i didn't get the right font, the bot use a font that it isn't Notosans Black
I know this. But if i have to use the Notosans Black font, i have load it somewhere?
the registerFont method will register that font for that canvas object
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node index.js
internal/modules/cjs/loader.js:1170
throw err;
^
SyntaxError: C:\Users\xAutentiqz\Desktop\Discord Bot\config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1167:22)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:4:27)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)```
any fixes?
your config.json file is wrong
oh ya i see the problem
hey tim, do you know why node's readFile() would return a different buffer/string for a file that hasnt changed?
wait what
what
https://oliy.is-just-a.dev/iycrdc_3916.png this file isnt changing yet the size differs sometimes
fs.readFile(name, {encoding: "utf8"}, (err, data) => {
if(err) return console.error(err)
console.log(data.length)
})
hi I have no knowledge about programming whatsoever, I don't have any code why isn't botum on?
honestly i have no idea why data.length would be different
I'm on windows if that makes a difference
Ik filesystem is different on windows
it seems like whatever data was missing in the first read was added on the second read
cuz their file api
has to be because the file is really large
https://oliy.is-just-a.dev/by0gu_3917.png because this works
Anyone, how do I embed a video via video URL(using discord.js)?
is there a way to read past a certain point?
use substring
Anyone, how do I embed a video via video URL(using discord.js)?
@sage wigeon you don't
;_;
you can't put videos on embeds
Well that puts a hole in my plans but ty nonetheless.
lmfbao
@amber fractal yes there is a way to read only a part of the file, but its complicated
I'd still need all the data too
which is the issue it seems
also it's a .log file as well
any way to read those differently?
if you need all the data but not at once, use a readableStream
you can also use readline
I just need to get new lines from a file as they enter the file
this may work
looks cool
lol
well it is 8 years old
@amber fractal https://www.npmjs.com/package/tail
lol
how does shard works with shoukaku?
it seems to return everything in the file even with fromBeginning set to false
Do you guys think it's better to upload images on an external service (example: imgur) instead of hosting them on your server?
yeah
way better
at some point you'll have to buy a better plan
unless you've got a 10PB storage plan
which I highly doubt
bc of the price
yeah I agree on that but what I meant was: let's say I am making a website and I want to have a few images, it's a possibility to upload the image to imgur nd then just reference the imgur link or I can host the image where the website is hosted
anonymously uploads image to imgur
if you want performance, upload them to your website
only reason to use an external service is if you're gonna have thousands of user-generated content
how can I easily convert"1m 52s" to miliseconds
112 * 1000