#development
1 messages · Page 667 of 1
What os are you on
MacOS
mac os
OS X
ok then
I figured it wasnt windows. Folders with forward slashes 
microsoft thinks backwards
also is that monokai pro? @lost bramble
well I use both, I'm just on my macbook rn because I'm away from my desktop
hmm
what the environment?
the theme
oh, I forget. I think I downloaded one and changed some of the colors. I like the calming blue and dark vibes
lol
for when times like this arise and I don't know how tf to fix something
you can use the chown command to change the owner of those folders
@fossil oxide Please help brother camnaz
that should fix your problem
what should??
changing the owner of those folders
how do I do that
/Users/cnazarko/.npm-packages/lib/node_modules/
sudo chown -R cnazarko /Users/cnazarko/.npm-packages/lib/node_modules/
Also, .npm-packages isn't what npm uses by default... how did that happen lol
maybe he changed it?
ahh, that's prob why this error happens lol
or maybe the magical goblin from my closet changed it idk
when npm was first installed it should've configured permissions properly for its normal installation location
yes
alright, I inserted that line of code
hazah
added 1 package 1 from 1 distributor instead of error messages
send pic of the console
still giving me tsc unknown
bruh
do you want to screenshare?
yeah why not
b r u h
We can pick this up later if you're still active
I'm just trying to get this damn bot up and functional so I can start learning more complicated stuff
yah that's ok
alright
I'll do the same thing on my windows computer and see what happens
ok
I may have fucked up something and downloaded uneccesary stuff that is causing problems. I may have to backtrack but we shall see
yeah
i cant edit my server
you cant do anything about it except report it to whoever made what you're trying to access
Yeah
it's a server error
on dbl's side
okay
Usually gets auto fixed in about 5-10m
who can help me plz i got a json variable with a - and i don't know how to use this variable
what
@opal copper what language? if its javascript use json["i-am-value"] to get it
oh ok thx that's what i needed
how can i display guild count on my bot's page?
how can I get something from a json file in python? (sry I'm new to python)
open it, use json module and then json.load the open file
someone know python and can help me please?
i changed the location of the code and now the code cant import discord.py
please
My old bot can't stay up for more than a couple minutes. That's even worse than usual. One by one the shards are missing the heartbeat and disconnecting, am I the only one with issues right now?
On join message that includes support server link. Is that bad? Unsolicited advertising?
yes
Okay, well I'm in a bit of a problem, using my friends server I have access to it when I go and start the bot using pm2 it will show as started but won't come online and when I do pm2 logs process and it will show up empty not even the console logged stuff in the ready event
Afraid I can't provide much more info
I get 0 errors
Funny thing is it went offline right after it got accepted into DBL
huh
Told you it comes back completely empty
are you sure pm2 start clap is configured correctly
Yea
It should be
It was working earlier before the bot got accepted
And after it got accepted into DBL it went offline
Nvm realized it could have been caused in other servers
can you try pm2 list
hmm odd since its online in the eyes of pm2
very odd
regenerate your bot token at www.discord.app.com and paste in the new token in your code and try again
Okay
tell me if it worked
Should throw an error though
hm, what's a good solution to bot can't send messages at all
obviously you can catch the error but
how do you let the owner know?
I have a problem , when i start the bot in my pc works command =stats http://prntscr.com/ooce1u but when i upload it on host it gives me only the error, what should i do?
}).catch(err => {
console.log(err);
msg.channel.send(`0 Users with name > ${username} <, try again with another username`);
})```
My command error
your .catch isnt the part being called
its your bot reading some value which is undefined
when is in my pc it works
hence we need the top part so we can check what the api replies and what your trying to read
ok
{
const args = msg.content.split(/ +/g);
const username = args[1];
const platform = args[2];
const data = apex.user(username, platform).then(data => {
// Stats
let level = data.data.segments[0].stats.level.value;
let hopa = data.data.segments[0].stats.kills.value;
let avatar = data.data.platformInfo.avatarUrl;
console.log(level,hopa)
// RANKINGS
let rank = data.data.segments[0].stats.rankScore.metadata.iconUrl;
console.log(rank,avatar)
// Wins
const s2 = data.data.segments[0].stats.season2Wins;
const s1 = data.data.segments[0].stats.seasonWins;
msg.channel.send(`${s1}, ${s2}`)
console.log(s2,s1);
const url = 'https://trackercdn.com/cdn/apex.tracker.gg/ranks/';
// RANKS EMBEDS
```
and down are more embeds
and clicked save?
The thing was buggy
It finally saved properly
Okay no longer get that error
My friend added in some logs to see where the code stopped
But every console.log before and after the client ready event triggered
The logs inside the client ready event didn't
Here are some screenshots of the code
You don't initiate the client as a variable
client = new Discord.Client({shardCount: 'auto'})
This line
It needs to be const client ...
❄
?
Hi
What's your updated code
Oh and follow the stacktrace
Doesn't make sense though
Yeah you need to wrap that entire thing in a module.exports = (client) => { ... } function in order to use the require('./library/db_game_functions.js')(client) line in your clap.js file
Yeee
I see where the error is though
The line just above module.exports
You try to reference client without defining it, as the error stated
Move that line inside the module.exports function
let cdSeconds = client.settings.cdSeconds
move that ^
Yw
require('./library/db_game_functions.js')(client)
This should work no?
require('./library/db_functions.js')(client)
These two don't error
Just the db_game_functions one
Guys
I know
HTML
CSS
Python
Do those have anything to do with developing a bot?
Yep
If you decide to use async branch, I have a github repo that ima be working on to provide things for that area that it doesnt have
Eg NSFW channel recognition, nitro boosts, etc.
Ok
Sure
I still can't figure.this error out
require('./library/db_game_functions.js)(client)
It only errors on that one and not:
require('./library/db_functions.js')(client)
Which is before the game_func one
Okay nvm fixed that error but the bot still won't come online
I want to contract in one embed and replace true / false to Active / inactive
ping me for respond plz ;;
Damn no one can seem to help me oof
hi
Hi
Presently trying to fix a bot 😂
Say I am a moderator of a server, but the admin has had his account terminated and we cannot add a new bot to the server but I have coded a bot.
Is there a way to invite a user to a server and get the bot to make use of that user's token and act as a bot under an account not claimed to be a bot?
Self bots will get your account terminated
and if the only admin/owner had his account terminated and no one else has access he can request ownership transfer I believe
Since when 
I've seen it done 2 weeks ago someone raided the ice wall with a botnet of over 50 selfbots
discord used to be like "no we dont encourage selfbots but we still allow them for some reason" and now they're like "fuck it we'll ban any selfbot we see"
why do they still allow it to happen
OK what do I need to do?
uh
Shouldn't be an issue if it's just to display memes and apply roles
on one server
doesnt matter
You don't get it
it's still against tos
We won't help you make a self bot
the bot you're adding the server to is probably gone lol
since nobody has admin perms
The bot I have coded is on my linux server.
The discord guild is alive and well with 32,000 members.
The old bot got taken down by the old botmaster because of drama etc.
The owner of the guild has been AWOL for a very very long time, we think the account got terminated a bunch of ours did a couple of months ago we haven't heard from him since.
We need a bot to manage roles and memes on the server and we can't add a bot to the server using conventional means.
Can't someone request ownership?
What's the procedure for requesting ownership?
@KittyInori @ZZZZ77701 If the current owner has been inactive for 30 days you can put in a request to transfer ownership of the server. Just email support@discordapp.com for help!
¯_(ツ)_/¯
^
Can anyone help me to filter 10 strings to find something?
nodejs?
yes
Are the 10 strings in an array?
yes
i just wanna know what i do wrong in this line const wins2s = data.data.stats.filter(x=> x.key == "Season2Wins")[0]
what's the name of your array?
Season 2 Wins
I wouldn't do it that way
it's name: 'Season 2 Wins',
it's better to use the name for the filter?
I would do var wins2s = [];
instead of filter()[0] why not do find()
then do wins2s = data.data.stats;
then do for (let i in win2s) {
if (win2s[i] == filter) {
DO SOMETHING
} else { DO SOMETHING DIFFERENT}
}
yeah sorry var
let will work fine too
@tight heath with find() results undefined
so use indexOf instead it's a string
i will try @earnest phoenix command
you can also use contains or content
includes sorry
That's how I did a "link" detector
@earnest phoenix also you're calling an element of an array of somethign that isn't an array
@earnest phoenix then you're querying wrong
What's the structure of an element in that array?
you can do that with console.log(data.data.stats)
You have a generator meme api pls ? (Sorry, I speak french)
I get these two errors
I have db defined so idk why it says I don't
And as for log_toggle I don't understand it
Code?
That's for the db functions file
Which the log_toggle is also originating from
Though I have an idea of where log_toggle error is actually originating from
@cursive dagger there's my code UwU
https://paste.nomsy.net/wudiwumeye.coffeescript
This is where I think the log_toggle error is originating from
@tardy viper change all your promises to the await version and add fields to the embed with them
and only send one message at the end
Sorry i don't understand 😂
// change this
asyncFunction(something).then(result => {
embed.addField("title",result);
})
// to this
let result = await asyncFunction(something);
embed.addField("title",result);
so that you can do this ```js
let result1 = await asyncFunction1(something);
embed.addField("title1",result1);
let result2 = await asyncFunction2(something);
embed.addField("title2",result2);
let result3 = await asyncFunction3(something);
embed.addField("title3",result3);
channel.send(embed) //run all functions, add them to the embed and then send all at once
it doesnt matter, you can test them differently after you get each result
whats important is that you get the result into the same scope, so that you can add them in sequence
if you use the .then() version, then you are creating a separate scope for each result, and wont be able to join them into a single embed
Just i could not use inUse more than one use
you can, or rather, you dont need it
I want to use this
if (inUse = true) inUse = "Actif"
if (inUse = false) inUse = "Inactif"```
//old
tcpPortUsed.check(80,'46.105.84.218').then(function(inUse){
//use inUse here;
})
//new
let inUse = await tcpPortUsed.check(80,'46.105.84.218')
// do something with inUse;
inUse = await tcpPortUsed.check(27056,'46.105.84.218');
// do something with the next inUse
How tk use this bot to other chanel?
@quartz kindle I am testing just when i want to start
ReferenceError: message is not defined
and when its channel ReferenceError: channel is not defined
show your code
what did you put there to show undefined?
if your inUse is either true or false
you can do inUse ? "active" : "not active"
which means if inUse is true, return "active", if its not true, then return "not active"
i have maked that
and not work 😂
@quartz kindle You was in mode this person is big noob
return exits the function
so if you use return there, you're stopping and exiting the entire function
How i can do this ?
also, = is assignment, not comparison
inUse = true, makes inUse become true, not check if its true
let inUse = await yourFunction();
embed.addField("title",inUse ? "active" : "not active")```
👍
big brain Tim
@quartz kindle Just how add emoji to this embed
embed.addField("Activitée : ",inUse ? "Actif :actif:" : "Inactif :inactif:"); ```
and not work
Nooo i have found sorry for the ping 😂
Hello
I like to start a web project
But i don't know where I start
Visual Studio Code or Glitch?
what kind of web project? a website?
you can start a local project on your own computer, without a host
yes for example
@quartz kindle Just do you know how i can make the status embed refresh and create in a status channel automatic at the start of the bot ?
simply just edit embed to refresh all after 5 seconds
What do you need?
Refresh embed all 5 seconds
embed of tcpPortUsed
@tardy viper you can use setInterval and message.edit
probably in the ready event
that
you want it to be on bot start, or on command used?
command used
then after the command it used, it will keep refreshing?
yess
you can do it like you are doing, but you need to rebuild your embed
What is the page that it gives you background css code
also increase the timer to 5000 for 5 seconds
you can make a function to build the embed, and then use the function
module.exports.run = async function () {
....
...
let newmessage = await message.channel.send(await build())
setInterval(async () => {
newmessage.edit(await build())
},5000)
}
async function build() {
build your embed here;
return embed;
}```
What is the page that it gives you background css code?
@real helm what do you mean what is the page?
think he meant how to get background color
@quartz kindle I don't kow
body {
background: #ee9ca7; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #ffdde1, #ee9ca7); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #ffdde1, #ee9ca7); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
Like this
like a css background generator? there are billions of them
just google "css background generator"
@quartz kindle
const Discord = require("discord.js");
var tcpPortUsed = require('tcp-port-used');
module.exports.run = async (bot, message) => {
if (message.author.bot) return undefined;
const embed = new Discord.RichEmbed()
const act = bot.emojis.find(emoji => emoji.name === "icone_actif");
const ina = bot.emojis.find(emoji => emoji.name === "icone_inactif");
embed.setColor("#ffffff")
embed.setTitle("STATUS");
let inUse = await tcpPortUsed.check(27015,'46.105.84.218')
embed.addField("__________", 'Status - PropHunt');
embed.addField("Activitée : ",inUse ? `Actif ${act}` : `Inactif ${ina}`);
let inUse1 = await tcpPortUsed.check(27016,'46.105.84.218')
embed.addField("__________", 'Status - DarkRP');
embed.addField("Activitée : ",inUse1 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse2 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Site / Forum / Boutique');
embed.addField("Activitée : ",inUse2 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse3 = await tcpPortUsed.check(90,'46.105.84.218')
embed.addField("__________", 'Lien Boutique Discord');
embed.addField("Activitée : ",inUse3 ? `Actif ${act}` : `Inactif ${ina}`);
message.channel.send(embed)
}
module.exports.help = {
name: "status"
}```
@tardy viper move the building of the embed to a separate function, so you dont need to repeat it
because you need to build the embed again, test all ports again
else you will edit the embed with the same embed
That
var tcpPortUsed = require('tcp-port-used');
module.exports.run = async (bot, message) => {
if (message.author.bot) return undefined;
let newmessage = await message.channel.send(await build())
setInterval(async () => {
newmessage.edit(await build())
},5000)
}
async function build() {
const embed = new Discord.RichEmbed()
const act = bot.emojis.find(emoji => emoji.name === "icone_actif");
const ina = bot.emojis.find(emoji => emoji.name === "icone_inactif");
embed.setColor("#ffffff")
embed.setTitle("STATUS");
let inUse = await tcpPortUsed.check(27015,'46.105.84.218')
embed.addField("__________", 'Status - PropHunt');
embed.addField("Activitée : ",inUse ? `Actif ${act}` : `Inactif ${ina}`);
let inUse1 = await tcpPortUsed.check(27016,'46.105.84.218')
embed.addField("__________", 'Status - DarkRP');
embed.addField("Activitée : ",inUse1 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse2 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Site / Forum / Boutique');
embed.addField("Activitée : ",inUse2 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse3 = await tcpPortUsed.check(90,'46.105.84.218')
embed.addField("__________", 'Lien Boutique Discord');
embed.addField("Activitée : ",inUse3 ? `Actif ${act}` : `Inactif ${ina}`);
return embed;
}
module.exports.help = {
name: "status"
}```
yes, you can try that
dont create a new client instance, just pass the bot to build: await build(bot) async function build(bot)
your bot spams the embed?
like endlessly?
do you have other .on("message") events?
@quartz kindle just how add to the bot on ready
setInterval(async () => {
newmessage.edit(await build(bot))
},5000)
async function build(bot) {
const act = bot.emojis.find(emoji => emoji.name === "actif");
const ina = bot.emojis.find(emoji => emoji.name === "inactif");
const embed = new Discord.RichEmbed()
embed.setColor("#ffffff")
embed.setTitle("STATUS");
let inUse = await tcpPortUsed.check(27015,'46.105.84.218')
embed.addField("__________", 'Status - PropHunt');
embed.addField("Activitée : ",inUse ? `Actif ${act}` : `Inactif ${ina}`);
let inUse1 = await tcpPortUsed.check(27016,'46.105.84.218')
embed.addField("__________", 'Status - DarkRP');
embed.addField("Activitée : ",inUse1 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse2 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Site / Forum / Boutique');
embed.addField("Activitée : ",inUse2 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse3 = await tcpPortUsed.check(90,'46.105.84.218')
embed.addField("__________", 'Lien Boutique Discord');
embed.addField("Activitée : ",inUse3 ? `Actif ${act}` : `Inactif ${ina}`);
return embed;
}
});```
bot.on("ready",async ()=>{
setInterval(async () => {
bot.channels.find(channelIDYouWant).send(await build(bot))
// you also need to put your build function in the main file, or require it through a module
},5000)
})```
@woven sundial can you show the rest of your code?
@woven sundial btw you should not be running multiple bot.on("message") events lul
best is always to put all your commands in a single event
setInterval(async () => {
bot.channels.find("606619807810322655").send(await build(bot))
let newmessage = await bot.channels.find("606619807810322655").send(await build(bot))
setInterval(async () => {
newmessage.edit(await build(bot))
},5000)
async function build(bot) {
const act = bot.emojis.find(emoji => emoji.name === "actif");
const ina = bot.emojis.find(emoji => emoji.name === "inactif");
const embed = new Discord.RichEmbed()
embed.setColor("#ffffff")
embed.setTitle("STATUS");
let inUse = await tcpPortUsed.check(27015,'46.105.84.218')
embed.addField("__________", 'Status - PropHunt');
embed.addField("Activitée : ",inUse ? `Actif ${act}` : `Inactif ${ina}`);
let inUse1 = await tcpPortUsed.check(27016,'46.105.84.218')
embed.addField("__________", 'Status - DarkRP');
embed.addField("Activitée : ",inUse1 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse2 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Site / Forum / Boutique');
embed.addField("Activitée : ",inUse2 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse3 = await tcpPortUsed.check(90,'46.105.84.218')
embed.addField("__________", 'Lien Boutique Discord');
embed.addField("Activitée : ",inUse3 ? `Actif ${act}` : `Inactif ${ina}`);
return embed;
}
},5000)
})```
@tardy viper dont use 2 intervals
send the message first, then use the interval with a message edit
@quartz kindle ```bot.on("ready",async ()=>{
bot.channels.find("606619807810322655").send(await build(bot))
let newmessage = await bot.channels.find("606619807810322655").send(await build(bot))
setInterval(async () => {
newmessage.edit(await build(bot))
},5000)
async function build(bot) {
const act = bot.emojis.find(emoji => emoji.name === "actif");
const ina = bot.emojis.find(emoji => emoji.name === "inactif");
const embed = new Discord.RichEmbed()
embed.setColor("#ffffff")
embed.setTitle("STATUS");
let inUse = await tcpPortUsed.check(27015,'46.105.84.218')
embed.addField("__________", 'Status - PropHunt');
embed.addField("Activitée : ",inUse ? `Actif ${act}` : `Inactif ${ina}`);
let inUse1 = await tcpPortUsed.check(27016,'46.105.84.218')
embed.addField("__________", 'Status - DarkRP');
embed.addField("Activitée : ",inUse1 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse2 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Site / Forum / Boutique');
embed.addField("Activitée : ",inUse2 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse3 = await tcpPortUsed.check(90,'46.105.84.218')
embed.addField("__________", 'Lien Boutique Discord');
embed.addField("Activitée : ",inUse3 ? `Actif ${act}` : `Inactif ${ina}`);
return embed;
}
})```
that make error
Error: Value must be specified.
i have added async (bot)
and channels is not a function
someone with python knowledge can help me understand why the part of the code is not sending the msg
may i pm it to you?
go ahead
anyone recommend any nodejs hosts that have high bandwidth allotments? My bot is blowing through our data cap it seems at home..
const prefixes = ["circ ", "c ", "c!"]
for(const thisPrefix of prefixes) {
if(msg.content.includes(thisPrefix)) prefix = thisPrefix;
}
if(!prefix) return;
why do prefixes with space just not work here
@stark beacon galaxygate has unlimited traffic
its one of the favorites among many bot developers
@viral kayak thats the thing what i want to know aswell lol
@quartz kindle Problem
@viral kayak try using startsWith instead of includes
The bot not sending on start
And the error is same when its bot.channels.find(`606619807810322655`).send(await build(bot))
@viral kayak you can also do prefixes.includes(content.split(" ")[0]) that matches prefixes without space, but works for messages with spaces
@tardy viper i'll get back to you shortly
Okai
@tardy viper remove bot form the first line, you are replacing your entire client with nothing
async () not async (bot)
sent them an email with my Q's, thanks @quartz kindle
they also have a discord server which is pretty active
@quartz kindle
bot.channels.find(`606619807810322655`).send(await build(bot))
let newmessage = await bot.channels.find("606619807810322655").send(await build(bot))
setInterval(async () => {
newmessage.edit(await build(bot))
},5000)```
@tardy viper also, dont use .find("prop","val") use .find(channel => channel.id === "yourID") but anyway if you're using IDs, dont use .find at all, just use .get("yourID")
@quartz kindle can u help me aswell?
@stray garnet your code makes no sense, what is message.c?
@quartz kindle BIIIIIIIIIIIIIG thank
@viral kayak if you send a message like !pr something, you can do ```js
prefixes = ["!pr","!34","!a"];
if(prefixes.includes(message.content.split(" ")[0]))
that will always check if the beginning of the message UNTIL THE FIRST SPACE, includes one of the prefixes
so i dont need the for then
nope
@quartz kindle Just latest help how i can add system of bot CLear channel after reboot
explain
how to remove those white lines?
Check your css and see where it might be breaking
Or maybe those white lines are just in the image itself
nothing with css and the image, idk why that would happen
Those white lines are CSS most likely
const voiceChannel = message.member.voiceChannel;
if (!voiceChannel) {
message.channel.send(':x: **I\'m sorry but you need to be in a voice channel to play music.**')
} else { voiceChannel.join()
try {
var video = await youtube.getVideo(url);
} catch (error) {
try {
var videos = await youtube.searchVideos(searchString, 1);
var video = await youtube.getVideoByID(videos[0].id);
} catch (err) {
console.error(err);
return message.channel.send(':x: **I could not obtain any search results.**');
}
return handleVideo(video, message, voiceChannel);
}}
break;```
its not playing anythink
How i can make status web in node js
@trail dagger its a box-shadow on .bot-image
const app = express();
var tcpPortUsed = require('tcp-port-used');
const server = app.listen(94, () => {
console.log(`Express running → PORT ${server.address().port}`);
});
setInterval(async () => {
app.get('/', function (req, res) {
let inUse = tcpPortUsed.check(27015,'46.105.84.218')
let inUse1 = tcpPortUsed.check(27016,'46.105.84.218')
let inUse2 = tcpPortUsed.check(443,'46.105.84.218')
let inUse3 = tcpPortUsed.check(90,'46.105.84.218')
res.send(`Serveur PropHunt ${inUse ? `Actif` : `Inactif`}Serveur DarkRP ${inUse ? `Actif` : `Inactif`}Site / Forum / Boutique ${inUse ? `Actif` : `Inactif`}Lien Boutique discord ${inUse ? `Actif` : `Inactif`}`);
}, function(err) {
console.error('Error on check:', err.message);
});
},5000)```
How i can make web with express @quartz kindle did you know ? 😂
I like to do a generator in html
@tardy viper you just did it lol
?
I know how create html
just
i don't know how use the
let inUse1 = tcpPortUsed.check(27016,'46.105.84.218')
let inUse2 = tcpPortUsed.check(443,'46.105.84.218')
let inUse3 = tcpPortUsed.check(90,'46.105.84.218')```
in the html
One message removed from a suspended account.
One message removed from a suspended account.
Using an embed you can use .setImage()
@sage bobcat https://discord.js.org/#/docs/main/stable/examples/attachments have a look at this
One message removed from a suspended account.
One message removed from a suspended account.
Ah
.setImage()
One message removed from a suspended account.
Then it would be either .attachFile, .setThumbnail, or .setImage
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Ok
@sage bobcat use .attachFile then
new Discord.Attachment("url", "name.jpg");
One message removed from a suspended account.
then in the send bit send(Embed, attachment)
Oh, Actually depends what version of d.js you're on.
For me it's MessageAttachment()
One message removed from a suspended account.
Question for the newest version of discord.py, is there a way to delete roles, I know their is a way to create roles, but i don't know about deleting them
setFile doesn't exist.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
@real helm you use java script
var copyText = document.getElementById("myInput");
copyText.select();
document.execCommand("copy");
alert("Copied the text: " + copyText.value);
From w3schools website
it works?
Idk, I just googled it
How I put it in a button
One message removed from a suspended account.
<button id=“myInput” onclick="copy()">Copiar</button>
<script>
function copy(){
var copyText = document.getElementById("myInput");
copyText.select();
document.execCommand("copy");
alert("Copied the text: " + copyText.value);
}
</script>
@halcyon nymph like this?
Idk, my html is god awful so I wouldn’t know sorry, I’d recommend using w3schools though, that really helps me with my markdown
mm okay
Can you say me how i can set all in false
when the inuse5 is false ?
i have maked it
if (inUse5 = false) {
(inUse = false)
(inUse1 = false)
(inUse2 = false)
(inUse3 = false)
(inUse4 = false)
}```
and not work
Is that JavaScript @tardy viper
You might want ; at the end of your declarations
not work
The brackets are also unnecessary if you’re declaring them
its if five is false ALL go false
what change ,
in the if statement
1 = sign is for declaring variables
3 = signs is comparing two variables
i make it if (inUse5 === false) { (inUse = false); (inUse1 = false); (inUse2 = false); (inUse3 = false); (inUse4 = false); } ?
Yeah, see if that works
(inUse = false);
(inUse1 = false);
(inUse2 = false);
(inUse3 = false);
(inUse4 = false);```
that ?
One message removed from a suspended account.
@halcyon nymph Just its to change the variable to false
and the problem is the code create a new var
Oh
const act = bot.emojis.find(emoji => emoji.name === "actif");
const ina = bot.emojis.find(emoji => emoji.name === "inactif");
const embed = new Discord.RichEmbed()
embed.setColor("#ffffff")
embed.setTitle("STATUS");
let inUse = await tcpPortUsed.check(27015,'46.105.84.218')
embed.addField("__________", 'Status - PropHunt');
embed.addField("Activité : ",inUse ? `Actif ${act}` : `Inactif ${ina}`);
embed.addField("Heure de redémarrage: ", `6H du matin`);
let inUse1 = await tcpPortUsed.check(27016,'46.105.84.218')
embed.addField("__________", 'Status - DarkRP');
embed.addField("Activité : ",inUse1 ? `Actif ${act}` : `Inactif ${ina}`);
embed.addField("Heure de redémarrage: ", `7H du matin`);
let inUse2 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Site / Forum / Boutique');
embed.addField("Activité : ",inUse2 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse3 = await tcpPortUsed.check(90,'46.105.84.218')
embed.addField("__________", 'Lien Boutique Discord');
embed.addField("Activité : ",inUse3 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse4 = await tcpPortUsed.check(94,'46.105.84.218')
embed.addField("__________", 'Status WEB');
embed.addField("Activité : ",inUse4 ? `Actif ${act}` : `Inactif ${ina}`);
let inUse5 = await tcpPortUsed.check(443,'46.105.84.218')
embed.addField("__________", 'Status VPS');
embed.addField("Activité : ", inUse5 ? `Actif ${act}` : `Inactif ${ina}`);
if (inUse5 === false) {
var inUse = false;
var inUse1 = false;
var inUse2 = false;
var inUse3 = false;
var inUse4 = false;
}
return embed;
}
})```
If you’ve already defined it you don’t need var
@tardy viper idk what to tell you, I’ve literally written out the code in console and it works for me
They are problem
Work at 25%
if inUse5 is true error Cannot send an empty message
i have repare the problem
Hello, I'm looking for a tool that updates my bot without having to restart the .py app
Like nodemon in NodeJS
pm2 works for everything
you can use that and enable watch
I use pm2 to run my minecraft server 
Agreed, pm2 is really good
What's pm2
i use systemd
if you know what forever is it's similar
lots of people here use it yeah
Just looking for an opinion, would having the bot directly render images be better or having a stand alone server for rendering images be better?
if you have the money and resources, you'd usually have something that is not monolithic
why this is creating a txt channel not a voice channel ?
await message.guild.createChannel(`User ${member} vom voice entfernt`, ["voice"]);
because you're passing it an invalid argument for the type
you're passing it an array
pass it ChannelData instead, e.g { type: whatever }
How i can make an automatic clear channel on start of bot ?
elaborate
That not saying me how
what
you want to delete an entire channel when your bot starts?
To automatic clear specific channel on boot of bot
just clear message
delete channel is my problem 😂
what lib
JS
yes but which library
?
js is a language
if you're using djs stable, https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=bulkDelete
E^pic
😂
Easyyest 😂
Why i have not maked that the first time 😂
bot.channels.get("607930498055929876").bulkDelete(50)
uh
That work 😂
you're welcome 
Thank 😃
Does anyone know a good hosting service that is free other than Heroku and Glitch
I found PythonAnywhere but I have to pay
there are no good free hostings
there never will be
either selfhost or buy an actual vps
services like google cloud and aws offer free 1 year trials
you can also grab the github student pack if you have an edu email that gives you $50 on digitalocean
and $100 on azure
I'll use pythonanywhere
And get a custom plan
With 4 terminals
3 for my bots and 1 for packages
why 4 terminals when you need one
Curious if anyone know off top of head.
For new EmbedBuilder().setTitle(null, "imageLink")
How small will the image be in the header? Will it resemble the standard setImage?
Im basically trying to setImage above the description.
I would test but im kinda lazy tbh
You can't set an image above the description in d.js iirc
This is Java api
then can't speak for that
I'll throw together a test then, thanks for response.
I grew up in the Minecraft plugin scene, work as a java dev for work. not very familiar with js.
Java C# SQL LUA not muhc of a web guy
you can't alter how anything displays on end user's screen, that includes the ordering of embed contents
Ah. Seems it turns the Title into a link, instead of displaying an image. Kind disappointing.
Maybe I can cheese it, let's see.
Nope, ah well.
you can, however, add an image to seTitle
This has nothing to do with your library
it'll look like a really small circle
Embeds are embeds the way they are described here https://discordapp.com/developers/docs/resources/channel#embed-object
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
If you can't do a certain embed thing within your library it simply means your library didn't fully implement everything
Embeds will always display the same no matter what library you're using
digitalocean
It's expensive compared to others
But has good customer support/reliability
Ok
If I'm going to use a vps what should determine how many cores i get?
pricing
but should how many bots im going to be hosting have an affect on that
im going to be hosting 5 bots, but 3 of those bots would only be in 3 or less server
What wrong with that
role = discord.utils.get(member.guild.roles,name='Bronzo')
await member.add_roles(role)
Eg?
"For example" essentially
ah okey
well getting listed here helped me find a bug in discord.js
does anyone know why this is happening when I try to fetch the guild owner?
source code is js let owner = await client.fetchUser(msg.guild.owner);
and the error is a promise rejection from d.js js (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined LemmeSmash-bot | at Object.User (/app/node_modules/discord.js/src/util/Constants.js:109:16) LemmeSmash-bot | at RESTMethods.getUser (/app/node_modules/discord.js/src/client/rest/RESTMethods.js:402:51) LemmeSmash-bot | at Client.fetchUser (/app/node_modules/discord.js/src/client/Client.js:319:30) LemmeSmash-bot | at Object.ensurePermissions (/app/bot/utils.js:66:38) LemmeSmash-bot | at processTicksAndRejections (internal/process/task_queues.js:89:5) LemmeSmash-bot | at async /app/bot/proxy.js:17:14 LemmeSmash-bot | (node:1) 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)
seems like its from this part of d.js according to the error
const Endpoints = exports.Endpoints = {
User: userID => {
if (userID.id) userID = userID.id;
const base = `/users/${userID}`;
return {
toString: () => base,
channels: `${base}/channels`,
profile: `${base}/profile`,
relationships: `${base}/relationships`,
settings: `${base}/settings`,
Relationship: uID => `${base}/relationships/${uID}`,
Guild: guildID => ({
toString: () => `${base}/guilds/${guildID}`,
settings: `${base}/guilds/${guildID}/settings`,
}),
Note: id => `${base}/notes/${id}`,
Mentions: (limit, roles, everyone, guildID) =>
`${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,
Avatar: (root, hash) => {
if (userID === '1') return hash;
return Endpoints.CDN(root).Avatar(userID, hash);
},
};
}```
specifically js if (userID.id) userID = userID.id;
because for some reason the argument passed to the function is undefined
have you thought of that maybe you're passing an undefined object
I'm not passing anything, that's discord.js source code
hmm... someone wanna educate me on forEach and async?
msg.guild.owner does exist
when written like that
newHex(); does full console log iteration
then console.log line does full iteration
when I remove the "await" in the middle
they interchange as expected
H
to get the owner in cache simply call fetchMember(guild.ownerID) on a guild
oh fbdhdf yeah I was doing that thank you!
re: async functions as above, that just wraps it in a promise and it resolves when the thing is finished doing stuff
am I doing something wrong with the syntax inside?
what's your expected behaviour?
I just gotta build a picture of what's supposed to happen and what's actually happening
the outputs are behaving normally
but
with an await separating them
it iterates them completely separate
oh so you want them iterated as newHex() and immediately after, the console.log line?
correct, the await is in there because it's ideally checking to make sure the hex doesn't exist in db
because if you await the call it will do only that call first and then when it's finihed, move on to the next part
maybe a do-while loop might help
i just used forEach for simplicity but it seems to have unexpected behavior
yeah it's weird like that if you wanna do fancy things with it
ive never heard of an iteration command doing each line separately
"do line 1 100 items, do line 2 100 times, etc"
it appears to work when i move the await
basically the idea was to assign random hex codes to a new property in the database
and if one repeated, get a new one
this would moved to "new account" when assigning the code
ohhh
yeah I implemented the same thing when checking for collisions in randomly generated IDs
I used a do-while loop as well
I use player tags for players to attack each other
but many people complain
so I was going to assign people a 3-digit Hex
so instead of ?Attack @maiden mauve you could do ?attack #3FC
ahh i see yeah all the pings would get annoying
i'd do something like js do { textHex = netHex(); compare = await players.dbcallthing(); console.log("yourstuff"); } while (compare)
yeah d/w simplifies the structure a little bit
that way it generates one first, and if its taken, it goes into the loop
then at end of loop, assignment and save should work fine
yeah, tho I always recommend catching db query errors and handling them somehow
I've never had a query error
neither have I but I like to be prepared
in C# I use HashSets to avoid duplicate entries
but idk if that's a thing in JS
damn
db.findOne( { property } );
^ if a db
But you'd have to filter it out in js
oh a HashSet is like... an Object but without values
any check for duplication would have to iterate right?
HashSet is actually a type, it handles all that for you without having to have an iterator
instead of an array you could use a HashSet but not in mongo, I'm pretty sure it doesn't have those
yeah it's pretty fast
iteration 
xd
What lang
what about cheeseburger pizza
why are we spamming emotes
it's still annoying.
I'm guessing you were the one who first added them to those messages?
j
Wha--
it's not that annoying 
also I am a fool can someone help me with discord.js...
when I try to get the guild owner using guiildObjectHere.fetchMember(idHere) it returns a rejected promise saying Error: Invalid or uncached id provided.
I'm not sure how to get a member object that's uncached...
- just use
guild.members.fetch()if you know the user is cached (aka your bot has seen it before) - you're not providing a valid member id
it's definitely not cached, also the snowflake is returned from messageObject.guild.ownerID
which for this guild is apparently 107568785157795840
so like
it is valid
that's what's got me
unless this guild in particular is just discombobulated like that, because it's working in every other guild ever
I ended up just writing a function to do this and it's working bvhfbhg
something tells me maybe you were passing an invalid id if you made it into a function and it worked
but gj
yeah I probably was passing something invalid
I'll figure it out and yeet the function becuase I'm pretty sure it's just me fucking up vfvggfvbhf
Ok, So. I have my bot made..now I am just struggling with having a couple commands only to be used by one person or can only be used if said person has a specific role
I think, if message.author.id == "USER_ID_HERE": will work but I don't know where to put it in (picture attached)
help would be nice if anyone isn't to busy helping other people with more advanced issues. Yes it's Python
thanks for your help!
np
@ Ori with that structure you're better off defining a function that checks the user ID and returns a bool or something
then just inserting it wherever you need that checked and bail if false is returned
something that can fetch the users roles and return a boolean
hmm
does python have a switch statement?
This is the first time I have made a bot in python so I am not sure
fair, either way conditionals do the job
is it every command after / that is only for a certain user?
In that case I'd define a function that checks the message author's id against your chosen ID and/or checks user roles and returns a boolean
if they don't have permission or the user ID doesn't match, false is returned
and if you insert if ensure_permissions_func == false: return right below if command.startswith() you shuold be good
(that's pseudocode because I'm rusty with python vbbfvbhg)
I will give that a try
@sonic peak try
let owner = client.guild.find(g => g.id === msg.guild.id).members.find(m => m.id === msg.guild.ownerID);
that will return a user, not a guildmember
There's shit you can do to a guildmember you can't do to a user
fair, I literally only need it to DM them
Some discords have had their owners deleted and you'll get a bot crash so you need either a catch error or an if (owner != null) {}
you get the idea
yeah I am catching
but for some reason it's not actually catching???
owner.send(`I'm missing the following permissions in **${msg.guild.name}**:\n\`• ${missing.join("\n• ")}\``).catch(async () =>```
that should like
catch... right?
await client.fetchUser(msg.guild.ownerID)
.catch(console.error);
but that's inside the catch bit
Also word of warning, if you get the bot to send a message to someone who has blocked the bot, the bot will crash
so you need another .catch(console.error) on the message send
that's what I mean, I am
that's what that snippet is
but it's not actually catching
I get unhandled promise rejections
Is the error message Cannot send message to this user
So go back earlier in the code and do a console log systematically on every step until you find something that's undefined or null and you'll find your glitch
I get missing permissions, which is because the owner has blocked it (we're testing)
I know where it is because I already did that
That's missing permissions so change the guild's permisisons or the room permissions and make sure your bot has manage channel enabled
it's definitely the send
or send message enabled
the bot will have it's own role
the room will have it's own rules
no no I'm doing this for testing, I definitely want the bot to handle not haivng permissions properly
if it has its permissions
Those sorts of error messages don't usually crash bots
I'm trying to not give it permissions
most errors dont crash bots
unhandled promise rejections will in future
but why aren't my promise rejections being caught when I literally use .catch()
sending a message to a user who has blocked the bot WILL crash the bot if you don't have a .catch
I literally am using .catch()
no it doesnt
unhandled promise rejections will crash node
or they will in future
since they're deprecated
It might be throwing somewhere else, or it could be inside the catch block. We don't know, but if you couldn't send to the user, it would reject with Cannot send message to this user.
Oh right
So somehow it's missing a permissions to do... nothing?
I'm telling you I had this guy block the dm on this server I run a bot on with over 5,000 members and I spent hours trying to figure out the problem, take my advice or leave it
The code will run up until the failed dm then it will do no more
if you have a catch, it will carry on further
I did, what I'm saying is I already took your advice
I already have the bot posting stack traces to a channel I configure in my server
That's something I can't do, got any good code on stack tracing?
I wrote a function for it
care to share?
e.stack!? that's it? I'm going to have to toy with that
lmao yeah every error object has a stack property
also I run a bot in > 6000 guilds but its in C# and I handle errors right
but js... that thing scares me
Woah I've only got a bot running in 2 guilds
add it to this server and make ot 3

I could but it's kind of custom built for a server and I doubt you would use it as a moderator bot that assigns containment roles on trolls
Like the bot has 143 role emojis in a database
and you click one of the emojis the bot adds/removes that role
but it's got a role limiter function
so we have categories, so with the mystery conspiracies roles we have a limit of 20 maximum roles of that type
And the bot sends you a message if you choose the role or remove the role
Yagpdb has that
Similar to Yagpdb, but we wanted our own in house bot because someone's found an exploit to it and we wanted control of our own server
also yag didn't have a way to limit the number of roles of certain categories
Valid
coding our own bot seemed the right way to go
also vortex only had one containment role, we wanted 4
also my promise catch code is working in all my tests but just not in this server 
A big question I get asked is someone on the server keeps disconnecting us randomly in voice calls and I tried raw packet sniffing, the packet only says that user is now in a null voice channel, I couldn't figure out a way to find out who was doing it.
oof
That's what I got from the packet sniffer
It will tell you which user got disconnected but not who issued the diconnect command
There's like 50 moderators on the server and everybody is pointing fingers at each other
I did a lot of digging, the voice chats they have their own gateway
wh.. so you can't do it without http yeeting a request to that?
or you mean ws gateway?
Sorry I'm a bit of an old timer, i'm not used to your kids language I don't really get the whole yeet thing.
vfvgfhg fair I'm not exactly young at 24, but still
That's young, trust me
thanks i actually needed to hear that bfvvbhd
anyway what I mean is, do you have to actually make a request to the separate gateway?
Well discord 12 now has a separate voice API,
The linux server I have to host my bot on can only really do discord 11.5 unless you recode the node modules
when a bot joins a vc it establishes a connection to the voice gateway
so unless the bot is in the voicechat at the same time I don't think there's a way to know
So a bot not in vc won't be able to intercept voice packet data for instance
And even then the voice packets are encrypted
I had ideas to do a voice to text, text to algorithm, algorithm to text, text to speech bot similar to Siri at one point.
But yeah voice chat bots are a whole can of worms in of themselves
oh man
that sounds complex
Oh man @earnest phoenix thanks for your advice btw I hope pings are ok bvbfdvh
I found the issue, it's uh, I was a complete fool
Imma need to code in a statically typed language for a bit to calm my nerves 
