#development
1 messages Β· Page 1265 of 1
which you can then use after its been collected
weird design to add delay but okay
also you need to log in with your token or nothing will work
But what's the main issue tho I'm confused
idk what they want to accomplish either
No issue I just don't know how to get it compatible with discord. Like to make the actual bot work. I have the code but not anything else
The bot doesn't respond? Not online? Command not working? Error? Unexpected behavior?
Rolan, here
No issue I just don't know how to get it compatible with discord. Like to make the actual bot work. I have the code but not anything else
@earnest phoenix I see
@earnest phoenix https://discordjs.guide/
Just make the bot login, that's all you need
I don't know how to do any of this from my phone and how to get the token into termux. Or how to make the actual bot work
read
TERMUX
oh my god sMn
termux for bot hosting is like using a butter knife to cut a iron bar
const canvas = Canvas.createCanvas(512, 512);
const ctx = canvas.getContext('2d');
ctx.fillStyle = hexCode;
ctx.fillRect(0, 0, canvas.width, canvas.height);
how do i save the canvas as an embed thumbnail not an attatchment?
^
to send it in an embed, you have to first upload it somewhere, get the url and use that url in the embed
yup
:( ok
upload it to some trash channel in a server you own and grab the link from that message to use in the embed, for example
You don't have to actually send it and grab link
No
embed thumbnail doesnt resolve on buffer
MessageEmbed
.attachFiles({ attachment: ctx.canvas.toBuffer(), name: "Something.png" })
.setImage("attachment://Something.png");```
Np
This is my first time making a discord bot. I have the code and it should run. But I need somebody to walk to through getting everything into termux. I tried reading a guide but I'm still lost. Can somebody help me out with this. It will take a bit but it's my only chance as of now
Why you so keen on termux?
Because the only way I can run this is on my phone
why u rinning it on the phone?
Because it's the only way I can run it
use a vps dude
And I don't know what a vps is...
give the man a class on how to run bots on mobile
<Wait aren't i the mobile dev>
They were trying to help me earlier but it took forever to instill
auger is the one RUNNING the bot on mobile
i believe you are only CODING on it
(unless im wrong)
then you might wanna get some tips from voltrex rolan
So wait? Running the bot requires your phone being open on that program?
Yes
This is my first time doing something like this
You said you had Termux right
Yes
im assuming your phone will have to be repurposed for bots
unless theres something that allows for background tasks to be running
And I downloaded node. Not installed it yet
apt upgrade -y
I don't know how to
Run this command
It says nothing installed
0 for everything
Screenshot?
K now
apt install nodejs
It says it's already at the newest version
Are you on your bot's folder?
The directory
I havnt set up anything I just opened the app
I don't know where I am
cd <path>
Path should the directory to your bot folder
@faint prism
@opal plank why the ping
some brave soul attempting mobile bot hosting/coding
ah
cd changes directory
Yeah
I setup storage. Now so I do the cd command
Now do cd /sdcard
Then ls
Hm?
Do I need an sd card in my phone?
No
Second one was correct
The one that returned no response
Ok
Do it again?
Yes
And then do
ls
ls shows the files in that
Blue
Is your bot folder one of those?
I don't have a bot folder. I don't know what it is
I don't know what I'm supposed to have or what I'm not supposed to have
The hell, where did you store your code then
It's not stored. I wrote it on my Chromebook but it's my school Chromebook so I can't host from there
Umm, import it from there to your phone?
Like with an sdcard or something
It's literally just written in codeacademy
It's only 20 lines of code

I don't know. I've never done this before
codeAcademy?
Is that code from there or you wrote it
Yeah it's just a website. I wrote the code in the middle of a lesson
I wrote it
I mean, why not just send the thing from your chrome book to your phone
The code files
I don't have a file of it and I don't know how to make one
Is there a software I need to make the file?
email it to urself
And another thing is that I can't download anything
How did you write code if you didn't even have a file
I can write the code out by hand. I don't need to email it to copy and paste
In code academy you don't need a file period and you can't access the one that you coded into
Long story short I don't have a file and the only way I can make one is from my phone. How can I do that
Wait a second, you wrote the code on code academy website?
Yes. It does not run there as it has some discord stuff


Well time to rewrite that code again that you wrote on Code Academy
do you even know what you're doing
Not really. I have the code but when it comes to actually making it into a bot I'm lost
He is a bit confused but he's got the spirit
are you trying to make a discord bot and host it on codecadamy preview?
I also have to make something that can get my token but I haven't created the bot account yet. I do know how to format that though
And no I'm not hosting it there
But I wrote the code there because it has some good color coding
whew I was worried
He's trying to host his bot from termux but he wrote it on there
Well sad, rewrite it on a code file now
How do I do that
Make a new folder and then a new file with the extension of .js
And rewrite it in there
Um..
Where do I do that

You do that with a file manager app
I'm really new. I have been working for 2weeks to write the code. Andit's going to take me a little bit to get the file manager app
Is there a specific app I should get?
Wait I figured it out
What do I name the folder?
Whatever
Just your bot's name
I just named it bot
Although it's going to get confusing when I have more than one
K now inside of that, make a new file
Called index.js
It's not letting me make a new file. Only folders
So I need to download something to let me do that?
Show me
Inside of your folder
Well uhh
;-;
Download a file manager like File Commader
this channel exists π«
I'm a smol boi so my parents have to approve the file manager
if ((message.content.toUpperCase().includes('.ORG') || message.content.toUpperCase().includes('.GG') || message.content.toUpperCase().includes('.COM') || message.content.toUpperCase().includes('.LY')) && !message.member.hasPermission('ADMINISTRATOR')) return message.delete()
```hmmm any way to make this lot shorter?
Why the hell to do that
Well not smol smol but not tol
if ([".ORG", ".GG", ".COM", ".LY"].some(element => message.content.toUpperCase().includes(element)) && !message.member.hasPermission("ADMINISTRATOR")) return message.delete();```
Basic JavaScript
It's loops right
Absolutely incorrect
No it isn't that is for
Heck
I confused you sorry
It iterates through the array prototype to check every element applying to the given function, binding and checking if any of them comes out as true
what does .some do?
Yea but not exactly, because forEach isn't supposed to return a boolean @prisma oriole
@earnest phoenix
ohhhhhhhhhhhhhhhhhhhh
I'm here
yeah, forEach just does the iteration, .every and .some return booleans by the nature of their usage
That screenshot is all the commands I did to run it
is there a good use case for for each nowadays
His issue is currently not being able to make a file to write his code
it's quite slow and limited (you can't break and continue)
I did a performance test on loops once I think for each was second last
The only use for js Array.prototype.forEach() is you being too lazy to do an actual for loop
But this also resolves promises at the end if any given as a parameter
But any given function for it to bind through every element, it's way too slow
Bind takes some time
I'm quite surprised for of is a bit slow as well
Well that shows why forEach() is useless
Bind doesn't even take a millisecond but for each fucks it up
When I try to import a module from the ones installed on my computers through pip, it only works if I run the python file with the python.exe so python myfile.py works but myfile.py throws an importerror does anyone know why that happens, why doesn't the interpreter check site-packages when calling the file like an executable

Rip bind
how do i check if there are 3 numbers in my array that are the same?
so if 3 out of 5 numbers are the same return true
ahhh alright thanks
@earnest phoenix or
U can use regex
In an array?
No
For (let x = 0; x< array.length; x++){
For (let y = 0: y < array.length; y++){
For (let x = 0; z < array.length; y++){
If (array[x] === array[y] =={ array[z]){
Let sameNumber = true
}
}
}
}
Hehehe
For the website url

It's not completely formatted but it works
I dunno that's what I learned
That's the most inefficient way
Yup
But it works
Not for all types of arrays
True
@earnest phoenix did you get the bot running on termux btw?
No. I still need to get the file because it's taking forever for my parents to approve it
Long story
Add me as a friend and I can probably walk you through it
@faint prism does .net work eith C#
No
Or just framework
I see
Lotta good stuff in there
I'd compare it to nodejs, but it's a bit more than that
A lot more really
Long story
@earnest phoenix I've got a bash setup script for you to get you started
I made it for termux bot deployments
Que
@earnest phoenix it does not work
i wanted to check if there are 3 of the same numbers in the array
not 3 numbers = 3
which then the code you gave me would return true
@fervent goblet Are you sure about that
Here's a copy of my code, try again
let someArr = [6, 4, 6, 6, 2];
someArr.map(e => someArr.filter(element => element === e).length).sort((a, b) => b - a)[0] === 3;```
Maybe
Someone know how to do like when you starting live on YouTube itβs notification in any channel
Youtube auth is absolutely a hassle for that
im unsure if Youtube provides webhooks though
worth a google @low shard
π
Does DJS have an all events listener? 
Hmm this is annoying

having to create a listener for each event is such a pain
why listen to every event?
metrics
measure amounts of events received on the websocket
Jesus christ this is one girthy commit

tfw this is the smallest chess game script
@earnest phoenix https://github.com/DoorThief/termux-discordbot-setup
Did you just make that?
yes, in 10 minutes
And also how do I use it
No @faint prism I'm confused. How to use that. Also you are awesome
No @faint prism I'm confused. How to use that. Also you are awesome
@earnest phoenix
that's a bash command
you run that
or you can type out this:
#!/bin/bash
#Setup project folder
mkdir bot
cd ./bot/
#Install dependencies
apt update && apt install -y nodejs
npm i -g pm2 && npm i discord.js dotenv
#Scaffold bot
printf "require('dotenv').config({path: __dirname + '/.env'})\nconst Discord = require('discord.js');\nconst client = new Discord.Client();\nconst token = process.env['DISCORD_TOKEN'];\nclient.on('ready', () => {\nconsole.log(`Logged in as ` + client.user.tag);\n});\nclient.on('message', msg => {\nif (msg.content === 'ping') {\nmsg.reply('Pong');\n}\n});\nclient.login(token);" > index.js
#Set token
while [ -z "$token" ]; do
printf "Enter bot token: "
read token;
done
#Write token
echo "DISCORD_TOKEN=$token" > .env
#Start bot service
pm2 start index.js --watch
pm2 monit
chess?
@modest smelt this ? https://discordapp.com/channels/264445053596991498/272764566411149314/758499715389587478
If so, yes
The smallest someone has ever implemented chess in JS
Also how do i make a new folder through python
what i want to do is that when my bot joins a guil
guild*
it will make a folder such that it will be formatted like this:
JSON is data, not something that can actually do anything
there google search api probally is unpaid now
the one i have for my discord bot gets the ads too
@faint prism I'm here. What's next
Is your bot online?
Rip
Lol well it works for me
Its online
Nice
Now you're hosting from your phone, the development you'll have to figure out on your own though
How do I write the code it doesn't let me type
nano
?
I can't figure out how to type
When I have everything set up but I don't know where to put the code
@faint prism what's my next step. Where do I put the code
Where do I put that and what's nano
It's not letting my type at all
Oh ok. So do I need to download nano?
nah should be already in termux
Then how do I access it
you're in pm2 monit
You need to exit it
press CTRL and press c
that exits a program
yup
What's next
you're back to the terminal
Ok so how do I edit it
so type nano and the file name
yep
do you see the .js file
(it's kinda hidden by your keyboard in the screenshot)
Index.js?
linux on mobile?
That's all you need to know for that
π
What's next tho. ^0
linux on mobile?
@opal plank termux but yeah. Android is based on it
interesting
What's next tho. ^0
@earnest phoenix That's it really, your bot is running
by typing something
I'm not going to help you develop the bot. But I got you set up since you didn't have a PC π
It's up to you to learn Javascript and improve the bot
Ok. There's already some ping pong stuff. Do I take that out?
Here is where you can learn JS https://www.w3schools.com/js/default.asp
Or look up JS tutorials on youtube
I had error saying voice is not defined π€
interesting
@opal plank sorry, Android is based on Linux. So creating an emulator for it isn't too much of a stretch. Termux is more of a chroot iirc
TortureMux
Well, ones a chroot and the others a terminal multiplexer. Not really similar :kekw: but yeah
once you get used to it its infe
ah i see
As you've noticed, im no linux expert whatsoever

Yep!
tmux technically terminal no?
@opal plank no
It's a terminal multiplexer
Basically that means it's creating windows for multiple terminals inside of one giant window
Really useful for SSH sessions
i misread what you said
So you can just have one SSH session and multiple terminals opened essentially
I know you can use screens
misread as 'i know because you use screens'
thats precisely what i use it for
not having to navigate everywhere

I exclusively use screens at the moment, I don't know how to use tmux 
But it's On my to-do list, just like vim
Sweet
Wha
Tmux supports mouse?
set -g mouse iirc
I was intimidated by the key combinations
It's just a straight-up gui lmao
basically yeah
you can use it without mouse
but holy fuck does having a mouse access make a difference
Doesn't that need key combinations though
Yeah, that's the part that turned me off of it. With screens all I had to do was control A and then press D
Then it was just commands to reattach to sessions
ctrl + b
not quite
to get the mouse
[
ctrl + b then type that command above i sent
boom, gui with mouse
Ah
such a lifesaver for a scrub like me who uses windows
To be honest, Linux isn't as bad as you think it is. A lot of it works the same as PowerShell TBH or Windows batch
Talking about bash I mean, not Linux
yeah i get ya
Or SH, or zsh
Lol I kind of like CLI more
all operating systems are terrible
the real bois use machine language straight instead of a middleman operating system making it easier
I don't know what's wrong with me lmao
the only issue with terminals is learning all the syntax
the only issue with terminals is learning all the syntax
@opal plank disagree
powershell and cmd are almost exactly the same
though stuff like linux has its own thing going on
all operating systems are terrible
the real bois use machine language straight instead of a middleman operating system making it easier
@earnest phoenix have fun managing interrupts and multiple tasks at once
lol don't bring me back to 1947
powershell and cmd are almost exactly the same
@opal plank PowerShell is surprisingly advanced. It actually uses some similar libraries I use in C sharp
Ffs
i used powershell for most of my things tbf
Token leak
@earnest phoenix god job you leaked the token allow me to copy
go reset ur token
I already did
Ok what do I do tho
@earnest phoenix and then make sure you update your bot script with a new token
I mean to save the code
@earnest phoenix please store tokens in seperate files instead of directly storing it in the place where you're doing bot.login()
hardcoding tokens = big nono
I mean to save the code
@earnest phoenix CTRL and X and then press Y when it asks you to save
From inside nano
I mean to save the code
@earnest phoenix remove your keyboard from the computer, use a complex version of OTG to connect it to your phone then press Alt + F4
or ctrl + o and then ctrl + x
Yeah wtf
I did and it gives me a bunch of options
My bot script was using an environment variable, why do you change it to hard coded?
Lol
Voice to text
I know. I accedentsly deleted that and didn't know how to add it back on
My butt script was using an environment variable, why do you change it to hard coded?
@faint prism seems like the word botum has got control of your mind
thats an idea right there
Good luck linting that
But what do I do with the options
Linterize it
What?
I was talking about something else
It's telling me to enter more stuff before I save
But I don't know what it means
But I don't know what it means
@earnest phoenix watch a YouTube tutorial on how to use nano
It should only ask you two questions
Do you want to save?
And where do you want to save it?
The first one you'll say yes
The second one should default to the same file that you're editing
Ie You just press enter
Ok thx
Your script should look like this, don't replace the token line. You need to edit the .env file to update your token there
@earnest phoenix
nano .env
It's working
The bot
:)
just screech LIIIIIINT and it formats it for you
@opal plank i tried but my computer crashed
There's a problem
The bot spams the final command
And doesn't stop
Anyway I can fix this?
Nvm
I fixed the error
Do Google Calendar reminders work even when the webpage tab is closed?
My bot is VERIFIED!! π
Neat
I wonder if mine will get accepted,
we need to make the Shrek closing book meme for that
Hello, I am trying to make level role rewards command
but i dont know how to make it fully custom
so members can set the level they want in the database and the role
but add multiple levels and rewards
My bot is VERIFIED!! π
@feral aspen how long did it take?
2 weeks!
No no no, 7 months for that.
WOW
π
Good luck! π I hope you success.
client.on('messageReactionAdd', (client, data, message) => {
})
```How can I get the ID of the guy who reacted???
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-messageReactionAdd
messageReactionAdd only has two parameters:
right
so if you change it to those, then it's user.id
client.on('messageReactionAdd', (messageReaction, user) => {
console.log(user.id)
})
```like this?
yup
i might seem really really very dumb by saying this, but how to get a user with an id?
Do you want a user or a member of a guild?
user
then client.users.fetch('userid') will get you the user object
userS - typo
If you are using that inside of a command, then message.author should also have the user object
i just want something to send to me in dms
to make a command so the bot sends me something
oh okay, yeah then use client.users.fetch('userid').then(u => u.send('Oh hi mark'));
or something similar
3 edits, I am proud of myself 
Can you host a Discord botum on Google Firebase and is it worth it?
Hello
anyone alive?
+ firebase-tools@8.11.0
added 603 packages from 376 contributors in 206.419s





as a database? sure
but hosting your bot? prolly no
ok
unless you have the free GCP credits, then you could use the compute engine, but after it expires you will need to host it somewhere else
though I doubt if using the f1-micro always free tier instance is a great idea
lmao i host my bot with the server thats under my desk
and they only provide 1GB egress of traffic hoho
thats almost nothing but if your bot uploads attachments or images, 1GB won't be enough
oh okay, yeah then use
client.users.fetch('userid').then(u => u.send('Oh hi mark'));
can't it be#get? since get tries to get from the cache first, then fetch if it did!'t find it from cache.
no ones stopping you from that, but if the user is not cache you will need to fetch it anyways

One again what is the best vps option to host the bot?
Depends on size
great options and ones that are highly recommended by the community are galaxygate and contabo
To answer your question about a VPS, I currently use Digital Ocean and absolutely love it. Never is down for me, and always works well. I have used Galaxy Gate before, and don't really have a liking for it, but it isn't bad that I would go out and specifically say don't use it. I also have used Vultr, which I consider just as good as Digital Ocean when it comes to setup and pricing(for the lower end). DO has more features than Vultr and GG, though.
Digital Ocean starts at $5 with the following
-1gb of RAM
-1vCPU shared
-25gb SSD
-1TB Transfer(Bandwidth)
Vultr also starts at $5, assuming you want an IPV4 address, with the following
-1vCPU
-1GB of RAM,
-25GB SSD
-1000GB Bandwidth.
Digital Oceans addons include:
- Extra Block Storage, starting at $10/mo for 100GBS
- System Level Backups once a week, stored and retained for 4 weeks, $8.00 a month/20% of the Droplet(VPS) price.
- Many Distros to use, less than Vultr though
- 3 different Container Distros(CoreOS, Fedora Atomic, and RancherOS)
- An absolutely huge marketplace for applications you can put on your VPS
- Snapshots
- Custom Images
- IPv6
- Private Networking
- User Data
- Monitoring
- Many Regions(3 for New York, 2 for San Fransisco and Amsterdam, and 1 for London, Frankfurt, Toronto, and Bangalore) *Subject to change
All of which are free to use, unless otherwise stated in the above.
Setup is also a breeze with choosing SSH Keys or One time password, and you can even create duplicate droplets right from there.
Vultr Includes the following additional options
- Auto backups for $2.00/mo(any time, any day scheduled)
- IPv6
- Private Networking
This is just the tip of the iceberg of what both can do, and I suggest one of these guys. If not, you still do have plenty of options, but from my experience, this was my take. Any suggestions or comments please let me know.
I copied and pasted from one of the pins but you get the idea
Ok ty again
what do I code into my command handler to make mentioning my bot it's prefix?
Py or js
js...I've been wanting to for a while but am just now getting to it...this is what I have but it's not even passing this line so i know it's wrong```js
if (!message.content.startsWith(definedPrefix) || !message.content.startsWith(@worn warren)) return;
Ah sorry cant help u im a python guy
@fast trench so ur just trying to make the commands also respond to the bot being mentioned correct
right
try just splitting the content string by spaces
check the first index
see if its the the mention string
or u could use message.mentions i think it was
ooh didn't know message.mentions was a thing tbh
oh wait yes I did lol
this returns undefined if I do @Wildcat#2712 help
const botPing = message.mentions.members.first();```
How to setup DSL bot
all good thank you anyway I appreciate it
How to setup DSL bot
@cerulean grotto there's nothing to set up?
But
When I put DSL
Check my server
It isnβt there
Or wait lemme see again
@hazy sparrow #topgg-api
Alr sorry
all good lol I was just letting you know there is
@fast trench try js if (!message.content.startsWith(definedPrefix) || !message.content.startsWith(`@worn warren`) || !message.content.startsWith(`@worn warren`)) return;
hey i got stuck at node. my folder name to process the code anyone please help
<@!id> can also be a mention of the bot has a nickname
oh yeah I forgot about that option
hey i got stuck at node. my folder name to process the code anyone please help
@narrow cloak wdym?
nope didn't work @pale vessel
i typed coding for my discord how can i process that
idk what you are even trying to do? run the bot? like turn it on?
wait you're using ||
why
use &&
if one of them is false, it'll return
you only want to return if ALL of them are false
idk what you are even trying to do? run the bot? like turn it on?
@fast trench yes i want my bot to online
make sure that there is a module in that folder
then you should probably watch youtube if you can't even turn it on
@pale vessel ooooooh π€¦ββοΈ I'm so dumb...I've had that mistake before lol
make sure that there is a module in that folder
@earnest phoenix yes i downloaded bot module
wat
no i mean node
node js works off of a package.json and a lock.json if im correct
if there isnt a package.json / lock in that dir u ran node .
it will error out
because it couldnt find a module to run
@pale vessel nope π€ this is odd
how do you handle args
prefix length?
do you slice the prefix length before splitting args?
so plese tell me the steps to
usually it won't error if there is no package.json / lock.json. If you run a .js file via node file.js it should work, unless it uses npm packages.
or unless he just messed it up big time but i got no clue
i not understanded what do you mean
@pale vessel also if the pings are too much just let me know...I don't wanna get buried in the messages loljs message.content.slice(definedPrefix.length).split(/\s+/);
if you use mentions, don't you think it's slicing less than it should?
mentions are longer than the defined prefix
right π€
so it won't detect the command
yes and args depend on the definedPrefix's length
I don't have it rechecking when I check to see if it's using the correct prefix in the db
so change the length if it's a mention
ok yeah I'm lost
Hi
did you need help?
Yeah
then ask
a lot of google and youtube and code experience
How do i create a bot?
@modern sable I feel like this is just a troll...
huh?
-faq 3 -c @vagrant elk
@vagrant elk
How do I disable a command or a cog in discord.py in a guild? I have moderation and stuff, but I only need music, so how do I disable a cog or command so I cannot use the commands that are disabled?
I made a bot but it doesn't add to top.gg
please help me
@manic plinth go read #502193464054644737
yes stop asking everywhere
@fast trench I made a music bot, I wanted to add it to top.gg but I wrote the description or something but she did not accept
I didn't know top.gg is a girl. What error did you get? You should get an error at the top of the page
Brief Description error
Your brief description is probably too short, or too long. The actual error should be below that ^
too short
Well, come up with a longer brief description
okey
How do I disable a command or a cog in discord.py in a guild? I have moderation and stuff, but I only need music, so how do I disable a cog or command so I cannot use the commands that are disabled?
@fast trench I made a music bot, I wanted to add it to top.gg but I wrote the description or something but she did not accept
@manic plinth wrong channel and dont ping me
bot is offline with no apparent reason, I made 0 changes since it was last online
itβs also discord.js
It says what happened...just try to restart it until it works
tried for a while
is it possible to create a new instance on mobile or do I have to use a computer for that
@balmy mortar inline
im trying
embed.add_field(name="**Instagram:**", value="[@trusted](https://www.instagram.com/trusted/)", inline=True)
embed.add_field(name="**Kik:**", value="[BeaM](http://kik.me/BeaM)", inline=True)
embed.add_field(name="**Telegram:**", value="[Boyfriend](http://t.me/Boyfriend)", inline=True)
embed.add_field(name="**OGUsers:**", value="[Beam](https://ogusers.com/Beam)", inline=True)```
which would i make true and false?
All true
you need to add a blank field but that would look bad on mobile
but if you still need to, you can add a new field with the name and value set to \u200b
add that field after the kik field and set it as inline
So I've been wanting my bot to add a role via mentioning a user ID instead of @ mentioning them as well as mentioning them in the welcome message after granting them the role manually. However I've been encountering a lot of issues trying to get it working.
(I have a basic knowledge in javascript just to point it out)
personal comment for the day. i HATE reaction role pagers for help embeds. they never seem to work right, either you cant navigate across multiple pages because after one click of the βΆοΈ it then ignores other clicks, or theyre just plain broken. Theyre a usability nightmare, you may think theyre cute, but they suck. stop it.
the only thing worse is bots that delete their own help embed with a short timeout while youre still using them!
My one function requires a return type of Promise<number>. How can I return a value say the number 12 like that? I'm using typescript
return new Promise<number>(resolve => {
// code that gets the number somehow
resolve(number);
});
@cinder patio I don't know it says, its return type is Promise<unknown>
new Promise<number>(... sorry
hmmm, thanks. It works
discord.py rewright
@bot.event
async def on_reaction_add(reaction, user):
l = 0
o = 0
channel = reaction.message.channel
if (reaction.emoji == ":white_check_mark:"):
l += 1
elif (reaction.emoji == ":x:"):
o += 1
if (l==5 and o != 5):
await bot.send_message("the vote has ended and most of the people chose yes")
if (0==5 and l != 5):
await bot.send_message("the vote has ended and most of the people chose no")
why does this not work??
can anyone help
You are setting o and l to 0 every time
No
how can i make it 0 once?
@golden sinew
Are we just ignoring the fact that zero IS NOT equivalent to 5?
Ok
thx
Alright
np
What the fuck
@violet mesa bot.send_message doesn't exist
And besides that, you didn't point to where you want the message to be sent
Congrats, it's older than me
Didnt they change it?
Yes
idr what to since i deal with js more so
get a channel object, use its .send method
im stoopid no yell please
1 sec
I want to assign a role to a person who writes something like test in her special situation, for example.
how can i do it
c
should i try to host a botum on firebase
Can I make this somehow ignore special characters from roles?
Lets say, I have a role named: ++CoolGuy++;
I want my bot to ignore the pluses, and also accept the input without the pluses
is there a way to do that?
Can I make this somehow ignore special characters from roles?
Lets say, I have a role named: ++CoolGuy++;
I want my bot to ignore the pluses, and also accept the input without the pluses
is there a way to do that?
@stable eagle of course but it'll take EFFORT (smth that seperates noobs from true programmers)
okie
How do I get an Client ID?
How do I get an Client ID?
@regal mountain Goto your application page on the Discord developer portal then on the main page click copy ID
@flat pelican decancer name
they have my name on... that
Pretty sure they meant all the extra stuff on your name
tf
eri-chan~
If anybody know how to access my code to discord bot
can someone pls help with my bot ill give 3 months nitro
How to keep it online
can someone pls help with my bot ill give 3 months nitro
@severe timber I'll help!
r u good?
Yes.
@severe timber help man
dm ne
ill invie u to repl
Okay!
rent a vps and host it there
the first step is to make the tiniest bit of effort to learn something on your own by researching
Ok next
you've clearly not even passed the 1st step
@woeful pike ok ok
Hahahha
<% user.guilds.forEach(function(guild){
}); %> HELP SHΔ°TY V12
i keep getting errors at my first line of code i dont know why tho here is my code
Dconst discod= Reqire(βdiscod.sj)β
i am not sure why
Lel
english
ok
thats gotta be a joke....
It is lel
Can u gift bots nitro lel
no
bots already have like a half tank of nitro, so to speak
as they can globally use emojis
and use animated emojis
smh imagine discord giving bots nitro permanently but not users
theres more to nitro than just global emojis
through the discord api
isnt there like rate limits?
of course
Well but it requests alot tho
but like any smart developer, top.gg's devs respect rate limits and cache lots of info
@hearty wren here
Thanks and sorry i posted in the wrong channel
No worries
Guys i accidentally uploaded my bot on github and discord said they had reset the token so i generated a new one and replaced it and committed the changes and pushed it to heroku but now its offline, can anyone help?
See Heroku logs
Ok one sec
did you wait
did you turn it off then on again?
Yes i did too
so today you learned that tokens dont belong in your source code, they belong in a separate config file or an environment varaible? π
also, .gitignore.
same
I also learned about workspaces in vs code
amazing
i use a .json config file, which is in my gitignore.... i have too much config to be manageable in environment variables
I didnt even wanna push it on github
api keys for a whole bunch of apis, two discord bot tokens, a list of server ids...
a live bot token and a dev bot token
oh makes sense
if i run my bot as ./bot -dev it uses the dev token, otherwise the live
what if I do client.login twice 
but i have my dev bot in a different workspace
with 2 diff tokens
I was pushing sth else to my repo that happened to be in the same directory as my bot folder so vs code initialized git for the whole directory including both folders
so i don't fuck up
i sometimes use my live token in my dev environment, in something i call 'test mode'
I made a new heroku application and pushed the bot and no errors and logs r perfect but its still offline
test mode is live token, with a setting from the commandline flags that makes the bot ignore commands on all but a predefined test server
that way i can test to check the code scales, with thousands of servers, without the bot emitting two of everything
that sort of thing is really worth it btw
bruh someone sent me a voice mail but i can't even check it because i got no credit
just be careful if you do it, that you dont do anything that loops and disables your live token π
wait, you pay to retrieve voicemail? what backwards-ass country is that
UK lol
next thing youll tell me you pay to receive sms, like americans do 
unless it's my sim provider
time to change provider? O2 doesnt charge me to listen to voice mail
vodafone have the signal strength of a one armed man doing smoke signals at night here
and then theres three... well theyre a joke everywhere
my signal strength is so bad
ive not used voda since the early 2000's, they were pants back then
imma just not change my sim provider
don't really care about a voice note
oh shit we went off topic lmao forgot this was #development
guys i fixed it and working now sorry to bother you
nice
i forgot to add config vars to it on heroku it seems
Yo guys
Can somebody help
What is wrong here?
const ytdl = require("ytdl-core");
it package.json
"ytdl-core": "^3.2.2"
what's the error
@earnest phoenix idk, wait i check
WTFFFFF
the problem disappeared on its own
with 2 diff tokens
@zenith terrace Would it change to the other user?
Wouldn't it run both
But if you put it like inside a command to switch to a other user..
It used the second one because you login via the same Client instance. Create 2 instances and login with each one of them and both of the bots will be online
Can somebody explain how there are bots like having discriminators like 2222 or 0009
like WHAT
@earnest phoenix
Randomness is on their side
or straight up creating hundreds of bot accounts until they get a cool one
Are you the mod shivaco?
it's a mod-on-break shivaco, get it right smh 









