#development
1 messages Β· Page 586 of 1
frick
my prefix is used
TIME TO CHANGE IT
@loud salmon i removed cmd_ and it still dont work bero
bro*****
rewrite or async?
Hello, there will be way that you help me for the API ? please π¦
I do not understand anything
e = discord.Embed()
e.set_image(url="
I am wondering how I can make my bot upload an embed image a Discord channel. I know how to make it send embed messages, but how do I upload an embed image? Is it even possible with discord.py?
Ke...
This is for java script
https://anidiots.guide/first-bot/using-embeds-in-messages
ty
No Problem
@minor kelp what language you on
Python
Are you on rewrite?
Indeed
bot.is_owner
where does it go
just dm
It goes under @commands.command
A Cogs Example for the rewrite version of - discord.py - bot_example.py
guys
somebody can help me
how to see bot ping? how to add to code
when i write *ping
he say him ping
Read the docs
The discord.js docs
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
Client = discord.client
client = commands.Bot(command_prefix = 'b-')
Clientdiscord = discord.Client()
@client.event
async def on_ready():
await client.change_presence(game=Game(name=' oniichan '))
print('Bot Created!!!')
@client.event
async def on_message(message): so this is what i have so far, what do i do next?
The documentation, not the examples s my h
What do you want to do?
what do i do next
What does he even want to do?
Scroll up
ty
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
Client = discord.client
client = commands.Bot(command_prefix = 'b-')
Clientdiscord = discord.Client()
@client.event
async def on_ready():
await client.change_presence(game=Game(name=' oniichan '))
print('Bot Created!!!')
@client.event
async def on_message(message): so i got this far, what do i do next?
can you be more specific
What do you want to do next?
make it online
Did you run that code?
lol
how do i run it on pycharm
Google how to run it
hmm
how to add ping to code
test message
message.channel.send('test'here how to add ping?)
why does my bot keep leaving the server?
somebody can help me
how to add ping to code I can't
message.channel.send('test'here how to add ping?)
all sleep?
Maybe learn to code
bot.on('message', msg => { if (msg.content.startsWith(prefix + 'ping')){ let embed = new Discord.RichEmbed() .setTitle('') .setDescription('Pong\π | Ping'+ Math.round(client.ping)+ ' ms!') .setColor('0x2c69d3') msg.channel.send({embed}) }});
ohh this discord
when i write
*ping
bot crash
somebody can help plsss
???
all in school|colleges|work ye?
ohhhh
can u help with ping
how to add in a code
.setDescription('Pong'how to add here ping?)
peter so can help me? u know how? or can find docs, not discord.js or discord development
wait
bot crash
you are being very vague
provide more context you are talking like a caveman
id mention you if i was referring to you
lol im too know it bad
k
@unique nimbus so?
idk sorry @silent cloud
same
@silent cloud nobody gets what you are talking about, explain your issue with more details
Nice
sure, but dont paste them in here, put them in hastebin or something to prevent chat clutter
@surreal peak
Wat
nope
adjust it to your code
Define client
the code you copypasted needs a DiscordClient named client, while yours is named bot
no
No
@void mantle you here?
Learn how to code then use a discord library
because you are underestimating what it takes to develop a bot
um
?
@earnest phoenix Don't use common prefix commands and commands go in #commands anyway
Jonny, that's him
ohdear
gone
you-- did not just... ask for merc--
i cant
Yes, being under 13 is bannable
discord tos doesnt allow people under 13 to have an account
how old are you?
me?
yes
14
hmm
hmmm
just wondering what was interesting about the 10yr old being banned
i might know of a fella in here
Can you calm down, reduce the amount of messages you send to get a single message across and be more mature.
i ask bcs i dont know if user old under 13 he got ban
Okay thank you
so can somebody help me
if u need show how many users use ur bot it bot.user or bot.users
?
i think users
Have you tried reading the docs?
i read but i see user or users and ask what is correct
bot.user is the user the bot represents
Read what they do
And that
If you read the docs correctly you wouldβve known this
hey guys can help again xD?
how to edit voice channel name
bot.setName
?
bot where he set name
i thing that wrong
how i can edit voice channel by ID?
bot.voiceChannel.setName(bot.users.size)
it is i think without ID
Read the docs :) @silent cloud
was read
but nothing
// Set a new channel name channel.setName('not_general') .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) .catch(console.error);
but
where id
Id is used to find the channel. In the example the channel is already known, so no need to find it again
?
let channel = client.channels.get(id)
Yea then use the setName function on the channel
get the channel, .setName() on the channel
@harsh nova
why bot crash?
let channel = client.channels.get(554623627887378454)
if(bot.users.size > 0){
bot.channel.setName('Bot users: '+ bot.users.size)
}
});```
ohhh
i know
lol
no
again problemm
let channel = bot.channels.get(554623627887378454)
if(bot.users.size > 0){
bot.channel.setName('Bot users: '+ bot.users.size)
}
});```
try let channel = bot.channels.find(x => x.id === '554623627887378454')
Every single time you run into one single little error you should try to fix yourself before immediately asking for help, it'll help you and us. And I suggest trying to like, learn some js instead of copying code
π
not working
Youre thinking the wrong way, more like youre nit thinking at all
You just want people to do it for you
so?
Learn
Sigh, they never learn
Learning and testing is mandatory, period.
When you define a variable, ie let a = b you cant do something like something.a.... The variable you created has nothing to do with it. In your case, you created channel, so it has nothing to do with bot
You cant do bot.channel as that implies channel is a part of bot, but you just created it, so naturaly its not
If you learn some basic javascript and programming, these things are easy to solve
You wont learn anything by blindly trying shit out
So just use channel to access the data about your channel (channel.users.size for exemple)
The discord.js doc is good to know were infos are
Wait
It was an exemple. I presume the bot your are talking about is a Client so search in the Client section of the doc to know what datas and methods you have access to
He doesnt understand the docs
yes but i need
i was reading docssss
Click on collection, then click on map, as a collection extends map
i know how get users
but
i need paste that users in a voice channel name
in docs i only found .setName
thats ALL
Let's see how quick I can find it
Just use the setname
But instead of text, you put the code that gives you the user size
You want the name to be a collection of user objects?
I just told you how
Like that?
The number one
bot.users.size returns a number
You cant set a number as the channel name
Im guessing you were getting ERROR TypeError: (_data.name || channel.name).trim is not a function
You misunderstand
"2" !== 2
ye
very cool
@silent cloud I recommend you fully learning javascript
and maybe improve your english a little bit more to make it more understandable
Yeah, learning js will help you immensely
Instead of always struggling trying to piece stuff together
yes
Is there any guides in Russian so you can understand it better
Search Javascript Tutorials
@silent cloud
i was read that guid and watches video with 1hour
and now have error
TypeError: Cannot read property 'setName' of undefined
When it says you cant do a method on something, it means the thing you are trying to do it on is undefined
So the channel wasnt found or doesnt exist
and what i need to do
get channel then set name
we should make a flowchart for "i want make bot but idk code hlp"
im again here
xD
now
TypeError: Cannot read property 'get' of undefined
code
bot.on('ready', () => {
let channel = bot.voiceChannels.get(554623627887378454)
if(1==1){
bot.channel.setName('Bot users: '+ bot.users.size)
}
});
Please for the love of god try and learn Javascript before making a bot
if 1 == 1
yep xD
Manually
no way
Maybe check patreon api
Yeah there is an API for patreon
but how do i add users to my page with that api
i don't understand shit of the documentation
can someone help me with that please
Why are you asking us
@chrome olive probably a 400 request
Need help with java
@pallid zinc JUST ASK
can anybody who knows patreon API, help me please
Where I can deploy my bot 24/7
on a server
Lol
I now
Ya
i think u know it
Which
You could get a 2euro vps
Nooooo
||heroku||

