#development
1 messages · Page 610 of 1
its a canvas 
let canvas = new Canvas(50, 50)
.setColor('#AEFD54')
.setTextFont('28px Impact')
.addText('Hi', 10, 10)
.toBuffer();
const embed = new Discord.RichEmbed()
.setColor('#ce5016')
.setImage(canvas)
.setTimestamp()
message.channel.send({ embed });```
that
i can send canvas in a channel
but not in a embed

well yes use common sense, the image asks for a url
normally uploading files and include image in an embed are completely different things
since an attachment is kinda it's own embed already
Hmm
you can kinda get the idea of "embedding" an image from an external source just by knowing that it's an "embed object"
Nekos.life api endpoint isnt good because of the minors/lolis, anyone know of other api endpoints i could use instead? As it stands all commands that use the nekos.life endpoints have been removed
I know I can pull images from subreddits and I do, but it seems slow to reply.
You could not have nsfw commands 🤷
I mean nsfw commands shouldn't be used but a lot of people wants it
^
I just despise them
https://pastebin.com/wj5pBJrd This okay?
why are you defining a client tho
i jsut copy paste the same thing from all the commands for new commands
:/
you can use nekos.life non-nsfw as long as you dont make calls to the nsfw endpoints
Yeah I used it a couple times for non-nsfw commands
Why would u define the client in the command file... it gets passed in through the function.
And still, this client would be separate from the client in your main file, so one would not know what the other does
Am I allowed to collect user data? Like the messages that trigger the bot and server joins?
Should that be specified in the bot's ToS?
Using commands most likely, server joins I really doubt
sa
I remember back in the day when all end user data stored by 3rd party apps had to be encrypted. One of the least enforced rules I have ever seen.
Now its just "reccomended"
User IDs and such are protected by default as they do not contain user identifiable information outside of the discord ecosystem
Ie, nobody can track someone or get their email addresses from user ids
Other things though
Logging command messages should be perfectly fine as well
Many people do that for debugging purposes
Whats not fine is logging messages that have nothing to do with the bot
I used to do that lmao
can you have a class without a constructor in javascript?
i want to have a class that can have properties and functions, but dont necessarily need the constructor
class C {}
ah so it just works without that
erm you can track find someone by there discord id, theres site that send you there user info but other that you cant do much lol
or jsut use <@ID> to get a mention of them on pc which you can then add them from lol
That doesn't do much
and discord has taken down similar things before (although for tracking which guilds someone is in, which also abused selfbots)
Ah I misread that, the updated the wording a while ago and I thought they stopped requiring it, just instead suggesting it.
So now real question, how many people actually use an encrypted db or datastore? I have my whole db encrypted, but I feel like thats not too popular.
.
Ye, Tim known for his json 
Can't believe a certified dev would use json as a db
yeah
json files as a db is just waiting for db corruption
I mean mongo is just glorified json (I know not really), but cmon. I feel like there is little excuse to not use a decent persistence method
My friend prefers json over sqlite because apparently sqlite gets corrupted all the time
unlike json
What
exactly
That's 200iq for sure, the next Einstein
The amount of time you would invest to make a transaction system for using json in a transactional thread-safe way would be way too much. I see no real reason to not switch to a decent rdb or nosql db/ds.
Postgres ftw, although a good free nosql db like firestore also works well
I havent tried postgres yet. I just have been stubbornly on the mysql train for a while.
uhh I'll try this, but I'm looking for a css solution
Make them use the same class?
They do, but it's all responsive
Put them in a container div and make them height 100%?
yea I tried that but it's either my horrible css skills or the framework doing it's thing
https://antiowo.xyz/
Flex is the new hot isn't it
I like the way you think
Which framework are you using?
materialize, bad I know
the issue is, it looks fine on my monitor, but it looks bad on higher res screens
and on tablets
just
The divs are in a container, I've tried making the height 100%, inherit and aaa it's just not working
event.JDA.getGuildCache.stream.filter(g => (g.getMemberCache.stream.filter(m => m.getUser.isBot).count.asInstanceOf[Double] / g.getMemberCache.size.asInstanceOf[Double]) > 90/100).count()
maybe I shouldn't be using materialize
Wrap it up with a Collectors to List?
@spring ember doesn't count() just count the elements in a stream?
yes
collect(Collectors.toList()) returns the elements in a list
that was not my issue
Is it because you are using the guild cache? I have a feeling the cache wont contain all guilds.
I'm not familiar with jda but could it be that m is already a member and doesn't need a call to getuser?
What object is stored in the member cache if not members?
why even do 90/100 and not 0.9
At least we sorted it all out
On a side note, when dealing with larger bots try to avoid using the guild cache when you want to iterate through all guilds. Looking at my bot with ~6700 guilds it is a far cry from a complete list.
Well I was just going to check the amount of bot farms
Fetching the guilds will take unnecessary time and resources
yo
I'm trying to modify this modmail bot
I'm trying to understand it
Can somebody tell me where it actually interprets the message?
I am not a js person or eris either but a quick look seems to be here.
and there are 2 more listeners on lines 66 and 142
Why they have 3 listeners, the world may never know
Anyone know how I can make a command that check the bot's ping? (discord.js)
Thanks
Anyone know how to change a nickname when I assign a role? New nickname should be [nickname] [role].
which library
lets try starting with what language your bots in,
dyno
custom commands
context
this isn't dyno support, go to their server for that
We aren't the dyno support sevrer
ok, ty
well then lol guessing i dont post github repo to Dyno Custom Commands?
would be helpful for the guy
he gone man, went woosh
@Fritz#0001
They left xd
xD
Oh, note to anyone else who also runs a modular bot: disable normies from being able to use these commands.
Would hate for someone to run an unload command for a core feature and thus it suddenly stops working xD
We been knew dawg, we been knew.
Except mayhap not the newbz
Then again, they most likely wouldn't have a modular bot
disable the command disabler
@spring ember just for reference, it was returning all guilds because 90/100 evaluates to 0 cos of integer division
Let's say that I want to randomize one of user inputted submissions, and they all have a number of specific upvotes and downvotes, how would I use this voting system to improve the chance of a more upvoted submission to be randomized? Or more specifically, with sqlite?
i mean
the best way to keep people form misusing your bot
is by deleting the whole thing
so do that instead
deive, simple answer: put x number of the same element into the array based on the votes and then pick a random element
if youre handling lots of input, this is pretty inefficient but youd have to write a far more sophisticated weighting algorithm to fix that. you can google various options
Random integers?
i am getting a error can someon hlp
so i have defined user for kick but i try to make a const for ban to defin user and it comes up with a error saying its already defined but then when i try to use the ban command it says user isnt defined
anyone lol
anyone know what to do????
DM me if you can help me because i might be gone in a minute
does like anyone know??
its defined in code as a variable
during runtime its value is undefined because it cant find the user
It had the error in the terminal
Hmm
Could I define it with a var instead of a const then call on the var for kick and ban? Message me I gota go to bed
Lol
@heavy spade define user
You defined member not user
O I can define member
That’s already what you did
Yes, show me the code where you defined user
Well seems like u haven’t defined user or else you wouldn’t get that error
I have defined it for kick command
But for the ban command
I had it and it said that it was already defined so then I took it out
Then said it wasn’t
Dude then you have to require the file where it’s defined or make it global variable
I might make it into a var
Don’t use var use let
Ok
I am tired as fuck
Thx mate
Gn
I will get back to you tomorrow and send you it
Can someone give me a suggestion on how should I make a person obtain something when it spawns?
what do u mean
like pokecord’s pokemon spawn
im making something like that but i dont want to copy pokecord by making peopel guess it’s name
my ban command wont work and i dont know why...~
const Discord = require("discord.js");
exports.run = async (client, message, args) => {
if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("You don't have permisson")
let logs = message.guild.channels.find("name", "logs");
if(!logs) return message.channel.send("Could not find a logs channel.");
let user = message.mentions.users.first();
if(!user) return message.reply("Please mention a user");
let reason = args.join(" ");
if(!reason) reason = "No reason given";
message.guild.member(user).ban(reason);
let logsEmbed = new Discord.RichEmbed()
.setTitle("User Banned")
.setFooter("User Ban Logs")
.setColor("#ff0000")
.setTimestamp()
.addField("Banned User:", `${user}, ID: ${user.id}`)
.addField("Reason:", reason)
.addField("Moderator:", `${message.author}, ID: ${message.author.id}`)
.addField("Time:", message.createdAt)
.addField("Channel:", message.channel)
logs.send(logsEmbed);
}
module.exports.config = {
name: "ban",
category: "admin",
description: "ban someone",
usage: "ban",
aliases: ["banhammer"]
};```
error is that args.join is not a function but i dont understand >~<
@indigo crane check if the user is banable. also if it gives any error send it here
@lament meteor majority of my caommands stopped working all with the same error that ars.join is not a fucntion, but iv used that for a while now
is args a array?
@indigo crane how did you define args
what argument?
Where is the args variable coming from
What you mean
@dull bobcat which library are you using
if it's discord.js then https://discordjs.guide/creating-your-bot/commands-with-user-input.html
A guide made by the community of discord.js for its users.
To create a KEY API (YouTube data v3) I chose Web server (nodejs) or Navigateur Web (Javascript)?
javascript i guess
i've never registered for a youtube api key
OK
figure out which one is for your usage
ok
I just put the API, but when I made the play command with the link of my music, the bot joins the vocal and leaves immediately saying "the music is finished."
If someone know what it is:/
its your code
@indigo crane try this let reason = args.slice(1).join(' '); if(!reason) reason = "No reason provided";
And u can use
.catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));
message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`);```
For the ban

