#development
1 messages Β· Page 1106 of 1
Your DBL token
Dketee it
...
hacked
has been leaked
noob
@finite nimbus lmao idiot
Delete
regenerated XD
Delete it
too late
still
Fucking delete
xd
Huh, i regenerated it and then send..
like delete helps
and go to #topgg-api for top.gg questions
yeahh
Again
Mods only
;-;
let us assume I have 2 javascript files and one I make an array and in this I am going to push with an event information into the array for example. For example I want to push message.content into an array, now. Can I push those information into an array that is not in the same javascript file?
i mean, you have to link the 2 files anyways so yeah
it works with require?
hmm
I require array from an other file ok, then I put this array into my message event
now can I push my message into this array and will this changed in the original array?
(I dont think so)
I know, this sound silly and I could do this with a json file, but I am wondering if this is also possible with a normal js file
how can i change the background of my bot page to a image
hot
hot
thats a lot
I tried this, can someone explain to me, what I am doing wrong π€
a json file. Named:list
{
"list":[]
}
Now, how can I push from my main js file information into this array?
I tried stuff like this:
const list = require("./list.json")
list.list.push("test")
fs.writeFile("./list.json", JSON.stringify(list), (x) => {
if (x) console.error(x)
});
should work
no
nothing happens, that is why I was confused
thanks, it works now. Just had some problems with the api, it did not react for some reasons. Thanks for your help
I have coded a bot and it was working fine before but then I coded one more cmd and it also worked when in 1-2 mins I tried again to use commands of bot no cmd was working no error in logs nothing bot is online but still no cmd is working
does it work again if you restart the bot?
I have coded a bot and it was working fine before but then I coded one more cmd and it also worked when in 1-2 mins I tried again to use commands of bot no cmd was working no error in logs nothing bot is online but still no cmd is working
@surreal notch show the code and errors
Maybe the bot is never detecting commands
No errors@earnest phoenix
Yup
It is cmd handler with 18 commands how can I show u
so to make a reaction role bot i need to use on_raw_reaction_add and remove because otherwise the code wont pick up the message after a restart. or is there a way i can have a permanent message cache for certain messages
π
After coding a particular cmd it stopped responding
we can't help if we don't know what you were doing
so show the code
just send the code
@placid iron you can cache the message ids that you want at login
unfold the curtains
by fetching them
I have to share all cmds?
i didnt realise fetching saved them to cache too
even three year olds store tokens in other files
i thought it just asigned it to the variable you wanted
ss the message event
so @surreal notch just screenshot the bot.on("message") thing
Ok
good boy
how can your message event be in an run which containes message as well
π
Hello ! I turn to you because I can't code what I'm going to tell you: I try to make sure that when the bot joins a server, it automatically creates an invitation with infinite use and duration
@surreal notch thats not nearly enough information to help you, but that 3 lines alone already look terribly wrong
@earnest phoenix https://lmgtfy.com/?q=How+to+make+my+discord+bot+create+invite+with+infinite+duration+on+join
Gald to help ^^
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
Thanks ^^
you need to ask permission from the owners, or clearly say that your bot does that when owners add it
because creating invites without their knowledge is a privacy violation
Hello ! I turn to you because I can't code what I'm going to tell you: I try to make sure that when the bot joins a server, it automatically creates an invitation with infinite use and duration
@earnest phoenix thats a ToS violation π