yeah, a python bot doesn;t need that many resources
still
I don't think u need more then 512 mb ram
and a dual core processor with 2~ ghz
hmmm
Ye python needs cpu
@trail hearth can you give 2euro link
i don't have a link now
but u can search on google
cheap vps
and u can find some
for 2 euros
Ok
scaleway offers 2β¬ vps
@trail hearth that 2$ vps. Does it support discord.js
like can it handle my javascript, D.js bot
its quite big
wdym
if he has a lot of background tasks which run the whole time
on my pc?
wdym background tasks in my bot
but a 2-3 euro vps should be enough
Google cloud is good or bad
?tag host
I recommend Heroku π It's free.
No
no
heroku is bullshit
ik
π€¦
even glitch is better
@loud tinsel heroku is shit
u get so much ping
Why?
Glitch is better than heroku
@trail hearth the website name
I verifed my account via credit card.
I need to code more to host on heroku
- Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
- Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
- Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)
- Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.``` @loud tinsel
Just pay for a cheap vps heroku and glitch are both shite
Note: This is a list of hosting, not a backing/support for them. You will need to make your own decision.
- OVH: https://www.ovh.com/us/vps/
Starting at $3.35/month (USD), 2GB RAM and 10GB storage, high reliability. - Digital Ocean: https://m.do.co/
Starting at $5/month (USD), 1GB RAM and 25GB storage, high reliability. - Linode: https://www.linode.com/
Starting at $5/month (USD), 1GB RAM and 20GB storage. - Vultr: https://www.vultr.com/
Starting at $2.5/month (USD), 512MB RAM and 20GB storage, plan only available on certain regions. - Amazon(AWS) Lightsail: https://amazonlightsail.com/
Starting at $5/month (USD) (first month free), 512MB RAM and 20GB storage, high reliability. - Time4VPS: https://www.time4vps.eu/
Starting at β¬2.99/month (billed every 4 months for β¬11.96/quarter), 512MB RAM and 20GB storage, free backups. - VIRMACH: http://virmach.com/
Starting at $1/month (USD), 192MB RAM and 10GB storage, free DDoS protection, 1 CPU core. - VPSDime.com https://vpsdime.com/
Starting at $7/month (USD), 4 CPU Cores, 6GB RAM, 30GB SSD Storage, 2TB Traffic and 10 Gbps Uplink - Servercheap https://servercheap.net/
Starting at $4.50/month (USD), 2 CPU Cores, 2GB RAM, 30GB SSD Storage, Unmetered Bandiwdth - Scaleway https://www.scaleway.com/
Starting at β¬2.99/month (Euro), 2 CPU Cores, 2GB RAM, 50GB SSD Storage
Enter the Cloud with your VPS: fast and cost-effective! Root access, 16 GB RAM, 100 Mbps, 200 GB HDD, 100% flexible. Starting at $8,99/month!...
Providing developers and businesses a reliable, easy-to-use cloud computing platform of virtual servers (Droplets), object storage (Spaces), and more.
Cloud hosting for you. Instantly deploy an SSD cloud server running with your choice of Linux distro, resources, and node location.
there you go, it's in the pinned messages
Every month, Heroku give me 1000 hours
which one is the good one
that doesn't mean it's good
with 2$
but if it's good enough for you then it's ok i guess
I need to code alot for heroku
Ok π
scaleway for example
@trail hearth which one is the good 2$ vps
@pallid zinc a lot?
i can't say that I had a vps at them
I am hosting my bot on a dedicated server
so yeah
OVH is good I've used them before
yeah they are good
Heroku never deploy my not
I used to have a dedicated server at them
@loud tinsel yup
They all are reputable the ones in pinned
Glitch better
you can't expect a overkill performance for a 2 euro vps
it will be good enough to run your script
and that's it
Yup
what if my bot needs 2gb of ram
There aren't other alternative for free.
@inner jewel bot need just 1gb
then yasmin we have a problem π
I wanna add my bot to discordbots.org
Glitch
go on the website and post it and wait for the verification
Heroku
Then do it and wait
Btw what about my bot
Can I edit bot's website another time?
Yup
ok thx
I wanted to know when my bot will be tested to keep it online
you just have to wait
there isn't a estimate time when your bot or someone elses bot will be verified
patience and that's it
everything is verified by a person so that takes time, there are a lot of requests π
and you should keep your bot 24/7
Unfortunately I can't run my bot 24/7
then why do you want it to pe public on discordbots then π€
It currently even runs on my phone...
Oh god
hello
Yup I'm dumb
Yeah good luck developing that shit bud
But it's open source as public domain
If you have to host on your phone, this is the one time I'd suggest to use a free vps like heroku or glitch
In my opinion developers should post their bot on discordbots
only if they want it to pe public running 24/7
but that's my opinion π
Ye, no point in advertising your bot if it don't work
Well...
Hosting on your phone is just an awful idea
Only recommend glitch
Especially if you want to actually keep it up
Heroku is made for websites and shit like that
Yet it still keeps a bot up
Barely
Depends on the phone
Mmmmmnah
Yeah
I ain't talking processing power, I'm talking reliability
Can guarantee that a note 9 would be better than heroku, if it's on a decent lte network
Data persistence
I agree with canarado.
So spending money on a phone and paying out the ass for reliable internet is better than a free option, especially since people are usually desperate for affordable options
Sounds dumb to me but ok
My phone would be better too with 24/7 wifi
Who said you had to pay for it
A lot of people keep their older phones when they upgrade
Where the hell am I getting a note 9
That was an example.
Get note 7 to explode XD
And again I ain't talking power
I ran an s5 with a bot for a bit and it worked fairly well.
Ahaha π
My BQ Aquaris x pro works very well too
Only issue I had was my charger port was crap.
I think you're joking
hi a person would have an idea for the code in Node.js of the command !say
The server comes even cheaper.
you'd need to tell which api you're using lol
yes, I do not find a code that matches @lavish forge
You can't just make an umbrella statement of bots aren't that intensive
Depends on language
Not even that
Python isn't very intensive
Some bots just do way more shit than others
And require some power, but that wasn't even the point lol
Yeah but my bot only responds to commands and does nothing else
@dusky marsh i know what do you say, but can say how to get voice channel id by code?
If that's all it does and you want it up 24/7 glitch is a good option and no one else can say otherwise :P
Yknow I didn't think about that
Hold on
Ah yeah it doesn't support py, I should've guessed, well then
...
My bot will go offline now... like me π’
If you don't wanna use heroku which will work in the short run, I can suggest chipping out a few bucks for ovh :P
what's ovh
Just a cheap host, but one more thing before I gotta go, I found something www.pythonanywhere.com maybe check it out
Saw it on a forum maybe it can host your bot
@dusky marsh
i know what do you say, but can say how to get voice channel id by code?
@silent cloud read the goddamn docs, not the examples
Quit pinging me, I said before what you should do
read the docs, everything is there
i dont seen see only what i found
GET/channels/{channel.id}
Get a channel by ID. Returns a channel object.```
and
The ID of the category parent of this channel
Type: ?Snowflake```
ohhhh
sec
bot.on('ready', () => {
let channel = bot.channels.get('554623627887378454')
if(1==1){
bot.channel.edit({ name: 'Bot users: '+ bot.users.size})
}
});
for you
bot.on('ready', () => {
let channel = bot.channels.get('554623627887378454')
if(bot.users.size = > 0){
bot.channel.edit({ name: 'Bot users: '+ bot.users.size})
}
});
the channel part is correct, the rest is a big wtf
=
oh wait
??
ye xD
It's >= for greaterthan or equal to
just use >
^
if you do >= then it will still work with 0, which you dont want, apparently
bot.on('ready', () => {
let channel = bot.channels.get('554623627887378454')
if(bot.users.size > 0){
bot.channel.edit({ name: 'Bot users: '+ bot.users.size})
}
});
what's with the bot.channel part
yes, now the rest is wrong too, i told you before
you define it as channel 
you cant use bot.channel
channel.edit?
yes
bot.on('ready', () => {
let channel = bot.channels.get('554623627887378454')
if(bot.users.size > 0){
channel.edit({ name: 'Bot users: '+ bot.users.size})
}
});
let i try start this hell machine
xD
nope
ohhh missing )
If it's one on top of the other why have it there?
cause its gonna be a hover thing
its suppose to be like that
like the black one is the background which comes out when u hover
You can change color on hover
and the white one is the default
no but like this happends
look
the white and black in the other 2 are not aligned
how do i align them, look at the code
I don't do a lot of web development, I offered what I thought would work
k :/
whats not aligned?
What's the best programming language for discord bots?
I'm using python
It has some problems.
I use it too
there is no best, all languages are good
Most people here use python or javascript
each has its advantages and disadvantages
Yes
which doesn't mean they're the best
nothing can be the best
more complex languages such as c#, java, go, etc... can be more performant, but harder to work with, while languages like python and javascript are very easy to use, but might have worse performance
then you'd use C or C++ lol
Not really more complex
compared to javascript they are
thats not what im talking about
javascript is a simple to use, very high level language, you dont need to worry about memory management for example, the engine does it for you
you need to keep that weird behavior in mind while writing code
Just like Java or C# lol they have gc too
C/java are lower level languages, you need to do many things yourself
even if they have many similar features, they're still much lower level than javascript, which makes them more complex
one is written in C++ and one in JS/HTML/CSS/etc.
C++ has much less memory usage
what exactly are you arguing about? thats exactly what i said
lower level languages = can be more performant, but are more complex and harder to use
js is harder to use than c++
no it isnt lol
Disagree
look at classes and inheritance
Tim do u know java
just say what you need lol
python is super gud
Javascript is best, no doubt
Just logic
Should I have a Command interface
Or a Command class
And have each command being a subclass

which api/language
Java
which api
I think it does
for example in JS there is no multiple inheritance, not even interfaces
Alright
and each command should be a class
And do you have a specific reason for that
why TF is that underline there
I mean my first thoughts were to use an interface
But then I saw examples of people using a class and subclasses
so
Idk man
I question
first off all, it's a better way to organise ur code
does anyone here know how to use patreon API
nope @spare glen
:/
@spare glen http://www.googledaariyim.com/?q=patreon+api
i dont understand any of the api docs
ok my bot will be offline again
hello please help me for the command "say" in the language Node.js
please contact me in mp
how can i make my bot prefix work for all "mod ", "Mod", "MOD " and whatever
π
convert the message content to lower case and save the prefix in all lower case
Actually
there may be a better way
just how I do it
how do i see how many characters are in a var in js?
idk why #development is Google search bar for a lot of people
because "you do it for me i dont feel like it"β’
ok this is driving me nuts why do i get the error UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'bot' of undefined at module.exports (D:\Programs\HuskyBot Dev\events\message.js:18:25) when its clearly defined??
module.exports = async (message) => {
if (!message.author.bot) return;``` (cut out end of code for char length sake)
I just have a question, why are you returning if it isnt a bot tho
btw for reference message is being defined
um idk
it is in a other file
but idk
I've done this before and it worked
are you sure message is actually a Message object
have you tested that
well then you can't be sure
hello
use any other prop e.g content on the message
if that's undefined then the object isnt a Message
ok um its trying to define something else
so you where right
not message
and idfk why
Hello, I wanted to ask how to use a package in a HTML's <script> because it says require is not a function and node.js is not installed on the ftp my website is.
HTML != node
ik I want to use <script> in it
You don't
You either host your webserver with node, or you do some weird shit, both of which I've had trouble with in the past
You can't run node code in <script>
You cant.
Then it means I need to host website using a .js file??
To use node code
(http.createServer or express)
I need to .require() a package
discord.js
what
To send webhook
Why do you need discord.js to do that
Can you give me an example as I didn't use fetch ever?
Thanks
Yw
So I need to post to webhook link?
Yes
However
People can use the webhook link to spam and mention @ everyone
So you need to be careful
Ok.. I am using password thingy too
If it's in your html they can see it
^
Use \:emoji: in discord and get the actual emoji string
ty
Um where should I store and import my password from, then
im not nitro but i need to get anim emojis
Or devtools
when you import anything with html, they can see it
@silent cloud what lib
js
Lib
you can just get and toString() in d.js
what lib?
In d.js you can use message.guild.emojis
oh
fetch(url, {
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: 'foo=bar&lorem=ipsum'
})
.then(json)
.then(function (data) {
console.log('Request succeeded with JSON response', data);
})
.catch(function (error) {
console.log('Request failed', error);
});``` I am not familiar of sending webhooks without WebhookClient object π€·πΌ
A webhook is json
So what do I do to send it
post json to the webhook
headers: { "send": "like this?" },
in title can be anim emoji?
I know how to post but...
can work in title
Please also use google, it's there for a reason
in the post request
Literally
I wont just tell you
oh so no body or header, just the json webhook data in place of them
how do i make it so it shows users and not
servers
like in the game status
like for the game status for servers
${client.guilds.size}
lol np
do you want to use them like send in a message or create ones in code
\Emoji
then you copy paste what it is
into command
<a
551192371979616277> is one of the examples
not work+ i cant write \emoji bcz im not intro
and see that
:thinking:
not work
i write \ and emoji
If it comes straight from discord you can just put :thinking.:
because that emoji is not here
oh it is nvm
escaping doesn't work properly on mobile
you'll have to use desktop
for animated emojis (if you're not nitro), you can programatically fetch them
i dont
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=emojis
this offers you a collection of emojis, you can filter out ones which are not animated and map the rest to <a:name:id>
A very stupid question but.. can a bot add a bot to a server?
nope
the captcha stopped bots doing it
Ah ye
and the endpoint is unavailable to bots
It was captcha'd after someone invited like 50k bots to their server
People like that ruin it for everyone
i mean they were testing?
@inner jewel
actually?
huh i guess i misremember
or did the thing i remember also happen
hey guys
hey
how can I define api latency?
idk why you think it
is complicated

if that's what you're looking for
not really xd
Then idk what you want
its ok tho π
i've a ping command but I just needed the proper definition of it
The latency if you want @smoky mica
Its the latency
Of your bot to the server
Response time yeah?
Yes
Aight


-> !