@kind wyvern ayy
Hey bro
Kidha
How are you
Uhh oh
Ive named the variable in PC settings as PYTHON.exe and add the file path
Maybe pip’s servers are down
Should I rename path variable name?
Nah
Vs code is recongnising PY BUT
Install python in vs code
Google, please
Bro I am asking him not u so
There should be option on left side
Better come dm bro @fiery stream
That's pretty cocky for someone who can't add python to PATH
I've done it
Welp, I wonder why your OS cmd doesn't recognize pip at this point
Chill @slender thistle
I'm literally calm
how do you even manage to run a bot like thatlol
I aint a python expert
And my bot runs on node
Not python so yea
And i wasnt getting the problem
not you, the other person
Ohhk
people forget than they need to restart their computers to apply PATH changes on windows
Doesn't it also say that when installing Python to PATH
Is that a request for spoonfeed I see
😆
@slender thistle thanks man 😉
Sure is
Btw what code library are u dev of
dblpy
Ohh
is it possible to use a placeholder to specify the default value in create table statement in sql ?
cause
Ehhhhh
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Could not resolve 'security.ubuntu.com'
Err:3 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic InRelease
Could not resolve 'ppa.launchpad.net'
Err:4 https://deb.nodesource.com/node_11.x bionic InRelease
Could not resolve 'deb.nodesource.com'
Err:5 http://archive.ubuntu.com/ubuntu bionic InRelease
Could not resolve 'archive.ubuntu.com'
Err:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Could not resolve 'archive.ubuntu.com'
Err:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Could not resolve 'security.ubuntu.com'
W: Failed to fetch https://deb.nodesource.com/node_11.x/dists/bionic/InRelease Could not resolve 'deb.nodesource.com'
W: Failed to fetch https://download.sublimetext.com/apt/stable/InRelease Could not resolve 'download.sublimetext.com'
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/bionic/InRelease Could not resolve 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.```
Did sudo apt-get update.
im in desperate need of some help if possible
if you could possibly help can you dm or pin me thanks
@sinful lotus weEeBB
smh Im asking a question
@sinful lotus you can use the DEFAULT syntax like you have
You need SET DEFAULT
oh instead of default only?
Unless its null, in that case you could do DEFAULT NULL
For example SET DEFAULT '-y'
yeah
Whoops my bad, I was looking at old docs, mysql 5.7 right?
its mariadb
Ok. I think you need ' around the ? on the prefix line
using that made the prefix ?
Do you not want that?
and not actually the one on the config file I have set
its just so that I can change the prefix when switching between prod and beta code
without messing with sql syntax there
Ok, in that case I would not set a default in prefix then.
You could put a {} there then format the string with the thing in the config file if you want that to be the default
yeah I do have that on the config file already, just that ? stuff on create table is where the things got a bit annoying
is there a way to give bot access to multiple channels at same time without individually adding them to each channel?
Give them a role that has access to those channels? Other than that I cant think of much.
say i have 50 channels already made and want to add bot to all 50.
no role currently has access to those 50.
Make the bot admin
ask the server owner to give your bot acceess
It's dangerous, but itd work
true
yeah but I dont recommend that
like your bot is only music and it needs admin
omega lol
xd
Mine only needs kick/ban to run those two commands
I dont have any other ones xd
lmfao nice perms
only cos we used to get absolutely swamped with idiots that were like "your bot doesnt work" and then we'd take a look and they had some ridiculous permission setup
@grim aspen Why did you ping me?
Who can make me npm install and give me the files?
So just npm install I'm on the phone. Or npm install eris ?
What are you on about?
A mail bot. When you MP the bot, its sends a message to a staff and it must respond (kind of ticket but in private message)
And I code everything on the phone:)
Anyways, you don't need to run "npm install" to make a bot
No, it is to install a package that gives Eris
and when we do NPM install its gives the package, at least, it gives full package of which Eris
For the system in MP to work, the logs and many other things.
I already have a discord bot personally. The mail bot is the v2
yeah good luck, but coding on your phone is just generally a stupid idea
maybe
its a terrible idea
^
But it's also simple You know
No it's not
How are you gonna run the bot on your phone?
You need access to a computer that has NodeJS installed
And if you have then why not code on your computer
Doesn't matter if its a challenge
Helping you with this would be a pain in the ass for us too, I cant imagine how annoying it would be to you
So, just stop
Or get your packages yourself
or good luck making someone else install packages for you and then send it to you
fym you dont need npm install to make a bot 🤔 nobody writes things with zero dependencies
you want him to query the api himself with nodes http module? thats arguably worse than coding on a phone
I mean if you used kotlin or java you could run a bot on an android phone pretty trivially. But why, god why, would you ever want to do that?
you can code on your phone through one of those online ides
I thought he meant run the bot on the phones hardware. Coding from a phone is also trivial, all you need is a text editor, although the experience would suck really badly
Not recommended way: visiting the link
Recommended way: none
Any request contains an IP
Don't send that here please thanks
Guys how to change domain DNS on cloudflare?
o
@fiery birch If you read carefully i cencored out the full link lmfao
God and you a mod too
Yea with a spoiler
No
Shrug what
It's still the same website, so I doubt that changes much
Fair
Especially if it's a grabify link
No you need the tracking code which is set as the ID when changing domain
And i changed the ID to "NOT_GONNA_SHOW_THE_ID"
We take no risks, ty
But if I click on that regardless of ID, it still tracks my IP, does it not
The link is not real lmfao all i asked for was a fkn tip lol
The URL is fucking fake how braindead are you?
Welp, whatever
moot
Uh I wanna ban
just mute
@mossy vine @mossy vine vote

Shit that's not shiv
mute me then
braindead idiot
he left lmaooooo
Who took my ban
oh
10/10 reasons plz do it again sometime 

hey, i seem to remember some bot has an embed visualiser?
what's the command again
just to see what fields are what etc.
no like
it uses every single location in the embed possible
and shows what is what
you know what nvm
found it aha https://leovoel.github.io/embed-visualizer/
Also why u steal Moose’s name
waitwhydidyoudeleteit
Anyways. If I were to add a search option for posts, and I want it to search through a specific area.
Ex: neko-bot.net/posts/
How would I go about doing that
(Html)

What I've gotten so far led me to something like this:
neko-bot.net/posts/post?=10
But what I'm wanting is it to also have a .png at the end.
So like this
neko-bot.net/posts/post15.png
In the serenity docs, where can I find the properties of a message?
API documentation for the Rust Message struct in crate serenity.
ty
neko, just concatenate .png to the end of your string...? im not sure what youre trying to do
basically every language supports something like this: yourPostName + ".png"
Html surprisingly doesnt
wat
I tried it
It will complete the url in the bar like this
neko-bot.net/posts/post?10
Wont even include the .png
if youre editing the html dynamically with js you can change everything about the element
Possibly. I'll look into it.
Anyone use Jimp
jimp is slow
Jimp is less pain than getting cario to compile
Still slow though by comparable standards with others
i never had any problem compiling it
also, sharp doesnt require it afaik, and its tens of times faster
I was looking at my options since canvas was giving me trouble
How would I add a role to a member in serenity?
@opaque eagle ive never used it before, but i just searched the docs and found this https://docs.rs/serenity/0.5.13/serenity/model/guild/struct.Member.html#method.add_role
API documentation for the Rust Member struct in crate serenity.
Man how do u ppl find this
I browsed the docs so long and couldn't find anything
Welp I clicked onto the member property from the Message model, so it showed PartialMember instead of Member... that's prob why
so the !ban works but not the !kick how can I make it so user is defined for boh !ban and kick
bt2 @opaque eagle looks like serenity isnt approved, this is the only approved rust lib https://github.com/SpaceManiac/discord-rs
Wdym by not approved?
@heavy spade you dont have the let user = code for kick
I found it on the Discord API server
fuck
i do for !ban but when i put it in !kick it says its already defined
but when i take it out it says its not defined
well kick comes before ban
so you can put it in kick but not ban ig
but its better to put each command in a separate file and use a framework/command handler
i can put it in kick but then ban doesn't work
hmm
true
could i make a new folder and put the command in it with !ban then have !kick in the main file
i put it in a new file and deleted it in the main file
just to make sure I did everything right
@bright spear ?
you would need to export it and require it in the main file
google it
ok
A guide made by the community of discord.js for its users.
Anyways. @idle basalt ty I got it working.
Betteethanicando
https://leovoel.github.io/embed-visualizer/ maybe this will help
play around with the options until you get something youre looking for and then youll know what to change in your code
how do I set up localhost
so I dont have to run my HTML code and reload the webpage
What
localhost is your domain from your pc
You don't run html code you run a server that serves it
how
I want like this http://prntscr.com/nj14bs
So I don't have to run my code and reload the page
localhost does it automaticly
Run a web server on your pc
Is that free?
Ok
You'd still have to be refreshing the page, it's just how the web pages work
But to make that accessible you need to port forward
Yeah also that
There is no hot reload
@abstract quarry if you just want to view static html pages you can run python -m http.server
i have a bot
y dont i have the rank
my bot is called Google Chrome
and its prefix is chrome!.
You won't have the role if your bot isn't approved on discordbots.org
Hello. In JDA I wanna check if an argument in a command is a user's mention, how can I do?
compare the arg to user's mention (<@id> & <@!id>)
no actually
i juste wanna know if it's a mention, not know if it's a mention of a specific user.
i guess use regex for that? or do substrings to extract the id and check if it's valid
we can do something like that: User metion = JDA.getUser(string); and check if it return null ?
well, no
Oof
who uses javascript here?
getUser asks for an id
i do
not a mention
I have a problem with my music bot, I make the command play with a link and it tells me its in the console. log:
Could not extract html5player key: https://www.youtube.com/yts/jsbin/player_ias-vflXZ59b4/fr_FR/base.js
you could just use existing solutions
I would like to know what the solutions are. 
@charred wolf hi
ytdl-core, lavalink, etc
I'm on Android, it's for her?
jcehvci
oh are you trying to code on a phone?
i am waiting for my rank. (bot developer (not certified))
here is a great guide on how to code on mobile. https://cyber28.xyz/codeonmobile
Beginner-friendly guide on how to code on mobile. All points have been collected from reputable sources. This guide is trusted and used by many programmers.
@mossy vine i know
@opal stag you need to submit a bot to the website (discordbots.org) and wait up to a week for it to be accepted
But if I run from my computer, will it work? @mossy vine
@earnest phoenix most likely not
Why ?
arent you the guy that cant use packages?
Yes, how do you know?
i remember you talking about it here. just stop coding on a phone and use packages
you most likely wont be able to extract audio just with the youtube api
most likely
Here are the packages written in the hand and what I also have:
var Discord = require("discord.js");
var fs = require('fs');
var ytdl = require('ytdl-core');
var https = require('https');
var musicStream = null;
var dispatcher = null;
var globalVolume = 0.2;
var text_channel = "573123191162273815";
var voice_channel = "573123090066702336";
var bot = new Discord.Client();
const token = "MY TOKEN";
var queue = [];
var now = null;```
So how to get user with a string ?
I have one but I do not know how to introduce it.
I know how to introduce it but here
var key = "API KEY"
It agrees, but in the rest of the coding.. I do not know. and I read the doc
Otherwise I pass the coding xD?
@earnest phoenix JDA-Utilities has a regex for checking if a mention is a user mention iirc
public final static Pattern USER_MENTION = Pattern.compile("<@!?(\\d{17,20})>"); // $1 -> ID
code snippet from it
I found this @earnest phoenix
event.getMessage().getMentionedUsers()
But how to get the location of the mention ?
i guess use message content.indexOf(first user out of the mentioned users collection.getAsMention())
i recently noticed there is a new feature that can disconnect people from voice channels, how can i make my bot do this, if it is in the api already
it probably isnt implemented in wrappers yet but i'll get the endpoint thats used
PATCH https://discordapp.com/api/v6/guilds/:guild id/members/:member id
body payload:
{
channel_id: null
}
Can anyone explain me how youtube notification works ? (discord.js)
like the actual youtube notifications on the website?
???
the only way i can explain it, it recieves the notification via the api link or package
Yup I know
i did something like that embed.setAuthor(":white_check_mark:") but reaction won't appear
Someone know why?
You just have to add that emojis
embed.setAuthor(" ")
✅
did you just
What I just
How can I check my command
const YouTubeWatch = require('youtube-watch')
const client = new Discord.Client()
const yw = new YouTubeWatch({
secretKey:
hubCallback: 'http://your-ip-or-domain/',
hubPort: 9001,
});
yw.on('start', () => {
let channels = ['https://www.youtube.com/user/ROCKSTARvvk',
'UCGY2w6hIZWwyxasBUN7wbaQ'];
yw.watch(channels);
});
yw.on('notified', video => {
console.log(`${video.author} just uploaded a new video titled: ${video.title}`);
client.channel.get(547065494507749396).send(`${video.author} Just uploaded a video ${video.title}`)
});```
test what it does
I want to check my command
const Discord = require('discord.js');
const { prefix, token } = require('./chromebotconfig.json');
const client = new Discord.Client();
that is my first 3 lines

{
"prefix": "chrome!",
"token": "my token"
}
refresh your token
Refresh it
ok
Nope
yes and hundreds of bots in #265156361791209475
it takes 5 second and with the number of bots here i wouldnt be surprised if someone has the message logged
Revealed bro
lol nothing is safe
its changed
NIhINOIYHOm.BUYNAGNU-TngjyGYu.NYIytjvbuNFRjs.UYUGNhudeu is not my token
ok
Its called how the coding which, when the bot joins a server, it sends a private message to the founder of this server by telling him things?
what
When an administrator invites my bot, I wish it sends a private message to the founder of the server where the BOT was added by telling him some information
get the owner user object then send a dm to it
Okay, but what's his name?
read the docs
ok x')
is there any way to make new Array(5) be a fixed size of 5 instead of dynamically making it bigger?
or would i be better off using loops to fill it instead of .fill()?
wdym?
wait ill get a g i f
quality is shit but you get the point
let arr = new Array(10)
arr.fill(' ')```
the array changes size dynamically
but i want a fixed size of 10
I dont know if you can have a fixed array size in js
i think you can if you dont use the method im using
okay uh
Object.seal(arr) basically works
but i still need to manually check for range issues
i guess thats better than nothing
Its works ?
bot.on('guildJoin', guild => {
let addembed = new Discord.RichEmbed()
.setColor("GREEN")
.setTitle("**__Merci de m'avoir ajouté dans ton serveur !__**")
.addField("💼 • Mon prefix :", "`t/` (Changeable)")
.addField("✨ • Ma page d'aide :", "t/aide")
.setFooter("Encore merci de m'avoir ajouté dans ton serveur !")
message.owner.send(addembed)
} ```
try it
he just told you
and message isnt defined
I put guildCreate?
yes
I set it how message?
message.owner.send() makes absolutely no sense either
thats what i said
me ? @knotty steeple
me what
client.fetchUser(guild.ownerID).then(user => user.send())
@idle basalt you dont have to do that but ok
also no spoonfeeds
its 1 snippet but who cares
yes you do. guild.owner is not always cached
and helping this guy is impossible its 100x easier to just give him code
So what do I put instead?
i just told you...
rtfd
i agree
thanks minimod ill keep it in mind, but he clearly cant even use spoonfed code so
I put what the blow xD
go tell him to learn js and probably join a french server while hes at it
ok
Wait what the original prroblem
okay
Its works ?
let addembed = new Discord.RichEmbed()
.setColor("GREEN")
.setTitle("**__Merci de m'avoir ajouté dans ton serveur !__**")
.addField("💼 • Mon prefix :", "`t/` (Changeable)")
.addField("✨ • Ma page d'aide :", "t/aide")
.setFooter("Encore merci de m'avoir ajouté dans ton serveur !")
message.owner.send(addembed)
} ```
lets google
he wants to send the owner a message when they add his bot
which is annoying in the first place
no, that wont work
yes
we just told you that, then told you exactly how to fix it, and then you reposted the same question
with no changes made to your code
@idle basalt I put the question to Onii
Okay I used google
okey
// This event triggers when the bot joins a guild.
and ?
thats what you want yes
That's what I wanted Yes
read
but, the message owner send, it is correct?
message.owner.send is entirely wrong
its guildCreate
someone already told you that
and
both of us said thats incorrect
the event is guildCreate not guildJoin, message is undefined, and message doesnt have an owner
@idle basalt I know!
Read the docs
I understood Roo
@idle basalt owner is the founder of a server where the bot is add
at the very least tell us whats not working lmao
If i don't mention a user it's okay error else return message.channel.send("Vous devez mentionner un membre !") is okay but if i mention nothing is happening
You already set up 4 different console logs, how far does it get?
Passage 1 / 2 / 3 /4 ?
document.getElementById('searchform').onsubmit = function() {
var img = document.createElement("img");
img.src = 'http://neko-bot.net/posts/post' + document.getElementById('test').value + ".png";
var src = document.getElementById("postimg");
src.appendChild(img);
document.getElementById('downloadpost').onclick = function() {
window.location = 'http://neko-bot.net/posts/post' + document.getElementById('test').value + ".png";
}
return false;
}
I'm wanting it (since it displays a image) to check if there is a image present, and then deleting it. Is there a way to easily do that?
Because the user can spam [enter] and it will duplicate the image.
@lofty hamlet if you mention someone it should at least get to passage 2. I wasn't sure what was wrong with that line of code, so I tested it locally. It works for me
if (msg.mentions.users.first()) console.log("mentioned");
properly console logs "mentioned"
@west spoke the easiest way is to set src.innerHTML = ""; before appending the image, it would wipe everything inside the postimg element before appending the new img
Kthx
jesus.
hey
var embed = new Discord.RichEmbed()
.setColor('FF0000')
.addField(`__Ajout coeur de :__ **${user.username}**`)
message.channel.send(embed);```
I'd guess that's an issue @lofty hamlet
?
can client.users.get be used to get the bots that client knows of?
Hum
Fields have a name and a value
Thank you @lament kettle it worked.
I've been working at it for a bit. Never thought of setting the innerhtml to blank
Uh ok
But that should show as an error
mY BAD
The fact it doesn't means you probably have more issues
I have no error i go test with this
As long as they are cached @vague chasm
bots are technically users too
can I use client.users.fetch('bot id')?
Most likely
Since a bot ID and a user ID can be used in the same way(s)
@lofty hamlet your code isn't even reaching the point of sending the embed so of course you wouldn't see that error yet
and for checking bot status is this ok?
if (client.users.get('some bot id').user.status === 'online') ```
But why
???
My code is correct
It's difficult to help you when your code looks like that Nebulus
Like
You randomly use ;'s
They aren't necessary but either use them all the time, or use them never
You're still using var instead of let/const for whatever reason
If the code doesnt work, I would put a large doubt on it being 100% correct
🤔
oof i think he got embarrassed cause he just deleted his code snippet
Just try to clean it up
I mean, theres no reason to be embarresed. People here may be harsh but are honestly trying to help you make the best bot possible.
@vague chasm users.get() is already a user
so just users.get('id').status?
status is not a property of users
(assuming you're using v11)
@lofty hamlet why are you defining an empty let user just to assign message.mentions.users.first() to it later? Why not just const mentionedUser = message.mentions.users.first() and then you can do if (mentionedUser) right away.
It's just very strange
wait till the code runs
vscode doesnt pick up all errors by default
it shouldnt
its a fucking editor
?
Try to run the command and then look in the console for errors
No error
just because there's no syntax errors doesn't mean there aren't any problems
I have just no error dude
what happens when you run it?
I do not have any I know what I say
Those console logs you had before
does the command work?
Never showed right?
If i don't mention a user it's okay error else return message.channel.send("Vous devez mentionner un membre !") is okay but if i mention nothing is happening
@vague chasm whats your code,
nvm I got it
lol ok
Yes
I have exactly the same code or almost on another command and it works
if you mention yourself, does the "tu aimes ton profil" work?
Maybe your msg includes the mention
Which causes that command not to do anything when you actually mention someone
console.log(user.id) and console.log(message.author.id)
If i mention a personn not work but if i mention nothing it's write message.channel.send("Tu aimes ton profil ? Tant mieux")
Wtf
What is msg
I have exactly the same code or almost on another command and it works
No msg work
Show it anyway
@lofty hamlet did you write this code yourself
or did u get it from somewhere else
Yourself
console.log(user)
it's undefined yet it's not sending you the "vous devez mentionner un membre" message?
Yes
console.log(message.content,message.mentions)
If i mention personn mention console.LOG not work
A server I moderate wants to use a new role on join system and needs to give everyone in the server a role. I've written a quick bot to do this but I don't know how many seconds I need to leave in between each role addition for the bot to not be rate limited, cause at this scale that would probably end in the bot being banned. Anyone got any clue of a safe amount of time?
But if i not mention hum it write a line in my console
I come back i go eat if you find a solution mp me i read after
where did you put the console.log?
@fleet horizon are you using discord.js? If so you don’t need to worry about rate limits. They handle it for you
Idk about other packages tho
please please please show defining msg
If it's just message.content
That's your problem
How is that the problem
put the console.log before fonction.channellogs
Because OwO @late hill !== OwO
@fleet horizon once per 2 seconds
Sounds fine if you wanna go safe
PATCH Member ratelimit is 10/10s
@late hill what ?
wait how many times can I change the bots play status per minute
Euh dude ?
stop right there
Onii 5 times i believe
okay thx
@lofty hamlet I would suggest seeking professional help asap
what language?
add a code to what
@patent epoch
Do you know any programming languages? If so, look for a library to build upon in that language. If no, I would highly suggest learning at the very least some basics before undertaking a bot. Bots are far from trivial.
Some good languages for beginners are Python or javascript.
@patent epoch https://discord.js.org/
Well they never said they used JavaScript...
Ok people so I’m trash at this and
How do I get my server count on the bot site?
It says I gotta have a webhoook
How do I set that up?
I use discord.js
Static.push(message.guild.emojis.map(a => a).filter(a => a.animated == false))
Static.map(a => `<:${a.name}:${a.id}>`)
let staticdisplay = Static.join( )```
**How to randomly select 10 emojis** 😦 tried so hard but failed
or is their a better way?
what language
discord.js
i think there is an easier way
do the emojis have to be different
yep
yes
yep
and what if the guild has less than 10
a sec
well it will just post the amount it has
...
const emojis = []
const mapped = message.guild.emojis.map(x => x.toString())
for (let x = 0; x <= 10; x++) {
const item = Math.floor(Math.random() * mapped.length)
emojis.push(mapped[item])
emojis.splice(item, 1)
}
console.log(emojis)
thats more like what i did
yeah I dont see any prooblems there
loop 10 times
push a random entry
remove that entry from the mapped emojis so that you wont get duplicates
emojis.sort(() => 0.5 - Math.random()).slice(0, 10); 👌
oof
yeah
js hax ways
don't use random data for sorting
lul
yes
Is it the guild count?
i think so im not fully sure
link to bot page?
@amber fractal meet me in falador
I dont see the N/A anywhere. I am guessing it is the guild count. If you dont already post that you can learn how to in #topgg-api