your bot will be banned from discord if they find out
Ok thanks for your help :pray_tone2:
maybe your entire account, so basically, just don't do it
@quartz kindle so this should be fine? http://img.rovi.me/DWEdhR4CbR.png
I was thinking of making my bot run ads in the server it was in, but I would need some sort of user agreements or term of service to make those ads not unsolicited
const db = require("quick.db")
module.exports = {
name: "prefix",
category: "Extras",
aliases: ["pre","currentprefix"],
description: "Get the current prefix of guild",
usage: "prefix",
run: (client, message, args) => {
let p = db.fetch(`prefix_${message.guild.id}`)
if(p === null) {
p = ";"
}
message.channel.send("**Default prefix**: `;`")
message.channel.send("**Guild Prefix**: "+p)
}
};```
@quartz kindle After codding this cmd my bot stops responding @earnest phoenix @earnest phoenix
did you get an error?
no
looks like api ded
how do i make bulk delete exclude pinned messages from being deleted?
@quartz kindle server.js?
whatever your main file is
const { inviteURL } = require("../config.json")
module.exports = {
name: "invite",
description: "invite the bot in your server",
execute (client, message, args) {
let embed = new MessageEmbed()
.setTitle("INVITE ME")
.setColor("RED")
.setDescription(`[INVITE](${"https://discord.com/oauth2/authorize?client_id=733355725962739733&scope=bot&permissions=2147483647" })` ); //Looks Cool
return message.channel.send(embed)
how can i make another invite thingy but with this source
@mild flower you need to fetch the messages first, then filter them, then give the filtered ones to bulkdelete
For a discord server
@quartz kindle Here's my main file - https://hastebin.com/zudakafuzu.js
is calling a db everytime in every function better or importing db objects from a file which runs everytime a command is called better?
@earnest phoenix "hot" data should always be cached
oh
so retrieve the data one time
and store it in a json file
or sum file
and access the json file from next time?
@summer torrent ok
@surreal notch there are a lot of problems with that code
@quartz kindle π
but that was working fine
first of all, you should never have handlers inside handlers:
// good
client.on("something", s => {
// do stuff
});
client.on("somethingElse", s => {
// do more stuff
});
// bad, very very bad
client.on("something", s => {
// do stuff
client.on("somethingElse", s => {
// do more stuff
});
});
second, you have a lot of repeated code which is resetting itself
π
@surreal notch your file is making my head fo crazy
βΉοΈ
for example client.commands = new Collection() on line 30,
then again client.commands = new discord.Collection() on line 105
the second one is resetting the first
Oh
You added http.get("yourglitchprojevt"); and never entered your project name
who can help me
Me
is it related to not responding of bot?
pls
you're also calling this twice ```js
["command"].forEach(handler => {
require(./handlers/${handler})(client);
});
huh
π
this stuff ain't making sense to me
also can you stop sending the same emote again
and set a pfp
stop
also can someone help me
i want to use some-random-api.ml but i don't know anything about JSON and stuff
makes minecraft resource pack which requires pack.mcmeta which is JSON
i am not really good at coding
but somehow idk how my code worked
but i want my bot to give person a role
it should give a role called Upvoter
i have made a code
but it doesn't seem right
@blazing ravine ?
var Tet7 = bot.guilds.cache.find(gi => gi.id === "guild id").then(gi =>{
let upvoter = gi.roles.cache.find(role => role.name === "Upvvoter");
vote.user.roles.add(upvoter)
})```
i am sure this is wrong
where's cache
i forgot
also, if you're going to use IDs, use .get, syntax is simpler but won't make any difference
ok
also, isn't it gi.roles.cache.find()?
and cache.find is not a promise, you shouldn't use .then
what's tet7 for
remove .then and put the rest on another line
ok
so Tet7.roles.cache.find()
vote.user is an id
change it to Tet7.members.cache.get(vote.user);
that gets the voter as a member
you can append .roles.add to it i guess
var Tet7 = bot.guilds.cache.find(gi => gi.id === "guild id")
let upvoter = Tet7.roles.cache.find(role => role.name === "Upvoter");
var mo = Tet7.members.cache.get(vote.user)
mo.roles.add(upvoter)
yes
you can change .find on the first line to .get if you want to
setTimeout(() => {
mo.roles.remove(upvoter
) }, time in ms);```
yes
ok thanks
print(hello world)


