#development
1 messages ยท Page 1845 of 1
even though its a command
class config(commands.Cog):
def __init__(self, client):
self.client = client
def write(self, file, data):
with open(os.path.dirname(__file__) + f'\\..\\json\\{file}.json','w') as f:
json.dump(data, f, indent=4)
def cmdCheck(self, cmd, guild):
with open(os.path.dirname(__file__) + f'\\..\\json\\data.json','r+') as f:
data=json.load(f)
if cmd not in data[str(guild.id)]:
return True
return False
@commands.command()
async def test(self, ctx):
await ctx.send(
"test",
components = [
Button(style=ButtonStyle.grey, label="EMOJI", emoji="๐"),
Button(style=ButtonStyle.green, label="GREEN"),
Button(style=ButtonStyle.red, label="RED"),
Button(style=ButtonStyle.grey, label="GREY", disabled=True)
],
)
while True:
interaction = await self.client.wait_for("button_click")
await interaction.respond(content=f"{interaction.component.label} clicked!")
this is my code
its a cog
and im trying the new discord components
please ping me if you know
@shell crest that shows a command with the name test, not bruh.
By the way, you could reduce
if cmd not in data[str(guild.id)]:
return True
return False
to
return cmd not in data[str(guild.id)]
oh thanks!
How do I get a list of guilds the user is in?
I have the guild scope enabled in the oAuth2
But it returns undefined when doing this:
fetch("https://discord.com/api/users/@me/guilds", {
headers: {
authorization: `${tokenType} ${accessToken}`,
},
})
.then((result) => result.json())
.then((response) => {
const { guild } = response;
document.getElementById(
"server"
).innerText += `Server ${guild}`;
})
.catch(console.error);
guild = undefined
Oh wait it still gives me the error
even though I used the right command
I'm sure I have everything right but its not working...
My command isnt registering
document.getElementById("server").innerText += `Server ${guild}`;
Did you ask the guild owners if you're allowed to publish this data?
???
I am talking about oAuth2 with the bot and how I get the guilds of the user who authorized
You're listing guilds your bot is in and add them to the element "server" on your site.
What are you on about lol
I think you get me wrong
Only the authorized user could see it
to do this I still need even to get the guilds... but I dont know how xD
well yeah didn't see your text above the code block
Isn't response an array of guilds? Try logging it
bruh yes I got all servers
its an array
but guild is undefined
const { guild } = response;
There's no guild property in the array prototype
array.guild doesn't exist
It's an array, you'd want to loop through it instead
Or perhaps you mean [guild] = response? That would be the first guild response[0]
let guild = response.forEach(element => {
console.log(element)
});
I did this and this works
that will make guild undefined
yeah I know but at least all servers are logged
lol now I see what he was trying to do
const { guild } = response;
should get a loop
yes yes my shit logic I know xD
for(const guild of response)
{
document.getElementById("server").innerText += `Server ${guild}`;
}
const { guild } = response;
I got it
let guild = "";
response.forEach((res) => {
guild += " " + res.name;
});
mhm but it works :D
that can be simplified to ```js
let guild = response.map(g => g.name).join(" ")
thank you that you exist :P
Lol
I used all of them :P
@quartz kindle Can you turn his nope into a yes?
#development message
Is there a way to parse the data to another html file for example "/profile.html"?
i suggest using ejs if u use express
I use express, yes
and pass to it that guilds list
first I have to google what ejs is
Join our community below for all the latest videos and tutorials!
Website - https://thenewboston.com/
Discord - https://discord.gg/thenewboston
GitHub - https://github.com/thenewboston-developers
Reddit - https://www.reddit.com/r/thenewboston/
LinkedIn - https://www.linkedin.com/company/thenewbostoncoin/
Facebook - https://www.facebook.com/then...
a quick video
no idea tbh
If I change my index.html to index.ejs it says when I go to localhost:port "no such file found"
.<
you need to make express, render index.ejs when someone access profile.html
using
app.get("/profile.html",(req,res)=>{
...
res.render("index",{guilds})
})
where guilds is the list u got from api
@scenic kelp
this might be silly, but whats the proxy_url for?
https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
is that just whats returned when receiving an embed? like discords ext urls?
@earnest phoenix

https://images-ext-2.discordapp.net/ url
yeah thought so. so devs realistically wont need it
would be cool if interactions had that
a backup endpoint that returns custom errors
or something
When there is will, there's is way
type OptionalOnly<T> = {
[K in keyof T as {} extends Pick<T, K> ? K : never]: T[K]
}
type Foo = {
a: string;
b?: number
}
type Bar = OptionalOnly<Foo>
// ^? - type Bar = {
// b?: number | undefined;
// }
One message removed from a suspended account.

can u hide a .gitignore file 
The whole point of a gitignore file is to prevent things from being pushed to GitHub why would you wanna hide it
.gitignore the gitignore 
Oh no
Hey all 
Anyone knows how to send global announcement to all the servers?
I am planning on updating the bot and thus wanna send Release Notes in form of an announcement
So is there any way to do so>
If anything make a change log command or just upload a change log to a GitHub repo
Why?
How is it a spam? I am just sending one global announcement
sending message to "all servers" is api spam
oh
hi
hi
so like
context?
Cosmic knows python?
I do know a bit
simple classes and functions
on all my servers ive tried it on
but the command promt thing
keeps telling me "does not have permissions" or something
when does it happen?
randomly
Hm
Probably cause it doesn't have permissions in that server
yea
yeah I was gunna say that
but how do I like
It could be because the bot is lower then the user
could be
if the bot doesnt have permission then return nothing
idk how to do permission check
also my code is mainl
It an embed stating so that way people don't get confused why it's not working
if : if : if : if : if : if : if : if : if : if : if : if : if : if :
so like
i'll look it up
its a bit embaracing
Idk python so gl
oh
well an example of it in c# would be
if{}if{}if{}if{}if{}if{}if{}if{}if{}if{}if{}
in lua
if then if then if then if then if then if then if then if then if then if then if then
etc
im not using tables
or switches
or anything
are you using discord.ext?
I don't know why youd use that many if statements
because idk tables or switches or what ever the other thing is called
idk what that is
in javascript its very simple to check the bot's permission
from discord.ext.commands import Bot ```
you dont have this?
let me check
@earnest phoenix which command do you have issues with?
I don't have isues with any
all my commands work
but the bot randmonly gets errors saying "does not have permsssion"
just randomly
most likely it occurs when a command that requires a certain permission is not given to the bot
Might have something to do with the bot not having permission to send messages lol
oh yea that too
Hey everyone,
I have a part of my command here and wonder if I could implement this more elegantly. e.g. if I change 5 values of a db entry in a command, I would have to make a call 5 times for each specific field, is there a better way?
e.g. (so im in java)
//Balance changed
user.getInventory().setCurrency(-price);
// Inventory changed
user.getInventory().setItem(item.getName(SINGULAR), amount);
//other possible properties changed...
user.get()...
hey
hey
Hey
so uhm where do i start
Btw which version are you using?
pardon but what do u mean
Cuz the channel create command is different in v12 and 13
the version of Discord.js API
uhm i'm really really sorry but i don't know about what you're talking about yet, like i said im new so ://
help pls
sorry i haven't learned that much
Oh np
can you do ls in your terminal
sure and then search for package.json
ill talk to you guys frankly, i don't know sooo many basic things about bot developing yet, i just started like a week ago
There you will see something like this
This is the version
like that
i already have a bot and has running commands
wow cool
wlcm :))
I see
Type it in the shell tab
you can simply do js message.guild.createChannel('channel_name', 'text')
dont mind the name
to create a text channel
alright
lemme make a file
if i want to create 10 channels in 1 cmd?
mhm
sure
you're missing brackets
now?
yea its good in console
I meant you parameters
pardon but.. 
like the serverinfo file
nope
uhm?
I wonder
What if you need to change smth about your command handler
How would you edit all your command files?
i want it to be more than 10 actually
i wanna test some things
just like to explore more about it
well that will get your bot ratelimited
do it manually 
also i asked my friend
about it
he said i can find it on docs
which he means here
alright then
but i dont know which part

