#development
1 messages · Page 1752 of 1
if u cant send it because nitro, i only know 2 ways you can get it
one is using a bot to fetch all emojis in the server
oh wait it just all of a sudden worked
and the second is the same, but using your user token, which i would HIGHLY NOT RECOMMEND
once again
I DO NOT RECOMMEND USING UR TOKEN
if i send the ID it automatically gets replaced by the emoji
:piglinvibe:
ya see
i cant send the raw id
Uh
cuz u dont have nitro most likely
^
like i said, you need the bot to fetch the emotes in that server
OR
you can get it by its url
i think it gets the id there

aight
but i would have needed to send the emoji to copy it lol
when someone has, discord .gg/(url), the bot add a role
that thing after the /emojis/ should be the id
const radio = {
"nrj": "http://185.52.127.132/fr/30001/mp3_128.mp3?origine=fluxradios",
"skyrock": "http://icecast.skyrock.net/s/natio_mp3_128k?tvr_name=tunein16&tvr_section1=128mp3",
"rapfr": "http://generationfm-rap.ice.infomaniak.ch/generationfm-rap-high.mp3",
"virgin": "http://stream.virginradio.fr/virgin.mp3",
"mouv": "http://direct.mouv.fr/live/mouv-midfi.mp3",
"swigg": "http://start-adofm.ice.infomaniak.ch/start-adofm-high.mp3",
"nostalgie": "http://scdn.nrjaudio.fm/adwz2/fr/30601/mp3_128.mp3",
"cherie fm": "http://scdn.nrjaudio.fm/adwz2/fr/30201/mp3_128.mp3"
}```
How to list that (i try whit .map and .join but its doesnt work...)
-_-
wdym -_-
thats not what i meant
it has to be .gif
if u want mimu support, ask in their server
they dont have one
they do
their "join discord" leads here
surely not
that joins here, you are clicking the wrong link
@spice socket
o ok
dude, words
use them
thats not how u use what i said
read that
or spread the object into an array
either works
thx Object.keys(radio).join(\n• )
anyone know how I could indent inside of a code block with code?
How do you extract a zip file on github? I zipped my bot folder into a zip folder and now i want to unzip it on github. how can i do that?
Tab
Ok so
if i were to do it with python
How/where can i host this
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("token")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)```
on any VPS that can run nodejs code
and the url will be its ip ?
And can be accessed from outside, too
as long as it's accessible publicly? Yeah, sure.
but usually you'll need an actual domain pointed to it and configured
do you mean \t?
\n is a new line
How can you host your discord bot using github for free with your pc off?
github isnt a host, they just store files.
What about heroku?
is the great idea
heroku hosts stuff, but they have a limit of like 21 days a month free.
deploy the application?
I randy Ortons you fake ?
if you want full time you need to pay
Oh, that's fine.
I used heroku, connected my github repository, and deployed it, the commands don't work.
I already deployed it. but the commands doesn't work
OK
👀 is the bot logging in correctly?
yeah i think sso. heroku said it successfully deployed.
heroku can deploy something, and it not work.
o.
on discords side, is your bot logged in(without you running the bot off heroku)
Yeah
is heroku giving any errors in logs
no.
hojbuldumm
English only in this channel please
If you want to use another language please move to #general-int
chuo help
@solemn latch what do i do
🤷♂️ thats pretty much the limit of my heroku knowledge. never used them.
oh ok
what library are you using? discord.js?
Detritus.
flazepe no
detritus is literally trash.
It does mean that, yes.
discordjs is trash too, now which is the better trash
discord.js isn't trash, but detritus literally actually means trash. like, it's the same word.
I prefer the rest api or djs-light the only way without memory leak
detritius the sword be like
Please ping me with reply as I won’t see it otherwise.. how and where can I get a database for my bot for its economy system and any other system that needs a database that I might add down the road. I currently code my bot on GitHub and host it on heroku, I am currently looking at vps options but currently can not pay for a Vps... so do any of you also know of a free Vps I can host my bot on that doesn’t require a credit card... as I said at start of this message, please ping me with reply as I will not see the reply due to notifications turned off for this server
heroku has a postgresql service. Otherwise, MongoDB Atlas is free.
also DynamoDB
Okay, I’ll check those 2 out (MongoDB Atlas and DynamoDB)
if you don't have a credit card I doubt heroku will be enough
unless you're fine with 20 days per month uptime
laughs in my bot running on a dedicated server
Im so fucking confused with doing this
cool so this is my code
<style>
.entity-header__name {
color: #000dff;
}
</style>
and then
<style>
.entity-header__name {
color: #000dff;
}
h1 {
color: #000dff;
}
</style>
once I chaneg to this everything breaks
yup
put the style tag before all the text
Yeah it is
sometimes it glitches hard for no aparent reason
so like this h1 { color: #000dff }
parent child child child { styles }
h1 would be the child of longdesc
whatever is its class name
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
yeah mongo is pretty awesome.
How do I get my GitHub bot repo/project into my new MongoDB Atlas thing
wanna know what the funniest thing they said in discord.js v13 for me was?
"to reduce caching"
delete from dbs where name = 'mongodb'
I use mongo for my bot
uwu
What you do is write your code and then that gets sent to heroku and heroku connects to the mongo db.
Gotta love when your battery bank dies while charging your phone lol
Okay, but will I still be limited to the 20 days that heroku has...
it's suggested to use a separate token/configuration for development on your local PC (using environment variables) so that you don't affect your prod bot and database.
its giving me fucking anxiety
not if you use mongodb atlas.
Okay
could someone check my bto page
and tell me what they see please
like send a screenshot
Wow
<style>
.entity-header__title {
color: #000dff;
}
.entity-sidebar__title {
color: #000dff;
}
</style>
so top.gg just preten this does not exist 👍
what do i use to connect heroku to my mongodb atlas cluster..
there is a "connect with the mongo shell", a "connect your application" and "connect using MongoDB Compass"
connect your application
you`re using an "application"
ok
my bot is coded with node.js
ok
const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://SorinoRPG:<password>@sorinorpgcluster.huchg.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true });
client.connect(err => {
const collection = client.db("test").collection("devices");
// perform actions on the collection object
client.close();
});
I actually have a mongodb atlas credit of 200$ but I still didn't use it
xd
this
then where do i put that code.
but which file lol
...
i don't understand what there was to laugh out loud at
i dont know what you mean by that @solemn latch ....
where do you want to use the database?
on as much of my bot as i can...
that... sounds like you have no idea what you're going to do with a database
currently just the economy system of the bot
which consists of multiple files(1 file for each economy command)
jesus is lord
Right so you'll probably want to create a module file where oyu connect to mongo and then export that connection to other files
See https://js.evie.dev/modules for how to create a module file
and export the client from there
i doubt it but does anyone use pillow and if so how do you support random characters in peoples names?
^testing hence my name has random unicode
When did this become a thing
he is advertising himself
if by "this" you mean my js guide, it's been around for some years
but i respect it tho
I mean it's relevant. I just never knew evie had this.
sneaky af too
I just wanted specific, helpful, friendly information pages on a limited number of topics related to bots
yeah, but i mean..
mdn can be confusing even for knowledgeable devs
Yeah it's clean. Totally stealing it.
Feel free ^_^
I meeean
okay, thanks
when you test for the prefix, make the input lowercase
wrong reply wth
idk how that even happened 👀
lmao
oof
mb manny
@slender thistle thanks, that seems to work nicely
I have zero clue what I suggested but you're welcome
lmao
"""Class that represents widget options that are passed to widget URL generated in
:meth:`DBLClient.generate_widget <topgg.DBLClient.generate_widget>`."""
this is ugly af and I want to complain but it works so I can't
python docs look ugly in general
Why must you hurt me with facts?
snakes bite
Get out
🚪 🚶♀️
Done with the parser now time for a type checker, where do I even start
do i need to put module.exports = economy; at the end of the module file then what do i do?
get some good type inference in there
and look at the problems with current type checkers
I think I've made my typing system a little too complex for me to handle, but we'll see
It's a choice; not a requirement.
You could do that. You could also set module.exports.x = y
Or, for example, assigning a class without a given name as module.exports = class {...}
It's your choice.
okay
It just needs to be set so the processor can actually read the exports
okay, how to i export the economy system things to that then..
Like I said, whatever you use is up to you. module.exports is just a regular property.
ok
When the file is required or imported, whatever you set the exports to is what will be accessible to the importer
Imma be honest, idk how to do that
all I know is how to return the prefixes
whats your code look like?
PREFIX = "a!"
def get_prefix(bot, message):
try:
custom_prefix = db.database.get_server(message.guild.id).get_custom_prefix()
if custom_prefix == None:
raise AttributeError
else:
return sorted([custom_prefix, PREFIX], key=len, reverse=True)
except AttributeError:
return PREFIX
bot = commands.Bot(command_prefix=(get_prefix), case_insensitive=True, help_command=None)
is this the code for getting prefixes? i am looking for the code which you compare whats returned from this, to the messages prefix.
yes, idk where the code where you compare would go
I'm way too dull to be in this server
ah, so you dont have prefixes working at all?
It does it automatically when you do command_prefix=get_prefix
You don't have to write any other code
oh py has inbuilt command handlers, i see.
yeah
the only thing I can think of is returning the list of all cap combos instead of the 2 prefixes
yeah, thats what I would do.
loop over the list, and just make a .lower and .upper of each
👀 kinda why i dont like premade command handlers. its much cleaner doing it yourself
there might be a better way, I just dont know the default command handler at all.
What are we doing
how do make prefixes case insensitive
without having to return all cap permutations
custom_prefix is the custom prefix a guild has, correct?
yeah
oke so a noob question here
how do i sort dictionary based on it's values
I tried this sorted_links_likes = sorted(links_and_likes.items(), reverse=True)
me using python
but say your prefix is abc, is there a way to allow Abc, aBc, abC, ABc, ..., ABC without actually making and returning that list in get_prefixes
So in your else why not just return (custom_prefix.lower(), PREFIX.lower())
yeah
that wouldn't solve the issue tho
just do message.content = message.content.lower()
@sudden knoll
@sudden knoll I can write you a quick loop that would return all permutations if you'd like
I mean I can do that
I don't use on_message
That wouldn't work
i just did it so the prefix thing returns the prefix + prefix with first letter capitalised
Yes but it ruins any caps in the command
So if they try to input variables with caps then rip
Any help?
>>> d
{'1': 1, '2': 2}
>>> sorted(d.items(), key=lambda x: x[1], reverse=True)
[('2', 2), ('1', 1)]
x in the lambda function is each tuple that contains key-value pair
lambdas are stonk
zeroth element being the key, first being the value
Yeah tbh @sudden knoll as long as you return abc, Abc, and ABC I bet you'd be fine
What's the actual issue? I don't get it
well i tried but for bigger dicts it doesn't work or something......?
.lower,.title,.upper
I want to allow all prefix case permutations when someone inputs a command
I don't think there's any option other than returning all permutations
If there was it would be in the documentation
yeah
Why do you want specifically permutations and not just .lower the prefix
const guildMember = message.author
guildMember.roles.add(['843924656884678667'])
"stack": "TypeError: Cannot read property 'add' of undefined
because if you lower the prefix, I don't think it'll work
eg.
a! works
A! does not
Because there's no way to lower their message without losing their caps
or would it work?
nah I'd have everything case insensitive
What are you talking about
Is anyone open?
ight
Yeah ok so only return the.lower() in get prefix, and make an on_message
would that allow both a!command and A!command
well it worked, dunno what was wrong with sorted_links_likes = sorted(links_and_likes.items(), reverse=True)
On_message, do what h4cker had above
You didn't specify the key function
One sec
Do this
i passed the key parameter with itemgetter
so that would still allow the use of @bot.command() things tho?
you didn't pass anything in the code you provided bro
yeah...
I'm fcking tiered as fck
overriding the lib functions
@sudden knoll Do you store prefixes in cache?
sql db
also a dict
Dict in cache or?
sql db is for persistence, dict is for runtime
The await process_commands thing is what triggers your bot.commands()
So it'll still work
Right, okay
stores in a dict
thanks
also thanks @worn sonnet
Dear fucking God help my soul
I kinda suck at lambda expression
When I try to perform more than one or two things
lambda is just an anonymous function
Lol yeah I need to learn more about them too, anytime I use them I pull from stackoverflow or something
lambda is OP
Okay
>>> timeit.timeit("if any([content.lower().startswith(_.lower()) for _ in ['A!', 'AbC']]): pass", setup="content = 'a!oMglol'", number=1000000)
0.9915907999999973
>>> timeit.timeit("for i in ['A!', 'AbC']:\n if content.lower().startswith(i.lower()):\n pass", setup="content = 'a!oMglol'", number=1000000)
0.6331427000000076
lmao
You can probably do
def get_prefix(...):
...
return your_prefixes
bot = commands.Bot(command_prefix=get_prefix)
@bot.event
async def on_message(message):
for prefix in bot.command_prefix(bot, message):
if message.content.startswith(prefix.lower()):
message.content = message.content.replace(prefix.lower(), prefix, 1)
elif message.content.startswith(prefix.upper()):
message.content = message.content.replace(prefix.upper(), prefix, 1)
return await bot.process_commands(message)
Or at that point bot.process_commands should work without the manual checks anyway
I just did
@bot.event
async def on_message(message):
message.content = message.content.lower()
await bot.process_commands(message)
Yeah, that's if you don't need case sensitivity with your args
yeah I don't need any
You're kidding me right
okay ty
[PostgreSQL] I'm in the process of refactoring a platform primarily available in English to support any language. I've only written the API and managed the database so far and was considering creating a table to hold all translations:
CREATE TABLE translations (
id uuid NOT NULL DEFAULT gen_random_uuid(),
text TEXT NOT NULL
);
However, I've heard this approach (and similar approaches where all translations are stored in a single table) has many drawbacks. There are other approaches I've read about having big drawbacks as well, but for anyone who's has experience with this, how would you suggest it be modeled?
What do you think of making a separate table for each language?
Translations in the code is often done. Then you just keep them in memory
By code I mean yaml files etc
separate table for each language and a unique id that corresponds to each text doesn't sound bad imo
As long the IDs are somewhat human readable. So your code isn't filled with random uuids
could have the ids be the name of the texts
ooh dewey decimal system
lol
or ibsn num
idk what texts he's talking about tho
The translations are provided by users. For example, an article table where the title and content may be in a variety of languages.
@sudden knoll Updated the snippet to actually work
It might not cover all cases but I'll leave that up to you now
Cuz it's 2:43 and I'm tired as hell
lol, thanks, I'll be sure to test it
Maybe look into some existing solutions that are already out there? https://weblate.org/en/features/ looks free for public projects.
depends on the language
I'll check that out
I'm allergic to loose comparison
len([]) == 0
Okay what if ```py
Def is_empty(list):
for n in list:
return true
Else:
Return false

On mobile so excuse formatting
Def is_empty(L):
Try:
L[0]
Return true
Except:
Return false```
http://crowdin.com/ is pretty good
it's paid but you can get a free license for open source
Crowdin and Weblate look like promising sites for collaborative localization, but I'm unsure about it since:
- The platform I'm developing is completely collaborative
- It (Crowdin and Weblate) would be an external platform to rely on (which I want to minimize as much as possible).
S
yes, s
Well if you want to build it yourself, go for it 🙂
localization is a difficult task I would not want to solve that problem myself
def is_empty(l):
F = "F"; A = "a"; L = "l"; S = "s"; E = "e";
if isinstance(l, list):
if len(l) >= 1 and list.__len__(l) > 0:
for _ in list(l):
if _ in list(l):
return bool(l)
else:
return l.__bool__()
else:
return bool(l)
else:
return True if bool(l) else False
else:
return False if bool(l).__str__() == "".join(eval("""''.join([F, A, L, S, E])""")) else True
also there's very little vendor lock-in with crowdin. It's literally just json files as a service

I'd prefer to use a site like Crowdin as opposed to writing my own localization system, but given the structure of the platform I'm developing, Crowdin doesn't look feasible. Originally, I asked the question with less knowledge about how I'd really structure the platform, but I've learned more from it.
Hey with the new site redesign some of my html has stopped working. For example my logo used to float up and down. Changing the class to this doesn't fix the issue.
changed the class using this
.Avatar__StyledImage-sc-11xtpcc-1 dwineZ {
-webkit-animation: floate 5s ease-in-out infinite;
border-radius: 20px;
}
Not quite sure whats wrong with it now?
<style>
.orange {
color: #FF8C00 !important;
}
@keyframes floate {
0% {
box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.6);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0 rgba(0, 0, 0, 0.2);
transform: translatey(-20px);
}
100% {
box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.6);
transform: translatey(0px);
}
}
.Avatar__StyledImage-sc-11xtpcc-1 dwineZ {
-webkit-animation: floate 5s ease-in-out infinite;
border-radius: 20px;
}
.discordcolor {
color: #7289da !important;
}
.red {
color: red !important;
}
.white {
color: white !important;
}
</style>
For all you Python ppl, I finished my class creation script (I yoinked shivaco's camel_to_snake method, thank you shivaco)
Doesn't Python have a module for generating source code
ehhhhh idk
{"12312401124124":{"registrar":71},"125412541251":{"registrar":4},"125125125125":{"registrar":5}}
(photo for example)
how i can make json to table like photo? (i tryed tons of source on github but my json style different from their so not worked)
Which is the best free bot host?
It depends on your project.
If you're hosting a website, glitch, repl.it, heroku, etc. are in your favor.
If you're hosting a Discord bot, your options are limited.
If you're building the next Google, good luck.
I understand JSON, but I don't understand converting it to a table like the photo displays. Do you want to display the data from the JSON as the image? Do you want to model it in that form? What do you want to do with it?
I don't have enough experience with HTML to give you a constructed solution, but I know you can use a <table> along with <tr>, <th>, and <td> elements to model it in plain HTML.
Then apply some styling
I swear who was in charge of adding descriptions to the last two cards
<table>
js_loop
document.write(<tr><td>json key</td><td>json value</td></tr>);
</table>
Written from mobile, can’t be more detailed however
tr = row
td = column
-p liberta me de mim
A web server programming language
That’s actually not true.
It’s a standalone server side scripting language.
Actually being used mostly to build static and dynamic websites.
But it’s capable of a lot more for example even handling backend and/or system tasks.
It doesn’t even need a web server to be productive code, at least just the CLI.
oops activated mentioning 
ok
A lot of the descriptions are subjective to some contextes
and some details are just incorrect
Yeah absolutely but it’s not a web server scripting language
for example, the trailing ' in the example
It doesn’t even have anything to do with a web server
does css variables take up memory?
heres a middle ground between the two: a scripting language used mainly for server side web development
depends
and that's all it?
You can basically say anything you see or saw on you mr screen passed the RAM
Everything takes up memory. But it's up to the implementor to decide how much it ends up using.
But I don’t think it’s worth to think about if CSS consumes RAM
Nothing to worry about
Not really because of the consumption of gigabytes of ram.
have any of you ever actually developed a bot?
not me
Yes.
Doesn't look like it. What language did you code in?
?
I used Rust for my last bot.
Nice try bud, that's a video game.
you serious or joking
uhh, this looks like a video game bud
he’s gotta be trolling
I've been coding in python for years, i'm kind of an expert😎
One message removed from a suspended account.
Of course I know that. I'm a seasoned dev. Ask me something about python?
Huh what? I said it’s not worth about to think about it or worry
I don’t know much about python and I have no reason to ask a question since it is not a language I use
Of course you don't
I was merely commenting on your messages that I could not tell if you were serious or not on
How can you progam if you can't evn speec english?
Oh I see...
what the hell is happening
I have no idea
@safe bay u sound really smart
Just a real programmer laying down some biz to these amateurs.
whats ur bot then?
they say a user's contributions tells a whole story
I wonder what’s wrong in my sentence...
kruger effect should've spiked down
Mee6
yeah?
Well that’s the consequence if schools being shut down and parents don’t care about their kids 
The most entertaining channel, still
just install more fingers
True!
Need to keep some on the steering wheel unfortunately
Though programming does not really have anything to do with typing speed unless you’re doing a timed contest like Google Kickstart
Don’t start to feed the troll
Won’t be here long enough to enjoy
Jealous much?
Indeed
What language do you use?
I use Java++
I said what language not what version of minecraft.
++Java is faster
Oh sorry, I use C♭
Javb
C flower lel
C flat
Good one
C major
that's music you wingnut!
No it’s a programming language!
Don't worry I believe you 😉
Yeah but none of my repos are public
Unfortunate.
github 
I wouldn't want you stealing my code.
Yeah I like to steal code from several open sourcers and use it as my own
lmao
It’s a good thing you keep those repos private cus I probably would’ve skimmed them for some nice code by now already
I'm sure.
“The open source pirate”
Too complex for you to understand anyway.
Hey, I don’t have to understand it as long as it compiles right!
@wheat mesa whats ur github?
i see
wait but doesn't MEE6 have some repos on GitHub.....
Those are fake
ok
what language do you use?
++Java
Java++ is better 😡
faster version of Java++
You would use minecraft
Oh he’s still here... damn did I miss something?
that's what you think Waffles
is python a snake then?
we beefin now @wheat mesa
Oh no have I been brainwashed by the Java++ devs once again?!
No silly
what is it then
it's a legless lizard
a language
snakish then
different species actually
legless lizard
Lizards aren't that long
please stop pinging me
ok
ok
much better
Wonderful!
I think i love you
Wonderful!
I apologize, I do not reciprocate such feelings.
I can change that.😗
Of course I am, Only seasoned programmers are here. I'm surprised you are.
You use the term “seasoned programmers” quite often. How does saying that make you feel?
membean word
he's the gordon ramsay of programmers
What an honor to meet you then.
i mean he created mee6 ig
I wish I could say the same
May I receive an autograph?
no, social distancing remember?
A signature over discord.
I can give you more than a signature.
Elaborate
You'd like that wouldn't you?
Yes I would.
One message removed from a suspended account.
One message removed from a suspended account.
we?
One message removed from a suspended account.
Could you both change channels? Read the channel topic
Yup
snitch
One message removed from a suspended account.

idk what the fuck is happening here but its not related to the channel
I wonder how that can bother you?
There’s a conversation you’re not a part of going on which you doesn’t like?
Tip: Leave the right room or close Discord.
There’s no spam going on and the topic relation can be found by scrolling up.
Oh and yeah... 1 < 2 = true
(to stay on topic just for you)
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
@wheat mesa
Yes?
Ok
One message removed from a suspended account.
shit, to general I go
One message removed from a suspended account.
why does everytime I install a library in the console it says I installed it but I still get the yellow line under the import
Show your code and the error, it’ll be easier to help
anyone know a good way to match up an answer to the correct one?
Im making a quiz bot.
Like if the answer is "The prince and the pauper" and someone entered prince and pauper.
I use discord.py
import numpy
it is just yellow in visual studio code
I tried installing and uninstalling it still nothing
From what I’m seeing online here (I don’t do python) you have to have the syntax like this:
still nothing
What is VSCode saying
does it know what env it's using?
isnt it
from numpy import np
in discord.py if the user passes an @mention as an arg how do you get the ID of the user they mentioned?
mention.replace('<', '').replace('@', '').replace('!', '').replace('>', '')
they're asking for the ID
when you mention someone it comes in the form <@ID>
ah
thanks
One message removed from a suspended account.
One message removed from a suspended account.
i see
it has reportMissingImports but it says it is installed according to the terminal
Im trying to set the cursor to an svg image from an url in css. But its not showing, so I think the dimensions are too large . How can I limit the size of svg image to 32
U might be looking for this
https://css-tricks.com/scale-svg/#:~:text=The default 300×150,the default size for SVG
i was thanks
thanks, but my svg image coming from a url. I'm not using inline svg tags.
and I want to set it to the browser cursor, with a limit specified.
I doubt if it's even possible
I found this, idk if it's what you're looking for tho
https://css-tricks.com/using-css-cursors/
hi
holy shit @sage bobcat i think this is the only C# code I ever publicly wrote in Top.gg
and probably the only C# I ever will write
just ask the question, don't ask to ask
damn
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");
module.exports = {
name: "avatar",
aliases: ["icon", "pfp"],
description: "Show Member Avatar!",
usage: "Avatar | <Mention Member>",
run: async (client, message, args) => {
//Start
let Member =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]) ||
message.member;
how remove
run in this
command
pls any one tell
how remove run in this embed
i mean how to add my bot it cant aded why?
h u h ?
i am trying to add a cooldown of 60 secs, like if a user says ~hi then they can't use that command for another 60 secs
if message.content.startswith('~hi'): messages = ["hii >w<", "hewoo >w<", "heyy >w<", "hii >o<", "hewoo >o<", "heyy >o<"] await message.reply(random.choice(messages), mention_author=False)
pls reply my
hey is there a way for npm to enter a dir when running a script
am i must created website url for my bot then i can add my bot?
for example, npm start
enters a folder, and runs npm start in that package.json folder
Umm like this
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");
module.exports = {
name: "avatar",
aliases: ["icon", "pfp"],
description: "Show Member Avatar!",
usage: "Avatar | <Mention Member>"
}
my bot dosent approval yet
what's your bot id ?
you dont need a website
844051858712035348
how?
i tried "cd dashboard & npm start"
because i am using jsx and express, and i want one terminal to run it
@near stratus can my bot added?
turn off code grant in dev panel
cd dashboard && npm start
or you could use
cd dashboard ; npm start ; is equivalent to a newline.
ahh thanks
also, why when i kill my terminal, port 1234 is still alive?
does anyone know why?
this one works
with a small change like Zord said
Endless await, try refreshing it
@near stratus how bout my bot? is it done? sorry for bother
i quit vsc, and refreshed, revisited port 1234, its still alive
idk why
are you using react?
you know free host for music bot
👀
kill the process then
he says he has killed the process
After killing process with pid there's no chance of anything running
i quit vsc
@near stratus sorry once again bother how bout my bot?
one more thing, restart the process and then do ctrl + f5
it should load the new content
how?
im on macos
cmd+f5
You still didn't turn off code grant
realy? wait
kill -9 PID
try this
netstat -anp tcp | grep 1234
this is your pid
now do
kill -9 PID
@swift cloak simply do
kill -9 `lsof -i TCP:3000 | awk '/LISTEN/{print $2}'`
it'll kill whatever's running on port 3000
any of the following will work
Also I got this from StackOverFlow (never used mac)
I'm on a mac too so
lol
already @near stratus ?
im on a 2014 mac tho so its laggy af when i code
im on 2017 big sur
help :(
Save the time sent, then when it’s run compare if the time > 60
it works fine. I'll dm you the invite link
Use like time.time
Thanks alot
you mean time.sleep?
time.now()
When the message is sent set a variable to time.time (seconds since the epoch) and when the command is run again check to see if the time the command is run is 60 after the other command time
oh i see, tysm
Yw
Use a global dictionary preferably
Hi guys! Just a quick development question with ES6 JavaScript that I can't seem to solve on my own. As a background, I'm building a Discord bot in Node.js; however, I'm building it with Babel (first timer) as personally I prefer imports over RequireJS (don't judge me). Is there an alternative way to get class information from a JavaScript file using imports, or any other way other than require()? Like I said, I use Babel, so require() isn't exactly an option in my case.
use this, see the documentation in the readme
it does ages ago
np, I prefer import over require() too
@earnest phoenix react is very difficult
Its easy for me
I hope it will be east for me after learning
Lol I took a 10 hour course
@earnest phoenix You got any experience in React Native?
No
Not Native
Native sucks
Wow
I use Create-React-App
Oh haha I guess you are not interested in building cross platform mobile apps?
yep
I build web apps
Haha yea no reason for you to jump into React Native then.
From youtube or paid course ?
I got really excited when I found out I was able to build real native and properly performing applications with my web development skills.
yt
Which chnanel ?
I will send link 😉
Learn the basics of React in this comprehensive course. You will learn about fundamentals, hooks, context API, react router, custom hooks, and more.
React is one of the most popular ways to build user interfaces using JavaScript.
🎥 React projects video: https://www.youtube.com/watch?v=a_7Z7C_JCyo
✏️ Course from John Smilga of the Coding Addic...
Free Code Camp
Thankss
No prob
just use typescript, it has all of the js tooling built in and it's basically objectively better than js
I need help in making api
In using top.gg api
I hope you get the help you need
I wanna display how many servers
ReactJS let me try to help you. Where are you stuck?
Idk how to use Top.gg API
I'm using Heroku, but people say that Heroku is trash
Do you have experience in using any API?
Nope
Are you building your Discord bot in NodeJS?
Alright so you have to choose a package so send HTTP requests with. I always like to use node-fetch for that. You can install the package from NPM.
Yup which package
Node-fetch
anyway, I have a command for give Money and the syntax Is
-give args[0] @user
I have a cooldown for this command, people sometimes failes the command and Exchange -give @user args[0] but in this case U have nothing inside this args.
in conclusion, there Is a way for not have the cooldown when you fail the command?
Alright so when you have the package installed you can require the package by using
const fetch = require('node-fetch');
You can now send requests using the fetch() method. Information on how you can use that method can be found here: https://www.npmjs.com/package/node-fetch
Yup
Then we need authorization for top.gg?
heroku is fine
good enough for free hosting but it won't take you too far
yup
@earnest phoenix I now see Top.GG is also offering a Javascript library to send the stats with. Maybe thats even better: https://docs.top.gg/libraries/javascript/#posting-bot-stats
How much server can Afford?
Hmmm Do u know how to use that?
if you want a decent server you're probably looking at min $5/month
It looks very easy. Look at the snippet they share on the page. You just have to install the package and then initialize the package by giving it your token and client object.
hmm
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
I'm Sorry, my english is a Little bit trash , I was asking with free Heroku, in how much server the bot can be for not crash
no idea it depends on your bot
I had a bot with 200 servers running on it at some point
@earnest phoenix You know where to find the token you need to use that library?
yes
In the webhooks page
idk memory usage and stuff like that, resources in general
Alright so you now understand how to use the package?
yup
It will post stats with that code??
how i can convert undefined to string?
@earnest phoenix It will yes.
thanks so much bro
Why?
What I always do to check if something is undefined:
if (typeof(myVariable) == 'undefined') {
console.log('The variable is undefined')
}
So what you can do in your code; instead of writing item.mute inside the table, write the following:
(typeof(item.mute) == 'undefined' ? '-' : item.mute)
oh nice, I'm worrying now that my bot Is in 9 server lol
I have a command for give Money and the syntax Is
-give args[0] @user
I have a cooldown for this command, people sometimes failes the command and Exchange -give @user args[0] but in this case U have nothing inside this args.
in conclusion, there Is a way for not have the cooldown when you fail the command?
give me a sec
❤️ thanks
Did u leak ur token?
@spare badger Btw after puting token shud i start the server??
Oh, I see
next day it was erased
@earnest phoenix It will only post the stats when you run the script yes?
ig
yup
Well, idk then. Maybe it didn't save ur work?
Fair enough then
This is the give command
https://srcb.in/FqI0FCe9Km
@stiff lynx The cooldown logic is somewhere else in your code base I think. You are returning a fixed cooldown in this file that is probably used to apply the cooldown somewhere else. You have to build a feature that ignores that cooldown whenever the command fails.
https://srcb.in/CjNAhJNYCV
This is the cooldown, or at leaste a part of it
IK
const cooldowns = new Map();
I'm using a map for it
@woeful pike sorry for pinging, but I'm curious, how is your bot named?
What I would do is throw an Exception whenever the command fails inside the command function. Than catch that exception where you call the command function and if you catch it ignore the cooldown.
I got bored of making bots a long time ago it hasn't been running for over a year
Caching wouldn't be a problem when the bot shuts down?
sAME @woeful pike but i am still with my bot
Would it be necessary to cache cooldowns?
who got the script for tower defense simulator?
I have an idea, I create a const for fail and when It returns I add one at this const, At the end I check if this const is 0 or 1
What do you think?
bruh please answer me
what you code now?
@spare badger I put the topgg api code in my bot index.js file and when i run it it says it posted but i cant see it on the top.gg page
If it works, it works 😛 I would go with the Exceptions approach, but you do you!
I'm doing it by saving it to the database otherwise is there an easier way?
websites and backend stuff
Do i need to put my top.gg token in the authorization field in the webhooks page
@spare badger ??
I would personally not go through the hassle of caching cooldowns. I don't think it is really important for the cooldowns to be remembered after restart, but that may be specific to my use case.
.............
but I have a question, how can I change the cooldwon in the command "declaratiion"?
@spare badger
can you like read for once instead of bombarding this dude with questions
No you don't.
it is not working
Not showinng server count on top.gg page

Yes, it is important to me for 24 short wait operations
^-^
It depends on your needs
No sure what you mean sorry.
my cooldown is in abeg command
You mean change the number? I think I don't understand you hahaha
@earnest phoenix 🎊
Happy to help.
As I seed my english is a little bit trash, I mean, if I do the thing with the const how I reset the cooldwon?
@earnest phoenix Did you change anything or did it just take a few minutes to update?
to left was better lol
@stiff lynx So how your codebase is working is that every command has a fixed cooldown. Whenever the command runs, the cooldown is applied. You have to change the logic of applying that cooldown. You should only apply it when the command is actually valid.
You could also add an extra function for every command that validates the command before running the actual command handler function. If the validation fails, you then just don't add the cooldown.
mind blowing
Hahaha sorry man I'm not sure how to explain it any easier. It's just coding really.
Minutes
I started the server
It not work
Thanks. Good to know for next time.
hehe Bois
-botinfo 834716873706569769
834716873706569769
Danker
9256
Danker is a Dank memer Community Customizible Bot! It has Many Commands! For More information on the command categories, visit our website!
undefined
4
2
16 Servers | 1 Shards
@ripe wigeon
Invite | Website | GitHub | Support Server
Nice
@quartz kindle IT WORKS! YES
I'm pretty sure is not your fault , tysm
I hope you get there! Never give up 💪
Nice U use typescript
not part of the cool kids then
I really should start using Typescript on all my projects.
Lmao
ts just makes js a lot safer
no more fixing bugs for the rest of your apps lifespan until someone accidently triggers it
you can rely on ts to screech at you for writing something wrong
-botinfo
Please include a bot mention or ID
I'll try not giving up lol, for the moment I have too much staff passing trough my head. I have university exam in something like 2 weeks 😦
Good luck!
tysm, now I'm gotta go ❤️ love you all
here's an example of how typescript can make your life easier btw. If I spell the name of translation wrong the app will fail to build instead of me discovering the error in production @spare badger
I use Typescript for some projects! But I'm always too lazy to setup the development environment for it. These kind of features really show me I should just ditch regular NodeJS 🤔
radio.values().map()