lol start with C#. the default Project in Visual Code includes already a hello world
What's the best language to make a bot that's easy to self host?
For example, with js you need node and is not so easy to npm i all the stuff for non coders. Is there any library which has a minimal setup to run a discord bot?
node for me
npm is preinstalled and it's not hard at all to use it
and you just need to use npm i and it'll install packages by reading the package.json file
ok thanks
@delicate shore np
bruh
node is pretty easy together with python
hi
no pain no gain
check 1 more screenshot
when nickname is with space args not using the nickname in args 1
join them
What's the best language to make a bot that's easy to self host?
python or JavaScript are your first bets
For example, with js you need node and is not so easy to npm i all the stuff for non coders. Is there any library which has a minimal setup to run a discord bot?
node is not that hard to install and just runningnpm iin the directory will install your stuff for you.
@pale vessel (node:9466) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
what
the guild is undefined
wym
make sure it's the correct id and that your bot has it in cache
uhh
the guild is undefined
@pale vessel if you don't get what this means, i don't really know what to tell you
guilds are always in cache as long as you're getting the guilds in or after the ready event
are you sure you used the correct id
@pale vessel yes
show code
k
guilds are always in cache as long as you're getting the guilds in or after the ready event
@earnest phoenix it's not
yes it is
it's before
$cry
every event
then get the guild after the ready event? lol
ok lemme try
if you get a vote during startup while ready has not been fired yet just queue the vote in some map/list/array
we know
o
i got the proble @pale vessel
lemme see if that is the problem
alr
one problem solved
dbl.webhook.on('vote', vote => {
console.log(vote);
if (bot.uptime) {
bot.users.fetch(vote.user).then(user => {
const thanks2 = new Discord.MessageEmbed()
.setColor("RANDOM")
.setImage(`https://cdn.glitch.com/f0d0daf5-a981-4bd1-bb7b-a3bdc2cd20db%2Fthank-you-437x230.jpg?v=1596176778617`)
.setTitle("**Thanks For Voting! :)**")
.setDescription(`Thanks for voting :love::. In the future, this will have benefits!`)
user.send(thanks2)
bot.channels.fetch('739081152807305308').then(channel => {
const thanks = new Discord.MessageEmbed()
.setColor("RANDOM")
.setImage(`https://cdn.glitch.com/f0d0daf5-a981-4bd1-bb7b-a3bdc2cd20db%2Fthank-you-437x230.jpg?v=1596176778617`)
.setTitle("**Thanks For Voting! :)**")
.setDescription(`Thanks for voting ${user.tag} :love:.\nIt is super apricated!`)
.addField(
`You watching can upvote me too!`,
"[Upvote me on top.gg!](https://top.gg/bot/716985864512864328/vote)"
)
channel.send(thanks)
var Tet7 = bot.guilds.cache.get(gi => gi.id === "690557545965813770")
let upvoter = Tet7.roles.cache.find(role => role.name === "Upvoter!");
var mo = Tet7.members.cache.get(vote.user)
mo.roles.add(upvoter).setTimeout(() => {
mo.roles.remove(upvoter
) }, 43200);
})
})
}
});
show code
@pale vessel my vote code
Bins exist
ik
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Me when the
vote.user is ID of user
it is vote.user = id
nice
I want to change the background of my bot page but this does not work
body {
bacckground-image: url(https://i.imgur.com/HWxwIo3.png)!important;
}
the event code
db2_name=db_client["about"]
db2_collection=db2_name["data"]
x=db2_collection.find_one({"id":person.id})
if x==None:
return```
will this close the connection
I want to change the background of my bot page but this does not work
body { bacckground-image: url(https://i.imgur.com/HWxwIo3.png)!important; }
@odd radish
we enter these codes in long description?
the event code
@pale vessel hope u got it
i'm eating rn
.-.
const channel = client.channels.fetch("732691255452237904")
this should work in d.js light right?
await
What is the python keyword for stopping code
return probably
db2_name=db_client["about"] db2_collection=db2_name["data"] x=db2_collection.find_one({"id":person.id}) if x==None: return```
and this?
Nope
.-.
What is the python keyword for stopping code
@pure lion yo
oof
:d
can u help me
Probably
stopping code?
(node:9645) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
Yeah
error
If not x: (stop code)
um
how about Google how to return in python
where u gonna use that
brb
i just want to know whether the db connection closes if we use a return statement in with block
@delicate shore what line
The connection should close when you use the appropriate function or exit the process (with node, not sure with py)
prolly use exit()
@pure lion this one ```js
let upvoter = Tet7.roles.cache.find(role => role.name === "Upvoter!");
var Tet7 = bot.guilds.cache.get(gi => gi.id === "690557545965813770")
get(id)
you put it inside it
var mo = Tet7.members.cache.get(vote.user)
mo.roles.add(upvoter)
.setTimeout(() => {
mo.roles.remove(upvoter
) }, 43200);
```
setTimeout(() => roles.remove(), time)
oh well it does close the connection
setTimeout(() => roles.add(), time)
@pale vessel
my one is correct
no
roles.add is a promise but even if you resolve it, setTimeout is not a function for it
oh
I am not getting it
don't chain it
@pale vessel if i remove the . it justs
doesn't work
show code
k
hello gamers
anyone know how i can send the data in the option tag to the backend?
like
i wanna send html <select> <option>Select the muted role</option> <option name="role">hi</option> <!-- <==== this 'hi' --> </select>
to my api, its in the form tag already, i just dont know how to send it, any ideas?
how to make args[1] to support 1 and 2 words ?
.toLocaleLowerCase()
.substring(PREFIX.length)
.split(" ");```
So you want to combine two args?
like when some1 want check him fortntie start f!fstats nicknime example [pvp game] with space
look
him nickname is tfx toxoidguyyt
but not working bcs is 2 args
console log 1 st is nickname 2 nd is gamemode
3 rd is platform
sorry for spam
@solemn latch can u help me
Hmm I've seen most bots take multiple words input within quotes ""
how to make args[1] to support 2 words no more only 2
but othe rbots
You could also have acceptable args.
Any args between the acceptable args and the command would be the username
works with 2 words
Or have the username last
if you use "" for defining the string split before and after the tag
Told ya use "nickpart1 nickpart2"
idk how minimsit work
lucky you it got a documentation on the npm page
i use it for one bot to have cmd like arguments
like --name
everything after the --name tag is one argument i can use
Oh ya that's an option too
how you desing the tags is pretty much up to you but it helped me to get rid of a really stupid workaround
im making a roll command, and it works fine
the only thing is when you dont supply a number it can be easily used for terminal spam
which isnt great
just check if a argument is valid of not return
id like to know how to make it so that if you dont supply a number itll say "supply a number"
js?
isNaN()
if(!args || !args.isNaN())return message.channel.send("Give me a number Bro")
this is a example
or this idc
ye
basically checking if there is an argument provided, and if that arg is a number or not
Do you even need to check if args exist with isNaN
its just to make sure it wont error out bcs of a missing argument
If its undefined isNaN will return true
or use isFinite()
args.isNaN is not a function
isNaN is a global function
yea sry its isNaN(args)
isNaN(args)
ahh k
it didnt do anything
theres no error but it still responds with "You rolled a NaN!"
NaN = Not a Number
yes
yes
code?
`C:\Users\playe\Desktop\999 club>node mybot.js
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'C:\Users\playe\Desktop\999 club\mybot.js'
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:841:27)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: []
`}
probably some node module missing main file not found
P.S. learn js before making bot
^
@surreal rapids do you know what you're doing
im new to bots tbh used to dev FiveM servers and arma 3 more used to game stuff and thanks jeremy
you should be able to figure out bots with some js knowledge
^ yes go learn js first, even you have some experience, since lua (i pressume fivem servers are lua) and js are completely different languages.
yeah you can
im smort
if arrays don't start with 0 show me to the door
here
I'll be borrowing your door and not returning it
ok thanks for not returning it
hii
why hello there
did you check the cart-looking thing (inbox) to see if you can find it
its a regex mention, not a ping
who can help me with args
@opal plank
names who have space not work
how to use 2 words in args 1
args 2 is for platform
here, let get you an example
thanks
It would be /n for spaces
@opal plank here ?
i borked it, one second
okay ;d
but what im doing is replacing the prefix+ command name and thats your content
then parse for quotation marks
regex the first 2 quotation marks and capture group everything in between
i cant it xd idk how
first look up regex
you need to know a bit of regex to do that
you could do with indexOf() but that'd be a bit more painful
It would be /n for spaces
@harsh moon \n is a newline character
ok
π¦ no idea thanks for help
@blazing ravine
we cant spoonfeed, but i can tell you the path you need to take to accomplish that

cant help you if you give up though
^^
hai, what can i use in python pillow to get the individual frames of a gif into a list? ty <3
:/
args.slice(1).join(" ");
this work but its no tlimited
how to make the nickname tfx toxoidguy in 1 word
this work but its no tlimited
@blazing ravine what you mean
bro i dont know how to make
args split all the content
i TOLD YOU
but what im doing is replacing the prefix+ command name and thats your content
then parse for quotation marks
regex the first 2 quotation marks and capture group everything in between
i dont know regex
help me ? with code
I No give ready code
We cant spoonfeed
why π¦
not a bad idea tbh
Only server I do it for
what if i want to dm you?
not erwin in dm ?
</3
i have them disabled but for some reason they still work
"(
Tim always can
Amateurs!
Tims always allowed to dm me
Slapping that sweet friend request
lmao
@opal plank dm u can
why im not killing people
........................... fudj rules
π

anyway, what you want to do is not an easy thing, because code cant magically know if the second word is part of the username or if its an argument like platform
you need to explicitly tell the code how it should process each part of the entire argument, you can use tricks like delimiters for example
There are 3 he could do. Join arg 0 and 1, index of quotes and regex quote with capture block
!command my username here, platform, arg3 (notice the commas)
or that
when the user name is with space like "tfx toxoidguy" the dead code using only tfx
i usually use quotation marks for multi word commands
not using 2 words
cuz your args are splitting on spaces
hence why i told you not to use args as your delimiter
parse from message content
its easy to say dont use ;d

message.content = all the content from message
replace prefix + command name
now you got everything in the content
now is when you manipulate the clean content, with commands or quotation marks
check out these examples of different ways of processing commands. In the first option there is no distinction, the code doesnt know what is what, but on the other two examples it knows.
So your options are.
- Split with identifier
- Clean content and parse
- Regex capture group
- Index of(first identifier - last identifier) ||(if you REALLY dont want regex, which is stupid)||
im trying to make the 2nd but without [ , " , ","
trim and replace
You mean an array?
not discord related, so i have a TXT with accounts in it, is there anyway to print how much accs in the txt. example:
TXT Has 23 accs
Total Accounts: 23
Depends how you seperate them @earnest phoenix
why not just split by , then?
nice
split by newlines
Count the number of lines
you didnt do a good job at blurring
im just hiding the password dude idfc
let args1 = args.slice(1);```
Also that looks like cracked accounts
Yeah we dont help with that
cry about it
nah
I mean it's just a simple report no need to cry
@quartz kindle
const args = message.content.slice(prefix.length).trim().split(/ +/g);
?
this will work ?
thats still splitting by spaces
https://oliy.is-just-a.dev/2l3k8i_5347.png is this more or less performant than mapping with trim 
what is tfx?
"tfx toxdoiguyyt" is one thing?
yes
no subcommand?
how aboutb we 300IQ and just join arg 0 and 1?
but with space
or 600iq and dont split to args at all
^
commands should be separate from args imo
not easy
@amber fractal yours is more performant
Not easy joining args?
or even: /, ?/
he doesnt have subcommands, why even bother with identifiers?
but wait, that's only my first form
its all message content without the command and prefix
also uhh that linting
Why not just play around in:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_substring
now it doesnt matter how dumb users are
Since you're only messing with strings right now
https://oliy.is-just-a.dev/xzb0s_5348.png big brain shit
you did that after you defined username @blazing ravine...
because you still do args[1]
after you join it's no longer an array
Are you doing a massive switch/case right now?
i ask no
a what now?