im bad at research
Replace all across all files, eg replace "run(client, msg, args)" with "run(client, msg, label, args)"
you're gonna do this 10x
yea you can
then im all good?
yup
did u mean this? LMAO
then you can just add a message that says its done
yea lol
pov you destroyed your entire commands folder
ohhhhhhh
you're missing another bracket btw
We have version management for that
yea ok after that
then ig you're done
u werent kidding
which part did i miss the brackets
oh
async
replit is reinstalling all packages because one file in .git folder changed
@earnest phoenix your run func is not in the exports
he's just missing a bracket
@dense flame im sorry to ask but can u specify which area i need to put brackets
can you show your code again
2 brackets in line 21?
simply transfer line 6 to line 21
oh
no just one
dont put space between run and ()
whitespace doesn't matter
my friend sent me this code
for (var i = 0; i < 20; i++) {
message.guild.channels.create("name", { type: "text" })
}
is that also a good one?
That is just replit being dumb
The program should run fine
I want to ask about how would i check what option the user selected like
if(option.selection == first_option){}
elseif(option.selection = 2nd_option){}
how do we check that
use a switch
use switch case. or u could use dictionaries
they are using javascript
dictionaries don't exist
{
key: "val",
key2: {
key3: "val2"
}
}
dictionaries/objects
that's just more steps than a switch
much more organized than switch
u need an object and a single if statement
it worked
You can put the cases inside brackets to make it look cleaner
switch (option) {
case "selection": {
do stuff;
break;
}
}
thanks for the help @dense flame
true
yes but that would cause a ratelimit
and use a loop @earnest phoenix
also how are you going to execute stuff based on the selection if you're using an object?
No problem
let obj = {
option1: "some value",
option2: "some value",
option3: "some value",
option4: "some "
}
if (option.selection in obj) { // assuming that keys in the object are named after different selections
// option exists. do stuff
}
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.emoji.name === "๐" && user.id !== client.user.id) {```
how do i add a role to the user that reacts to the emoji? Isn't it like user.roles.add?
its member.roles.add()
member is the guildMember object
I want to use the client object in an index.ejs file. I already exported the client object to the app.js file where the webserver is started:
module.exports = async (client) => {}
res.render('index.ejs', { client });
How can I use the client object so I have access to the client?
how would i fetch a member from a user.id again?
Isn't it like: client.users.fetch(user.id)?
reaction.message.guild.members.cache.get(user.id).catch(err => console.log(err));
you can't catch an ordinary method
In Python, if I don't put in overwrites when creating a text channel, does it sync with the category's permissions?
client.user.username?
got It at the same moment :P
Index.js where the bot is:
require("./app.js")(client)
App.js, where the web server is started:
module.exports = async (client) => {
res.render('index.ejs', { client: client });
}
index.ejs:
<p>Client username : <%= client.user.username %></p>
This works fine and the output is "Client user: [username]"
But when I use the client in javascript with
<script></script> it says client = undefined.
So how can I define the client to use it as a normal object?
@signal estuary a nodejs object most likely wont work in the browser and vice versa
Got it, but now I'm getting this error:
Ignoring exception in command create:
Traceback (most recent call last):
File "C:\Users\###\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\Room_Sealer_V2\cogs\room-sealer-admin.py", line 328, in _create
await ctx.guild.create_text_channel(member.name, overwrites=overwrites, category=category, reason="Auto generated from command")
File "C:\Users\###\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\guild.py", line 948, in create_text_channel
data = await self._create_channel(name, overwrites, ChannelType.text, category, reason=reason, **options)
File "C:\Users\###\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\guild.py", line 844, in _create_channel
'id': target.id
AttributeError: 'NoneType' object has no attribute 'id'
Code:
@commands.command(name='create')
@commands.has_permissions(manage_guild=True)
async def _create(self, ctx, member: discord.Member):
overwrites = {
ctx.guild.default_role: discord.PermissionOverwrite(view_channel=False)
ctx.guild.get_member(member): discord.PermissionOverwrite(send_messages=True,attach_files=True,embed_links=True),
ctx.guild.get_member(431544605209788416): discord.PermissionOverwrite(view_channel=True,send_messages=True,manage_webhooks=False)
}
category = ctx.guild.get_channel(876423058825564181)
await ctx.guild.create_text_channel(member.name, overwrites=overwrites, category=category, reason="Auto generated from command")
pass
well, first of all: you should never pass your client object to web, second. If you need, you can make it this:
<p id="data"> <%= client %></p>
<script>
let client = document.getElementById("data").innerHTML
document.getElementById("data").innerHTML = ""
</script>
that wont work either, you need to serialize it
<script>
const client_side_variable = <%= JSON.stringify(some serializable object from the server here) %>
</script>
hi! does anyone know any simple like
pagination stuff in js
im developing a music bot right now and im on the queue list system, wanted to make a pagination system so you can browse thru the songs
right now, the queue list can only show 10 songs at once
make one with buttons
i know but how exactly?
there are many ways
right now, i have this code
const embed = new Discord.MessageEmbed()
.setTitle(`Current Queue for ${message.guild.name}`)
.setDescription(`${queue.songs.map( (song, id) => `**${id ? id : 'Playing'}**. ${song.name} - \`${song.formattedDuration}\``,).splice(0, 10).join('\n')}`)
message.channel.send({embeds: [embed]})
get the queue then turn into songs, get the name and duration of the songs
then .splice them to show only 10 at once
so does anyone know how to have like
a simple pagination with this?
for example, you can send it like that
then add a prev/next button
and use awaitMessageComponents
yeah? then what
then on click, check if the prev or next button was clicked
and advance or reduce your splice indexes by 10
then edit the message
you can also do it with a messageComponentCollector
might be better
you can also make it stateless and use the interaction event
by putting the queue id in the buttons
wdym by putting the queue id?
buttons have a custom_id field
yeah that
you can put anything on it, and you'll get it when you receive the button interaction
so for example
you can send 2 buttons, next and prev. next has in its custom id the queue id and the next slice indexes
the prev button has the same queue id but the previous indexes
on interaction, you get the queue id from the button, load the list from your queues, slice it by the indexes from the button, and edit the message from the button
Do you know how I can filter the server I get to the server you have mutual / sharing with the bot?
fetch("https://discord.com/api/users/@me/guilds", {
headers: {
authorization: `${tokenType} ${accessToken}`,
},
})
.then((result) => result.json())
.then((response) => {
console.log(response);
let guild = response.map((g) => g.name).join(" \n ");
document.getElementById("server").innerText += `Server ${guild}`;
})
.catch(console.error);
};
if thats using the user token by oauth2, you can filter the guilds by whether they exist in your client
eg: response.filter(g => client.guilds.cache.has(g.id))
Hello
๐ hi nom
if else
Any2 know any open source discord bots that have a help command with buttons because cba learning anymore itโs to hard
Perfect definition of how not to make a good bot lmao
Not even that
Itโs just I donโt understand a fooking thing Iโve seen on YT or google
I was watching the Videos by FreeCodeCamp at first
Can u send a link plz
But They suxked ๐ฆ
Their rest of the videos were pure class but the one of discord bot was totally bad
Meh they were bad
Oh
But I can send CodeLyon's Videos if you want
Because I wanna have buttons but I donโt understand it
I followed them only
oh I too didnt learn on buttons 
I thought you asking about discord.js beginners
If you guys are using djs. Read this https://discordjs.guide
No one is going to write code for you
theres a whole section on buttons there which seems to break it down real to the basics.
I want something like this
Is it
That's pagination
And it's not really hard
It's kind of same as using reactions
But you use buttons
yt videos are a bad way to learn about djs imo ๐
Why don't you search yourself?
they are? 
instead of asking us
theres a very good guide and docs for djs, no need for videos.
Because Iโm in the car
discordjs.guide is the best guide
Maybe ๐ I liked CodeLyon's videos though
so?
Mobile google is dog
Only good for one website and one website only ๐
I don't think you live in car
But I am for the next 2 hours
Regarding global commands...
Discord docs:
To create commands in a guild, your app must be authorized with the applications.commands scope.
In order to make commands work within a guild, the guild must authorize your application with theapplications.commandsscope. Thebotscope is not enough.
DiscordJS docs:
Global application commands will be available in all the guilds your application has the
applications.commandsscope authorized, as well as in DMs.
There's no word about global commands need the applications.commands in guilds to show up in the Discord dev docs.
They should slowly fan out if a guild has added the bot, shouldn't they?
wtf is actually true?
Do I fucking need to wait up to one hour after a guild added the bot until the slash commands appear?
u send ur commands to discord and they store it in their db, it takes 1 hour
Damn... do already certified bots need to request the scope as well?
That would require to reinvite the bot on all guilds... wtf
They gave the scope to already existing/invited bots but newer bots that get invited need the scope
Ahh alright, didn't know that. A last thing to talk about...
They gave the scope to already existing/invited bots
Does that mean the existing bot which got the scope from Discord needs to require the scope also if it gets invited into a new guild?
but newer bots that get invited need the scope
Or does it only matter for applications created after the feature got rolled out by Discord?
they said they would possibly do a new scope migration in the future
meaning all bots that dont have the scope should get it automatically later on
but its a good idea to change your invite link to have both scopes
New guilds, yes
To all bots
Ah okay, so they just got it for all guilds they already in but still need to require the scope if the guilds adds them.
ye
Wow I guess lots of bots didn't notice that.
Which means all guilds they got added to before changing their invite link can't use the bot at all
If you remain on slash commands only
yeah unless they reinvite
wow what a bullshit
It should be granted automatically to all existing bots until the feature got rolled out
it already was
and they said they would do it again before the intents come next year
basically as far as i understand, only a small fraction of servers wont have the scope right now, those who were added after the migration and before the invite link was changed
๐คฆโโ๏ธ
the migration was march 25
oh really, lol
Is there any easy way to get notifications in disc channel when someone votes or leaves a review?
it is catergory = self.client.get_channel(channel-id-here), not ctx.guild.get_channel(876423058825564181)
It is when it's in a cog
here is message
and what you mean?
How is the API function called to send a message to the bot I can call?
you want to be able to call with your bot?
cursor = db.cursor()
sql = f"DELETE FROM main WHERE message_id=?"
val = (m_id)
cursor.execute(sql, val)
db.commit()
cursor.close()
db.close()```
m_id = message id
`ValueError: parameters are of unsupported type`
whats the problem?
Can you log what m_id is
is it because val is a tuple
i dont know if python would infer you're trying to create a tuple with that
oh no execute is supposed to take in a tuple
nevermind
can you do (m_id,) instead of (m_id)
god python is confusing sometimes
the convenience and curse of loose types
but if you had strong typing the compiler would've caught thats not a tuple
if the error was also a bit more informative
It would've, but this is really down to syntax. A missing , to represent a tuple so the compiler could catch it. Though, you don't need a static type checker to tell you that one of your types are wrong (as the uninformative error says)
assuming the library you're using is nice enough to check types for you in runtime instead of pretending it's correct and throwing a random error
thanks it worked
idk why py asks for , XD
because without one it thinks you're trying to add standard brackets (for example in math operations)
Yup
the comma implies that there's more than one element in a tuple (). Without it it just ignores them and returns the element within the parentheses because order of operations
Can't you also do tuple()?
well it would have to be a iterable before giving it to tuple()
val = foo, also works
Can someone explain this error?
> topazrpgadmin@0.1.0 dev C:\Users\Yarne\Desktop\youtube-react-admin
> cross-env concurrently -k "BROWSER=none npm start" "npm:electron"
[0] SET BROWSER=none npm start exited with code 0
--> Sending SIGTERM to other processes..
[electron] npm run electron exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! topazrpgadmin@0.1.0 dev: `cross-env concurrently -k "SET BROWSER=none npm start" "npm:electron"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the topazrpgadmin@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Yarne\AppData\Roaming\npm-cache\_logs\2021-08-15T16_59_32_111Z-debug.log
doesn't look like the whole log
There
doesnt really look useful, could you send the debug log file?
and what are you trying to do
I'm trying to run my electron-react app
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm@6.14.13
3 info using node@v14.17.3
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle topazrpgadmin@0.1.0~predev: topazrpgadmin@0.1.0
6 info lifecycle topazrpgadmin@0.1.0~dev: topazrpgadmin@0.1.0
7 verbose lifecycle topazrpgadmin@0.1.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle topazrpgadmin@0.1.0~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Yarne\Desktop\youtube-react-admin\node_modules\.bin;C:\Python39\Scripts\;C:\Python39\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\Yarne\AppData\Local\Microsoft\WindowsApps;;C:\Users\Yarne\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Yarne\AppData\Roaming\npm
9 verbose lifecycle topazrpgadmin@0.1.0~dev: CWD: C:\Users\Yarne\Desktop\youtube-react-admin
10 silly lifecycle topazrpgadmin@0.1.0~dev: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'cross-env concurrently -k "BROWSER=none npm start" "npm:electron"'
10 silly lifecycle ]
11 silly lifecycle topazrpgadmin@0.1.0~dev: Returned: code: 1 signal: null
12 info lifecycle topazrpgadmin@0.1.0~dev: Failed to exec dev script
13 verbose stack Error: topazrpgadmin@0.1.0 dev: `cross-env concurrently -k "BROWSER=none npm start" "npm:electron"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:375:28)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:375:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid topazrpgadmin@0.1.0
15 verbose cwd C:\Users\Yarne\Desktop\youtube-react-admin
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v14.17.3
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 1
22 error topazrpgadmin@0.1.0 dev: `cross-env concurrently -k "BROWSER=none npm start" "npm:electron"`
22 error Exit status 1
23 error Failed at the topazrpgadmin@0.1.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
show your package.json
{
"name": "topazrpgadmin",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.4",
"@material-ui/data-grid": "^4.0.0-alpha.29",
"@material-ui/icons": "^4.11.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"cross-env": "^7.0.3",
"electron": "^13.1.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"recharts": "^2.0.9",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"electron": "npm start && electron .",
"dev": "cross-env concurrently -k \"BROWSER=none npm start\" \"npm:electron\""
},
"main": "src/main.js",
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^6.2.1",
"wait-on": "^6.0.0"
}
}
I need a giveaway code please
Also, it works when I run npm start and then electron .
But I need to wait like 3 seconds ish
does your dev script run without npm?
if you just run cross-env concurrently ... instead of npm run dev
what is a sticky role?
Like, when i mute someone, and they rejoin, then they will still have the muterole
and their roles will not get reset
you need a database
You need to store the user id and their roles in a database
Then check users joining against the rows in your database.
Discord... databases...?
It's the same. There's no difference whether it's discord or a website. A database is a database.
You can use MYSQL, Postgresql etc
your destiny is now life in hell for posting that
lmao
its much more limited yes, but its easy to use and okayish for beginners
and still better than json :^)
No
path is correct and try again.
At line:1 char:1
+ cross-env concurrently -k \"BROWSER=none npm start\" \"npm:electron\"
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (cross-env:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Could i DM you?
Why?
remove the slashes
hey i have a little code that sends an email:
!email (mail)(subject)(text)``` using this format. I have now set the fields with simple args[0] etc etc properties
const args = message.content.split("\n")
.map((x) => x.split(/ +/));```
how would i make sure that i can have a text and subject that isn't only 1 word long actually?
it's basically just !email test@hotmail.com hey this is the subject and this is the text
which of course is not possible
so do you know any way to approach the problem?
you need to separate them somehow
any suggestions?
for example new lines, or ; or something else
if i wanted to split them based on a |, how would i do that?
like: !email test@hotmail.com|this is the subject| etc etc
the same way you split anything else
yeah i could split it, but it would split every word in the string right?
you are hot tim
lol
he is
same error
then you need to get cross-env working first before you add it as a an npm script
idk if the problem is with cross-env or with concurrently, never used either of them
I have this code:
const { ShardingManager } = require("discord.js")
import { token } from "./environment_variables/variables.json"
import * as functions from "./functions"
const manager = new ShardingManager("./bot.js", {token : token})
manager.on("shardCreate", async shard => {
await functions.processShardCreate(shard)
})
manager.spawn()
Error:
This session would have handled too many guilds - Sharding is required.```
I'm running the sharding file:
Can someone please tell me what I'm doing wrong?
does someone know a good canvas template for a welcome bot?
discord-canvas
you are missing the totalShards: 'auto',
yeah but it only has one welcome style and i dont like it
I'm not trying to autoshard though
Can som1 help me with an "error" im having
client.on("message", async (message, member) => {
if (message.member && message.member.roles.cache.has("765885271861624843")) return;
if (message.author.id === client.user.id) return;
var noWords = JSON.parse(fs.readFileSync("./antiping.json"));
var msg = message.content.toLowerCase();
for (let i = 0; i < noWords["antiping"].length; i++) {
if (msg.includes(noWords["antiping"][i])) {
message.delete(1000)
const role = member.guild.roles.cache.find(role => role.id === "765885271861624844");
member.roles.add(role)
setTimeout(function () {
member.roles.remove(role);
}, 2000)
let embed = new Discord.MessageEmbed()
.setTitle("Please dont ping staff!")
.setURL("https://client.dynamichost.xyz")
.setColor("#ff2e2e")
.setDescription("We can be really busy sometimes. \n Being at school or doing work... \n We do see your messages so please be patient. \n Dont ping staff without permission. \n \n If you pinged a staff in your ticket, \n The ticket is now less likely to get checked quickly.")
.setFooter("Regards - DynamicHost")
.setImage("")
.setThumbnail("https://cdn.discordapp.com/attachments/726137537575518299/836649762656616528/450.png")
return message.channel.send({ embed });
}
}
});
This just doesnt work anymore ๐ญ
Its supposed to timed mute the user who pings staff, and delete the message + send that embed.
what error
It just doesnt work
and only send the loc which is causing the error
what debugging have u done
to be exact
just trying to use the command in general, and we've tried using vscode to find errors
but it reports 0 problems
debug ur code, the problems tab on vsc is only going to show syntax errors
Rightt..
when u debug ur code and u still have no idea, then come and ask
makes everyones life easier and i can have a better understanding on how to resolve ur problem ๐คท
I could be wrong... But I believe the message.channel.send({ embed }); line should be message.channel.send({ embed: embed }); since you're using named parameters
nah, u can do that since the variable name is the same
I have a binary number in JS how do I invert it?
0b1001 to 0b110
also .delete(1000) is not a thing anymore, its .delete({timeout: 1000}), and in v13 it was removed completely
because bitwise in js implicitly converts the number to signed int
yeah i jus realised hes mixed code from like v11 with v12 lol
does someone know a good canvas template for a welcome bot? (not discord-cavas)
I dont want it to get signed.
Iwant this ~9 to be 6
hmmm
Actually i want x number of bits, all 1
the only way afaik is to create a bitmask and xor it
actually, there might be a better way brb
So i wanted to do something like this
~(1 << (x + 1))
Fucj
just regen it
But what exactly is your problem?
Oh nevermind I see it
You're not defining client
Regened it
You're defining it as Client
Phew
also, your login is inside your message event lol
^^
so it will never login
you havent even put quotes around your token
Who?
please learn some basic js first
Am i bound to 32bits with this?
codecademy
?
No
That's not right
You're using js const Client = new Discord.Client() but you're trying to use it as client
every time a message is sent ur tryna connect to discords gateway lol
You should learn javascript before making a discord bot
Oh ok
Well fuckโฆ investigated that shit and found out I have to leave all guilds in order to get reinvited
Bullshit 
Surely they'll change it in the future, seems like a massive hassle to do that
I use capital C or not?
that says the guild admins need to kick and reinvite to enable slash commands
it can be anything, it can be monkey kangaroo anything. it just has to be the same
(with a few exceptions)
Yeah did that already, sending a message to the last known channel and the owner with the message before leaving
Ok
Guess it will take a while until the bot got invited into all active guilds again.
But who caresโฆ
Just got a verified bot with 3 guilds itโs in now 
I don't think they need to kick. They can just re-invite and authorising the new invitation will override whatever perms the bot had in their server.
Saves having to set up any channels etc if your bot requires configuration
Since it never leaves
Ah Iโve left the guilds already.
No big deal as thereโs no general bot configuration needed but still possible
Itโs just a lookup & converter tool not more
Oh okay
Damnโฆ you should have told me that earlier 
Sorry I was eating dinner 

Can tell tho?
Or should i just watch a tutorial
?
Use nix files
What the f4ck is that
Oh okay
Ill go watch a tut after school tmw
Tmrw
Alright im gonna go sleep
Tmrw contiune
let channel = await this.channels.fetch("766019210454892644");
console.log(channel)
Why is this returning null?
Ok nvm my bot wasn't ready yet
l
show more code if you can
i'm new to typescript, this is my code
class User {
public age: number
public name: string
protected auth: string | void
constructor(age: number, name: string, auth?: string){
this.age = age
this.name = name
this.auth = auth
}
createAuth(v: any): void {
let final: string
for(var char in v){
if(!allChars.includes(char)) return console.log('Impossible to create auth. Please insert a number, letter or \', / .\'')
final += char;
}}}```
i'm getting this error:
Assign the variable first, like let final: string = โโ;
Unless thatโs going to mess your code up somehow later
Also I'm not sure but ts might not like it that v is of type any and you're trying to add it to a string type
thanks
no, that was ok lmao, thank you anyway
if you do let string = "" you don't need to put : string as typescript declares the type string to variables that are assigned with ""
Yes Iโm aware
i'm more comfortable putting : type anyway, just because it makes the code more readable for me
the declaration is still unnecessary and adds to file size. I force my editor to shun me for useless type casting
.nix lmao
Letโs create a script out of it and sell it to all the poor dudes outside using that service to be able to update to djs13
Let me be your marketing manager
xD
Can you send attachments when you respond to a slash command?
Not yet. The API doesn't support it yet.
They're working on it.
Hopefully that'll be done soon
Yep. A lot of people waiting on it.
i wonder how they're gonna implement it on the inteaction webhook response
probably make us respond with multipart formdata
although its a bit weird to use it as a response rather than as a request
No but you can patch the initial response with attachments
That's what I do
Defer, and then patch the thinking message with actual embeds and attachments
Since the PATCH method accepts same payload as you would when you edit a webhook/send a message
So you could upload attachments and JSON via form data
So yes it technically supports it
Is there any chance or command option type other than STRING fetching any user input even if thereโs a whitespace used?
No
Hmm what a crapโฆ
Makes things more complicated than necessary.
Any idea then how to collect an user input in form or a text without using multiple command options and without using the message_created event?
What do you mean by multiple command options?
I could register multiple (optional) application command options for a single command.
โฆ to collect not a single STRING the client enters but multiple words (split by spaces)#
/command optional_option1 optional_option2 etc.
Which would be an ugly solution
Why can't you just use string? It supports spaces
Huh wut no it doesnโt ?!
Hmm that might be the issue
You don't need to press tab if there's only one option
It'll submit it with the space
Yeah noticed that right now while testing
Weird it works tho but didnโt work earlier that day
Definitely not by asking here
npm install express
npm remove node
ur not being helpful here, plz leave.
Ur asking how to make a botlist on another botlist's support server
people willing help me
It's like working on Microsoft and asking at Apple how to make MacOS
Probably best not to ask for help with that here yeah ๐
Lol
ur not being helpful here, plz leave.
Yes, away with you Mr. Kuuhabakaubku. 
where do i get started with discord's oauth2 
Oauth2 is the same everywhere
Basically you exchange tokens with the service twice to get the info u want
well im new with Oauth2
im trying to put a background on my bots page.
This is the cod ei have: css .page { width: 100%; height: 100vh; overflow: scroll; overflow-x: hidden; background: url('https://cdn.discordapp.com/attachments/875699183556886560/876684332301975582/fate-series-fate-stay-night-unlimited-blade-works-rin-tohsaka-wallpaper-preview.jpg'); background-repeat: no-repeat; background-size: cover: } for some reason it doesnt change it even after refreshing multiple times and clearing cache
the code is fine right?
Except for the last part where you write cover:
still hasnt fixed
Did you pick the right imgur link?
.page {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('https://imgur.com/a/ZIggedh');
background-repeat: no-repeat;
background-size: cover;
}
yes
Yeah, totally wrong link
how should i
ok
so should i do copy address
Right click on the image
i get this
Then click open in a new tab
https://i.imgur.com/D8kuMrO.jpeg
Ye
yea
Generally "open in a new tab" will solve redirects, that's why I recommend it
still didnt change
Gtg now, I'll leave it to cosmic
ahh
what's your current css again
<style>
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2);
-webkit-transform: translatey(-30px);
transform: translatey(-30px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
}
.entity-header__image {
animation: float 5s ease-in-out infinite;
border-radius: 50% !important;
}
.page {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('https://i.imgur.com/D8kuMrO.jpeg');
background-repeat: no-repeat;
background-size: cover;
}
</style>
this is all of it
try changing .page to .entity-wrapper
ok
doesnt work
that's weird
could you share some other code to change the bg then?
yea I have the same code
just except this one
hmm
.entity-wrapper {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('https://i.imgur.com/D8kuMrO.jpeg');
background-repeat: no-repeat;
background-size: cover;
}```
@dense flame this is supposed tow ork?
to work*
yea
nice
but @dense flame the whole image is not being showed
may I see
@dense flame
its suppposed to have the character on the right
I see
sorry, im new to css so idk much image formatting
honestly, I am not sure why is that happening
is it the background size part
It could be
what should i do then
Try cropping the image then reupload it to imagur
ok
its pretty weird now
im going to try another image3
what should the res be @dense flame
1920x1080??
p[retty weird
yea lol
should i get a 1920x1080 image
yea ig that's fine
yoyr page too long
same problem
wdym
an you're using cover
to cover the long page the image is getting cropped
try using repeat y
then it won't crop out
rather it'll multiply the image
then what should i do
but repeat-y would look weird
i havent even learnt css
So I prefer getting a long image
then doing repeat
and blur out the bottom
so that the transaction go smooth
is ther no alternative
^^ this
ok
can you crop out this part of the image only
ok
then try
but the thing is
i want the character to be on the right
....
beneath the invite and vote buttons
can you fix the background then ?
try this
background-attachment: fixed;
np
Y not use the preview button
If anyone here is good with PHP, can they shoot me a DM, just have a quick question
does someone know how i can put a black border around this
nvm ifigured it out
how can i change the color of the description on the bots page
Hi how to fix this error TypeError: isinstance() arg 2 must be a type or tuple of types
the second parameter must be a tuple
ok thanks man
.....
-_-
Hey.
In order to make a !ping command in slash commands, does the strategy work the same in normal commands?
Like the code is like the same but in slash commands?
.. to send a message then calculate the time, etc?
yes
a slash command is essentially a webhook, and a webhook returns essentially the message object, and the message object does indeed have a timestamp
What do you mean?
Could you remind me what websocket is, also, again?
a protocol which communicate over tcp
Oh, I see, so I use the same strategy but in webhook in regards to the ping command, right?
which means realtime communication
Ohh...
just forget that slash commands are webhooks. ur confusing urself
๐
all u need to know, whatever u can do with webhooks, u can do with slash commands
when u get a better understanding, look in the discord dev docs and it'll help
tf
No you can.
Unless you're talking about something else.
You definitely can't. The API doesn't support it.
You mean attach files/images to embeds?
No. Not embeds. Message attachments.
๐
wait wrong ss
Even Discord acknowledged it doesn't exist yet.
A lot of of devs are stuck waiting for Discord to support attachments through the API including myself.
then their docs are wrong
No they're not. Where's the message attachments on what you sent?
the last screenshot?
No you're not reading in the right place
channel#createmessage isn't an interaction response
wut?
https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response ->
https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object ->
https://discord.com/developers/docs/resources/channel#message-object
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
There
There's no point in arguing man. It's just not possible right now.
im confused then, cuz when u create an interaction response it says interaction structure has the message object
? im not arguing
It's possible 
Yeah it uses a message object.
yeah, and the message object has attachments ? confusion
With a huge workaround
but it's not supported properly yet
It's not huge at all
Try attaching an image to a slash command then come back and see
i've only got content and embeds like workin on my bot