why
lol
i dont care, support is meant to be kept here
@opal plank check
Hello.
It's my logic for my commands
like your command Collection in D.js
aight
Logic is all seperated
please use something redable
@faint prism why no dictionary or whatever to hold commands?
now what
My repository is the implementation of the command
Should I jump right into JavaScript or should I learn HTML and CSS ?
So the implementation for the OptInCommand is:
both work @dire stag
I want to build a bot. Then learn lua. Then learn a code thatβs useful for soldering.
You know, to control the machine.
@faint prism like, cant you do something like ```py
for c in commands
[Command(c)]
publick async task c()
{
await ReplyAsync(_commandRepositoryc)
}
@lusty quest
is there a good place to study ratelimits and how to prevent hitting them? my bot specifically deals with using reactions as buttons and then editing the message depending on which reaction was clicked, and it gets api banned every so often. im just not sure on what steps i can take to reduce this
i already have cooldowns for using commands, and i increased restTimeOffset in client options
Before we get into that.
Should I learn java without HTML and CSS ?
Iβm not ready for a web project atm
As in Iβm not interested or need it.
if you want to make Websites / Dashboards lean all 3 if not only js
you dont need html nor css if you dont want web development
The Command is called by the bot receiving a valid prefix
I donβt not atm.
Why would I for loop every command
you can learn it still in the future
@faint prism i mean instead of declaring each command line by line, declare them in a loop
Ok I was worried since some say that learning HTML and CSS would be useful for JavaScript
not if you only use Javascript for Console applications
its not possible
how do i display the current time in discord.js?
Console applications?
of the msg sent*
createdTimestamp
its a property inside the message obj
something that only runs in a commandline with no additonal stuff like a Web Dashboard
Iβm learning java to build I bot right now.
@quartz kindle I'm not following what you mean by
in a loop
Keep in mind, I user interfaces so the command repo is close to modification, but open to expansion. (As per OCP https://en.wikipedia.org/wiki/Openβclosed_principle)
if you are already into one language stay in it. you can learn both but im not sure if it makes sense
What does?
I understand that HTML and CSS are used for web development.
I just started learning HTML today
if you are already into one language stay in it. you can learn both but im not sure if it makes sense
i recommend doing that yes, i did bi-learn many languages... and i didnt understand anything fron any languages at then...
@faint prism i mean, currently you have: declare command a -> command a declare command b -> command b declare command c -> command c what im asking is if there is no way to do something like this instead ```
for cmd in someCommandList
declare command cmd -> command cmd
i recommend doing that yes, i did bi-learn many languages... and i didnt understand anything fron any languages at then...
@restive furnace thatβs time consuming though. And not efficient
Because there is no reason to iterate over a list of commands.
i said i recommend that
it would shorten the code and remove the need to add/remove from the list when new commands are added/removed
Why would you learn a code thatβs not useful to you on the short term.
yes but on each command you add, dont you need to again type [command(bla)] public async task bla() await replyasync(...) in your main file?
https://ur-dad.is-inside.me/7i6BvjDb.png when u make the most stonks custom thing ever
Anyone can send like a command of discord.py?
how to use custom discord emoji with python ?
nobodies vibin with my extreme stonks
how do i get the bot to say the time of a message created? right now it just sends a combination of numbers (im using message.createdTimestamp, would message.createdAt work instead?)
@slim umbra klasa-core?
lmao
Please, i want to start with making a discord bot but i dont know where to start
how to use custom discord emoji with python ? @slim umbra
bruh why r u even tagging me
So anyone can send me the code of 1 simple command please
please help @slim umbra
i forgot what a shitshow topgg is how do u survive here tim
yeah, with 0 caching you can pretty much scale infinitely, your only bottleneck is cpu/bandwidth
anyone can help me to debug a thing in nodejs? i will be screen sharing in general voice chat
op
now i wonder if you could cache with d.js in a externally hosted redis server instead of the internal cache. would maybe make sense idk
PLEHEAS
anyone can help me to debug a thing in nodejs? i will be screen sharing in general voice chat
anyone??
Can you stream bc your a dev role?
idk, maybe
probably to prevent some random stuff happening
yo anyone here a nodejs programmer? kind of stuck in something
in where?
in debuging a command
send code & error/bug
yeah w8
@lusty quest you can with djslight, but probably not with regular djs
@quartz kindle You mean something like this?
i guess, im not sure about syntax
Where DoCommand would have to be an array or list
follow official docs
@restive furnace the file:
const { MessageEmbed } = require("discord.js");
var fs = require("fs");
var emjFile = fs.readFileSync("./botData/emojies.json");
var emojies = JSON.parse(emjFile);
var adminFile = fs.readFileSync('./botData/admins.json');
var admins = JSON.parse(adminFile);
module.exports = {
name: "topic",
description: "Change Channel Topic",
async execute(message, args) {
const msgID = message.author.id;
const inp = args.join(" ");
if (admins.some(msgID.includes.bind(msgID)))
{//Check Admin
if (!args.length)
return message
.reply(`Usage: ${message.client.prefix}topic <MESSAGE>`)
.catch(console.error);
if( inp.indexOf('{load}') >= 0)
{
inp = inp.replace('{load}', emojies.load);
return message.channel.setTopic(inp)
.then(() => message.channel.send('Topic Changed!'));
}else if( inp.indexOf('{loaded}') >= 0)
{
inp = inp.replace('{loaded}', emojies.loaded);
return message.channel.setTopic(inp)
.then(() => message.channel.send('Topic Changed!'));
}else if( inp.indexOf('{verify}') >= 0)
{
inp = inp.replace('{verify}', emojies.verify);
return message.channel.setTopic(inp)
.then(() => message.channel.send('Topic Changed!'));
}else if(inp.indexOf('{music}') >= 0)
{
inp = inp.replace('{music}', emojies.music);
return message.channel.setTopic(inp)
.then(() => message.channel.send('Topic Changed!'));
}else{
return message.channel.setTopic(inp)
.then(() => message.channel.send('Topic Changed!'));
}
}else{
return message.channel.send('Not Admin!');
}
//return message.channel.send({ embed });
}
};```
the error:
```css
UnhandledPromiseRejectionWarning: TypeError: Assignment to constant variable.```
jesus why
i was thinking about modifying a Module either D.js or d.js light to have Redis integrated
jesus god almighty
You cant re assign a var to a const variable
ctrl + h and const to let = fix @muted venture listen to tim nvm
@muted venture
@restive furnace ok
they're not that bright
@quartz kindle so as @restive furnace said i should change const to let
i'm more horrified from the code than the syntax highlight
var
yes, because const is immutable, you cant change it after declaring
@opal plank yeah kind of
Var good 
Hey does anyone know why my main.js command in command prompt isnβt working?
its very rare when you actually should use var
My current flow to add a command isn't difficult:
- Add command route
[Command("newcommand")]
public async Task NewCommand()
{
await ReplyAsync(_commandRepository.NewCommand());
}
- Implement it in the command repo (and it's interface)
public string NewCommand()
{
return "Brand new command";
}
why not take advantage of .net core 3.0 dynamically loaded assemblies
Hi, does anyone do eris?
Hi, does anyone do eris?
@pine aspen yes what?
i just make a new file within a commands folder program it there and connect to the main file
How could I play audio?
I got the voice connection.
I don't understand the .play(URL).
I'm not getting it.
me neither dude
look the docs.
i'm more horrified from the code than the syntax highlight
@earnest phoenix I feel you
@earnest phoenix Are you talking about this?
https://docs.microsoft.com/en-us/dotnet/framework/app-domains/how-to-load-assemblies-into-an-application-domain
Do I need to grab the bots new voice state and then run play?
correct auger
you can create your own assemblies during runtime with roslyn iirc
hey i dont want to bother but i dont think anyone saw this earlier: is there a good place to study ratelimits and how to prevent hitting them, specifically with reactions/editing messages?
my bot specifically deals with using reactions as buttons and then editing the message depending on which reaction was clicked, and it gets api banned every so often. im just not sure on what steps i can take to reduce this
i already have cooldowns for using commands, and i increased restTimeOffset in client options and that temporarily solves the issue. however, i know that as my bot grows this is going to become a bigger problem and increasing the value of restTimeOffset will "work" but make the bot extremely slow to use
your lib should handle ratelimits for you, what are you using
d.js
the only thing you can do about it is control your command usage ratelimits
the lib will workaround rate limits for you, but if you dont control your requests, you end up creating a giant backlog of delayed commands
also, shards are not aware of each others rate limits if you're using the sharding manager
I don't have really much experience with controlling when an assembly is loaded/unloaded outside of it just falling out of scope during execution
What is it's benefit?
Less memory overhead?
how can i control my requests? do you mean by preventing my bot from interacting with a user for X amount of time?
Anyone know a good IOS app to code in JavaScript ?
with user and/or with channel
And run it ?
also, shards are not aware of each others rate limits if you're using the sharding manager
my shards dont interact with each other in a way that would use the discord api
most of discord's rate limits are per channel
that and you get to directly hook into d.net commands instead of having something finicky like a string and parsing it @faint prism
gotcha
Anyone know a good IOS app to code in JavaScript ?
@dire stag IOS?
instead of having something finicky like a string and parsing it
Are you referring to the [Command("cmdstring")]
yes
im aware
i already have a 5 second cooldown in place per user, and a channel specific cooldown should help too? also, im not a fan of having a hardcoded cooldown, is there a way to dynamically set a cooldown based on how close im getting to the rate limit?
i'm referring to this
@patent geyser iPhone
@dire stag I'm not sure if this is on the app store, but try searching for "kodiak javascript"
d.js does not expose rate limits. you can access an internal bucket, but thats not easy to use
Does your bot use a lot of reaction menus?
I feel like reaction menus use a lot of requests.
All my router cares about is if the repo I load in the router's ctor implements that command repo interface.
I want the router responsible for routing, and the command repo responsible for command logic.
(As per SRP design pattern https://en.wikipedia.org/wiki/Single-responsibility_principle)
That's just so I never do something unmaintainable like:
I use a repo just to abstract the logic away from the router
Does your bot use a lot of reaction menus?
I feel like reaction menus use a lot of requests.
yea it does
are your reaction menus self-deleting? like when a user reacts, does your bot delete their reaction?
yes
-servers
im currently using quick.db, but i want to switch to something else. what database should i use?
(js)
Depends if you want to use NoSQL or SQL.
i like sqlite
so just leave the reactions there? i tried to do that but unless i clear the reactions, it doesnt look right
i just leave them there
its not that bad
does clearing all reactions count as one request per action?
probably yes, you can test rate limits through reqbin or postman
auger that's smart, a nice workaround however i'd still using assemblies
you can easily generate modules and commands during runtime, compile them and load them in
i like MongoDB. you can do some Fancy stuff with it and its easy to Scale
(like read only from Secondary nodes if you run the DB in a replicaset)
if you ever grow that big
This is what my reaction menu looks like. This is on my test bot so I set restTimeOffset to 300, but on the actual bot itβs at 700
you can easily generate modules and commands during runtime, compile them and load them in
@earnest phoenix That does sound like a good idea. and I think I've seen that before in some production code snippets. However, I haven't grasped the idea good enough to implement it here yet. Currently I just follow SOLID design principles https://en.wikipedia.org/wiki/SOLID
In object-oriented computer programming, SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable. It is not related to the GRASP software design principles. The principles are a subset of many prin...
why not refactor your code so it instead relies on the user sending a message instead of spamming reactions
yeah thats quite expensive
i'd just keep the reactions there
keep the X as first reaction, and then add the others
and make them all always available
Anyone do Eris here?
why not refactor your code so it instead relies on the user sending a message instead of spamming reactions
honestly its because i think it looks ugly when users type back
who can help me with args
π
how to make args to split and limite with 2 words
you're still stuck on that?
split and check if the length* is equal to or less than 2 items...?
is it always 2 words or only sometimes 2 words?
example command !command nick name platform
when im using command !command gokselw pc working but when
im using !command gok sel pc
not work
i already told you how
lets try again pls
i odnt know
@quartz kindle https://paste.awoo.rocks/inecoyoruw.js
check code
Dude your indentation is terrible
@blazing ravine
with option 1, you cant. there is no way to reliably separate name from platform. your code doesnt know what is what
you have to use option 2 or option 3
Like what is this
Idk JS syntax
case "fstats":
if(args.length > 2) args.slice(1).join(' ');
let username = args[1]
let platform = args[2] || 'pc';
console.log(args[1])
console.log(args[2])
I still think since platform will be known, you could get everything between the command and platform
If platform can be pc, ps4 or xbox1
You can get the text between those two and thats the username
@blazing ravine whats args
.toLocaleLowerCase()
.substring(PREFIX.length)
.split(" ");```
but not work






