#development
1 messages · Page 160 of 1


binbows makes it annoying to use clang :c
cargo makes cars go
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.
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.
One message removed from a suspended account.
One message removed from a suspended account.
Eh
I’ve got MSVC working with CMake now so I’m not gonna bother
Kind of a dumb question, but how can I get VSC to recognize errors without finding out via compiling?
For example, I have this code, which very obviously doesn't work because head cannot be set to nullptr since it's not a pointer type, but VSC doesn't recognize it and thinks everything is fine
TS or cpp?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I have the extensions, but it still fails to detect some basic errors like that
try reloading the window
doesn't change anything
One message removed from a suspended account.
One message removed from a suspended account.
ironic
so you need a C++ grade
you cant afaik
VSCode's C/C++ intellisense probably only works on syntax-level
or maybe its just shit 
Made by the LLVM project 
volt trying not to promote clang challenge (impossible)
True
Time to promote that nully is awesome

So a message can have user mentions. role mentions and channel mentions. Should i make these their own fields on the message object or combine it all into one mentions field on the message?
I could do something similar to djs where its just a class that handles mentions and splits them into member, user, roles and channel fields on the class itself
constructor(data: APIMessage, client: Client) {
this.client = client;
this.id = data.id;
this.channelId = data.channel_id;
this.author = data.author;
this.content = data.content;
this.timestamp = data.timestamp;
this.editedTimestamp = data.edited_timestamp;
this.tts = data.tts;
this.mentions = data.mentions;
this.channel = this.client.requestManager.get(Routes.channel(this.channelId));
}
so my this.channel will end up becoming Promise { <pending> } because this.client.requestManager.get returns a promise, and since i can't use async/await in a constructor I would end up having to use .then and such right? Well when I do that it ends up becoming undefined
this.client.requestManager.get(Routes.channel(this.channelId)).then((result) => {
console.log(`Result:\n${JSON.stringify(result)}`);
this.channel = result;
});
Are you not able to do this? Cause result does log as a proper channel object, but when assigning it to this.channel it becomes undefined later
there's probably a better way to be doing this
Does djs no longer use a Proxy for the rest
You'd need to make a new method (called init for example) to allow usage of async/await, what you're doing is not possible in a constructor
Nope, they have client.rest and Routes now
you can already do that
yeah but would be nice in the class syntax sugar
perhaps
but that kind of goes against the whole principle of classes
Promise being an exception for god knows why
What user notices the difference between a pre class syntax and post through a lib when they're not expected to edit the src
Other than an async constructor
cursed
yup
new can be used on any function tho so
i dont really do this on my code lel
i rather have a dedicated method for it
like .init() or something
😠
I see, I will just call init when initiating a new instance then
thanks for that simple solution
:p
@earnest phoenix channel still seems to become undefined even though my request get returns a channel object
const myClass = new Class();
await myClass.loadChannel();
// use myClass.channel here
or, you can do this
Show code?
constructor() {
...
return this.client.requestManager.get(Routes.channel(this.channelId)).then(x => {
this.channel = x;
return this;
});
}
const myClass = await new Class()
:^)
4hr lab jeez
sounds reasonable to me 
This just returns undefined btw
but what voltrex said works I just forgor to await my calling .init
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
odd
it returns undefined for me no matter what
also returning a constructor gives me issues
show cod?
ye
returning ```
this.client.requestManager.get(Routes.channel(this.channelId)).then((x) => {
this.channel = x;
return this;
});
is not valid
you cant use async in the constructor, but you can return a promise and use async in it
does requestManager.get() not return a promise?
why Promise<void>? shouldnt it return Promise<APIChannel>?
I don't have it typed out
so its any
I am too lazy to give it a return type based on what is being requested from the api

well, it shouldnt interfere with the actual runtime
yea
you can just type the return value as your class
TS2409: Return type of constructor signature must be assignable to the instance type of the class.
TS2740: Type 'Promise ' is missing the following properties from type 'Message': client, id, channelId, channel, and 7 more.
ah well, TS doesnt like that

because classes are not supposed to be async
average ts for ya
its just a js hack
yeah thats the correct way of doing things anyway
its the way i do it too
you mean like msg.mentions.roles / msg.mentions.users?
or do what djs does and have partial channels from data sent by the packet if the full thing isnt available to instantly have a .channel if it isnt fully available
welcome to javascript
i guess it might be useful if some library either returns an empty object or a function you can call
so like data?.callback()
or something idfk
agreed, it looks wonky af
but kinda cool idk
a?.()?.b?.()?.c?.()
Yea
The intent was to replace people checking if a function exists then executing it, like instance.getAll && instance.getAll() with instance.getAll?.()
A good amount of people wanted that in the optional chaining proposal
I can see the logic behind it but like lmao it looks so weird
its because of JS's dynamic nature, you can never be sure things exist or not
since they can be removed on the fly if need be
TS
the proposal was for JS not for TS lel
TS is directly affected by JS tho
TS has to compile to JS
What I meant by mentioning TS was that it's stricter and stuff like what the function optional chaining is for would occur less often
yeah, which means TS will likely never need to compile into optional chaining
but JS still needs it
regardless of TS's existance
TS still added optional chaining before JS
Compatibility reasons, a library could be trying to be compatible with all versions of a dependency they're using, and so they could be checking for a method that had a name/argument changes between versions
well, idk about that, i dont see why TS would ever need it, but TS also likes being the first one to implement novel JS syntax
My thoughts exactly
Situations where you could argue for it would occur much less if at all
yeah but still, JS is a thing that exists without TS
so all JS decisions dont need to take TS's existence into considerations at all
Though something could be said about developers being unsafe
Yeah that's the weird thing about TS, they go ahead and try to implement a proposal even before JS has gotten it, even though they have absolutely no idea if the proposal will move up to the final stage (stage 4)
unsafe {} 
you're unsafe
All the TS compiler does is to rewrite the TS code that uses such proposals to ways that can be implemented in JS without the need for the engine to implement it
i dont quite see how adding optional chaining would make typing any less safe for developers
For example, TS can't implement realms because it needs engine-specifics which it can't interfere with
nope, my function is safe 
The generic type is incorrect, it should be Thicc + ?Sized 
:^)

Damn I have unfortunately been caught in 8000K
in over 9000K
🏃♂️
LGHDTVJWSP++
I typically see partial interfaces as unsafe unless there's a clear distinction marked by another property where developers can definitely expect certain properties/methods. Even then, that doesn't always mean the properties/methods are there which the reasoning can range from logical to illogical
optional chaining itself isn't unsafe, but in certain aspects can enable such behavior
this is the first time i see a non-rust dev get concerned about unsafe
i understand where you're coming from, but the reason for such feature to exist is because the language itself (js) allows for such things to happen, even if its not something that developers actually do
in typed languages there is no such thing as dynamic interfaces where methods can be nullable, so there is no need for such feature
in js its possible, even if its never done in practice, so features like optional chaining are needed, because the language itself allows for those things
its basically ducktape solutions to things that exist as a side effect of js's design
@quartz kindle 😭
just use rust 
Which is fine imo. Though I personally don't think JS lends itself to being beginner friendly in the sense of teaching the very important concept of type safety
Which perhaps it's designed the way it is specifically to avoid some of the nuances of type safety
perchance :^)
One message removed from a suspended account.
Can you make slash commands only show in certain servers? For example; for general bot maintenance I have a few commands I like to use, currently I have them done by prefix so server owners cant see the commands etc, but it's the only reason I need message intent for, so I'd like to remove it if possible.
Yes, you can
One message removed from a suspended account.
Or just google it
One message removed from a suspended account.
-insert docs link here, or any form of helpful response-
One message removed from a suspended account.
😬
One message removed from a suspended account.
I have no idea what programming language he uses 
yeah should be possible mate, what programming language do you use?
Python, specifically discord.py.
Python, specifically discord.py.
In that case, I can't help you because I haven't touched python at all
What have you used? Then I can correlate the docs you have to mine.
look for global commands vs guild commands in the docs
global commands show up in all servers
guild commands only work on specific guilds
and you create them on a per-guild basis
Yeah, I found this. I'm assuming this is the same thing.
import discord
from discord.ext import commands
import asyncio
from discord import Activity, ActivityType
from datetime import datetime
from discord import ActionRow, Button, ButtonStyle
import random
intents = discord.Intents.default()
intents.members = True
intents.guilds = True
intents.messages = True
intents.reactions = True
intents.presences = True
intents.message_content = True
bot = commands.Bot(command_prefix='!', intents=intents)
bot.remove_command("help")
# ========== On Ready / Status ==========
@bot.event
async def on_ready():
print(f'[+] Logged Into {bot.user}')
await update_status()
async def update_status():
while not bot.is_closed():
server_count = len(bot.guilds)
await bot.change_presence(activity=discord.Streaming(name=f"{server_count} Servers! | v0.0.01", url='https://twitch.tv/Vaypt_rz'))
await asyncio.sleep(1)
print(f'[+] Logged Into {bot.user.name}')
bot.start_time = datetime.now()
# ========== Command Loader ==========
await:
bot.load_extension('moderation')
bot.load_extension('utility')
# ========== Token Login ==========
bot.run('')```
It gives me an invalid syntax
for the bot.load_extension
That's not how you use the await keyword
breh
load_extension takes in a file
https://gist.github.com/15696/a1b10f044fbd658ce76ab1f862a1bda2 simple example here
simple cogs example in discord.py. GitHub Gist: instantly share code, notes, and snippets.
The await keyword can't be used as a block to resolve all promises inside, it should be
await bot.load_extension(...)
await bot.load_extension(...)
also you dont even need to await it iirc
It tells me to await it
ah right
also here's a better example
Simple cogs example in discord.py (tested on 2.0.1) - cogs_slash_test.py
its more updated
ah hell no, I'll just seperate my commands, that's confusing my small brain
the layout of it, in that example, how do I even make it work, it's hard to understand
^
Okay so essentially
async def setup_hook(self): #overwriting a handler
print(f"\033[31mLogged in as {client.user}\033[39m")
cogs_folder = f"{os.path.abspath(os.path.dirname(__file__))}/cogs"
for filename in os.listdir(cogs_folder):
if filename.endswith(".py"):
await client.load_extension(f"cogs.{filename[:-3]}")
await client.tree.sync()
print("Loaded cogs")
This part here is basically just overwriting the default nature of setup_hook by grabbing the folder where your cogs are os.path.abspath(os.path.dirname(__file__)) this part just grabs the directory where the current file is which usualy is your main.py in the root of the path and you'd have a cogs folder in that root as well. Then it loops through the files of your cog folder and gets the files that only end with .py and loads them as cogs.whatever. client.tree.sync() is only useful if you are doing application commands which you can skip if you're not.
#cogs / test.py
from discord.ext import commands
class Test(commands.Cog):
def __init__(self, client):
self.client = client
@commands.hybrid_command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def hello(self, ctx):
await ctx.reply(f"Hello {ctx.author.mention}")
async def setup(client):
await client.add_cog(Test(client))
as for this, ignore @commands.hybrid_command() and simply do @commands.command() and make the function with self,ctx and do what you'd normally do
make sure to have a setup though where you're doing client.add_cog() to register your cog
I'm just gonna stick to what I'm doing, that's over the top
I don't feel like putting in that much effort
it's not hard to do the way I'm doing it
quick tip, the more effort u put now, the less trouble u have later on
especially for handlers (cmd, error, permission, etc)
more effort you put now, better programmer you become
that from someone who rewrote the bot 4 times
so trust me, dont leave it for later
the future me hates when I don't ask the past me for advices

the future me hates me when I disregard what i planned on doing to do something arguably worse
Is there a way to download an image from a github using code?
no ty
@harsh nova bonk
no advertising
ty
sounds a lil sketchy “organic growth”
From what of GitHub? Repository source? Comments? Banners?
I'm trying to get a bae64 url of some images in a github repo
wait, can't I just clone the repo?
x)
If you know the path of where the file(s) are in the repository, you can download them from https://raw.gitbubusercontent.com/:owner name/:repository name/:branch name/:path to file
yeah but it didn't work in my code ;-;
And yes you can just clone the repository if you want, though if you only care about its contents and not history then you can clone with a depth of 1
@earnest phoenix got intellisense for event names to work by just overriding it for the client specifically like this, idk if its still needed to do it to the event emitter as well but ye
what would happen if you do git clone with depth of 0? o.O
fuck around and find out /s
Depth 1 is the minimum, the only commit in the history will be the latest commit
Shouldn’t intellisense on event names work with interfaces?
That's good
wym
Should I still mess with the event emitter itself?
seems pointless if im overriding directly in the client class
You don't need to
I’ll send an example when I get to my pc in a minute
ok
Honestly my biggest worry is going to be interconnecting everything
like attaching channels to guilds, messages to channels, etc
without causing a performance hit
are you making your own discord library?
Yessir
so far so good
just stressful
a lot more to think about than I thought

sounds difficult but interesting, might give it a try later on aswell
be prepared to have a world of pain
tho if you're not making it for mass use and solely for your use only it shouldn't be too hard
a lot easier than
to increase performance i suppose
you dont gotta worry about adding support for everything
I on the other hand am making it for mass use
and trying to keep it at as light weight as possible
Coming to the public soon in 2025 /s
“When it’s done” is a statement that will never be true in the world of discord libraries
indeed
wxell
especially since every few months discord adds breaking changes
you get what I mean right

when you release it
I know
Fun with every major api update some endpoints change and or gets deprecated
when a major update introduces breaking changes 😱
when discord.js then breaks it even further 
My goal is to hopefully not have to release too many breaking changes
tho in the beginning a lot of that will be happening
So I do not recommend anyone using it even if its released for a few months 
just dont release v1.0.0 until you think everythings good
lol
TypeError [ReqResourceType]: The resource must be a string, Buffer or a valid file stream.
at GuildEmojiManager.create (C:\Users\Yarne\Desktop\Currentprojects\EmojiBot\node_modules\discord.js\src\managers\GuildEmojiManager.js:54:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ReqResourceType'
}
Anyone have a clue? I've tried feeding it a url to the image, an image, a buffer and a base64 data url but I always get this error.
client.on("ready", async () => {
let index = 1;
let image = `../sprites/${index}.png`;
let bitmap = fs.readFileSync(image);
let b64 = new Buffer.from(bitmap);
console.log(b64)
let guild = await client.guilds.fetch("1143239475573563402");
guild.emojis.create(b64, `fighter-${index}`);
});
I tried feeding it the bitmap, the buffer, the base 64 url
Is that really how you’re meant to load a Buffer? I don’t see why you need a new here
well even without it doesn't work
readFileSync should already be a buffer since you didn't specify encoding
well even using the bitmap gives the same error
base64 strings don't work either
I'm really confused
are you using the latest discord.js version? https://old.discordjs.dev/#/docs/discord.js/main/class/GuildEmojiManager?scrollTo=create
"discord.js": "^14.13.0"
shouldn't you provide an object with the options instead?
thats purpose of major updates
discord will eventually introduce breaking updates
try {
if (message.guild === null) return;
if (message.author.bot) return;
const embed = new EmbedBuilder()
.setColor('Red')
.setDescription(`*Hey a new message got deleted!* \n\n **Author:** ${message.author.tag} \n\n **Channel:** ${message.channel} \n\n **Message:** ${message.content || "*No message provided"}`)
if (message.attachments.size = 1) {
embed.setImage(`${message.attachments.first()?.url}`);
}
if (message.attachments.size > 1) {
embed.addFields({ name: `• Attachments`, value: `> ${message.attachments.join('')}`})
}
return send_log(message.guild.id, embed);
} catch (err) {
}
});```
why does it not work?
( for logs )
no errror message njothing
Because atleast reading this code, return send_log(message.guild.id, embed) is unknown to us, we'd need to also know what that function does.
Also adding console.log(err) in the catch (err) part will tell you the error assuming its from this block.
Always found funny how awful it is to deal with images in js
dw it gets worse /s
its not for me
whats wrong with it?
Idk, the whole buffer juggling is weird
Plus u need to instantiate an html element to be able to edit it (the image)
i frequently use JS Buffers and they're not that bad
Also while u have a bunch of useful stuff like css styles, it also misses some stupid basic features like shapes
Everything has to be done with paths
css is meant for styling
I mean editing the image
Fixed
logSchema.findOne({ Guild: guildId }, async (err, data) => {
if (!data || !data.Channel) return;
const LogChannel = client.channels.cache.get(data.Channel);
if (!LogChannel) return;
embed;
try {
LogChannel.send({ embeds: [embed] });
} catch(err) {
}
});
}```
you are hiding all the errors lol
you have to show the errors by logging them in the catch block
also, if(size = 1) is wrong there, it should be ===, not =
every C/C++ program when they segfault be like
Also you shouldn't have to do embed under the if logchannel; in that send code. It's already defined in the (guildId, embed) part
One message removed from a suspended account.
imagine being hugged
One message removed from a suspended account.
One message removed from a suspended account.
Source-level debug information and debuggers:
One message removed from a suspended account.
hell nah i aint opening gdb every time there is a segfault
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
No give me one second I'm preparing [
One message removed from a suspended account.
]
One message removed from a suspended account.
Absolutely not, you're great 
ill segfault you
dereference me 
One message removed from a suspended account.
Okay give me one second to compile with -O0 -g -fsanitize=address,undefined so my machine can self-heal, and to continue to dereference you repeatedly
so your machine constantly segfaults and restart itself 
Not if it can self-heal at a rapid rate 
but even then you'll still never be able to retrieve the value from null 
trolling successful
I don't want to retrieve the value, I simply want to repeatedly dereference null, for a special case 
One message removed from a suspended account.
Well I just want to ask and see if someone here had experience on building that kind of server
you don't have to do that, I can google by my self
technically, any if we're talking about minimums
ofc it'll feel like shit with low bandwidths or very weak cpus, but they'll work
if we're talking about recommended, then most baseline commercial VPSses will suffice as long as it's not some unknown service provider
as those usually use very cheap or refurbished parts for their servers
the only 2 important specs are bandwidth and cpu, everything else is irrelevant as ur just routing traffic
Error: Cannot find module '/home/runner/Assistant/index.js'
Require stack:
- /nix/store/qpnf0dafrfsbcwb4z7cphjm0dff0vl7l-prybar-nodejs-0.0.0-e0d9a52/prybar_assets/nodejs/module-context-hook.js
- /tmp/prybar-nodejs-186380334.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
plz help
Show your file structure
Yea idk if I wanna model a guild object anymore
the shit is massive and im sure most of it is not even useful but idk
nope all of it is useful

could you show me how you model these massive classes?
I'm quite interested
Its literally just me looking at discord.dev to see how the object is supposed to look like and making properties on the class for them
i was gonna make fun of you and show a screenshot saying discord.dev doesnt exist but its an actual domain and it redirects to docs
so i got played
can't make fun of me when I am making my own lib
ofc it exists
its probably a property that sometimes doesnt exist, and if it does, its nullable
I dont see how it would never exist on a guild member object
if someone doesn't have a nick just make it nullable
it makes it weird putting it into the lib
just copy discord.js 
BRO WHY IS IT LIKE THIS
dates are represented as strings and its also nullable and undefined
😭
ever heard of ISO 8601 timestamps
they're just following discord
could be from partial member objects
I mean sure
for example members that haven't passed the screening
thats the perks of making a discord lib
nope
man structuring this stuff is annoying but whatever
I now understand why discord.js has teams of contribs 😔
trying to connect a guild member to a guild object and vice versa
that's just because everyone who works on discord.js are fucking nerds on another level
nah, feel free to ask
he'd happy to help you
inb4 voice
thats what I dread
hey is there a way i can fetch all the guilds my bot is in? using the discord api
i cant seem to find any route
discord.com/api/v9/guilds i tried this route but got 404
is there a way i can check when my bot was added to the guild?
Try use client
it also runs off api
i found the api
ah
users/@me/guilds and send the bot token in auth
ah
btw is there rate limit to api calls?
like can i make 100 api calls in a second or is there like a bulk delete end point
like for guild leave
global ratelimit
which is ? 5 calls per 5 seconds?
nvm
its 50
kek
ty

ngl this bs is scam. I literally only made 2 api calls using promise and i get rate limited
global ratelimit is a generality, some endpoints have special ratelimits
such as changing your client's status
hmm, im using the delete endpoint
probably has a special ratelimit
@sharp geyser The solution is to use the raw API and only develop stuff that might be helpful
is there a bulk guild delete api
Huh
For example, don't abstract the API to be class based like djs or other libs and just use the raw lib and then instead, only export helpful stuff like Snowflake utilities or whatever
hm
I mean I could basically just serve raw api data without worrying about it too much
just make methods for interacting with the gateway/api
Though I don’t think that’s in part to what I want to achieve with this lib
might as well use tim's library
or CloudStorm for WS
cant find module 'colors'
What is "colors"?
thats what i m looking for
why did you add it?
lol
You can use hex codes in embeds
you dont need any module to add embed colors
ok thanks
Also it's so outdated bot
it fixed
how?
discord-buttons module 
if that code copied from some github bot?
If I remember correctly it was created for discord.js v12
Or something like that
Also a message when you go to the npm page of that module
do bots still reply with prefix?
Yes, but most of the code from v12 may be outdated and incompatible with the new api
k
but my bot isnt really replying uk
Then you have a bug somewhere in your code
As I wrote, most people will not be familiar with v12 because it is an outdated version that is probably a little over two years old
It's better to write from scratch on a newer version than to fix something that may fall apart after some time
kk thxx
The good old times of v12 
Yea but I am going for something else with my lib
I do think I’m going about it the wrong way though
bro is trying to be unique
it's a good project to learn a lot
probably
although i would argue most of it is annoyingly implementing every api method/gateway event discord supports
some of it is websockets/compression (maybe)/audio if you get to that but other than that
though probably a good lesson in object/class structure and organising everything/making stuff work/stick together in a sense
No one is trying to be unique here
Thats harder to do in a discord lib than it is making an actual bot
thats why i said that when i thought you tried to be unique 😭
not at all
bc theres not much room for being unique other than maybe faster or better resource usage
the only thing I want to do is make it an easy lib for beginners
with not as much resource usage as djs is which mind you is already a hard thing for someone like me
I'd be interested in seeing a ts framework that supports decorators for commands
I considered doing it but I'm too lazy
When do they start reviewing requests (around what time)?
There’s no set time
They do it whenever they feel like it
The only thing they have is a monthly quota (iirc)
Hello
One message removed from a suspended account.
One message removed from a suspended account.
import requests
import asyncio
from discord.ext import commands
import discord
import json
from bs4 import BeautifulSoup
class template11(commands.Cog, name="template11"):
def __init__(self, bot):
self.bot = bot
@commands.hybrid_command(name="server-status", description="Get the current server status.")
async def server_status(self, ctx):
try:
url = "https://www.growtopiagame.com/detail"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
# Retry multiple times in case of failures
max_retries = 5
for _ in range(max_retries):
response = requests.get(url, headers=headers)
if response.status_code == 200:
break
await asyncio.sleep(2) # Wait before retrying
if response.status_code != 200:
if hasattr(ctx, "interaction"):
await ctx.interaction.response.send_message("Failed to fetch server status.")
else:
await ctx.send("Failed to fetch server status.")
return
```
soup = BeautifulSoup(response.content, "html.parser")
data_script = soup.find("script", text=lambda text: "online_user" in text)
if data_script:
json_data = json.loads(data_script.text.split("{", 1)[1].rsplit("}", 1)[0])
online_users = json_data.get("online_user", "N/A")
# Construct the response embed
embed = discord.Embed(title="Growtopia Server Status", color=discord.Color.blue())
embed.add_field(name="Online Users", value=online_users)
if hasattr(ctx, "interaction"):
await ctx.interaction.response.send_message(embed=embed)
else:
await ctx.send(embed=embed)
else:
if hasattr(ctx, "interaction"):
await ctx.interaction.response.send_message("Online user data not found on the page.")
else:
await ctx.send("Online user data not found on the page.")
except Exception as e:
error_message = f"An error occurred: {str(e)}"
if hasattr(ctx, "interaction"):
await ctx.interaction.response.send_message(error_message)
else:
await ctx.send(error_message)
async def setup(bot):
await bot.add_cog(template11(bot))
Sorry for sending them 2 parts but my oc broke suddenly and I can't send them as .txt
Here's the error . Is it because of hybrid or because of the message type?
first thing you should be doing is deferring an interaction
it's possible the interaction expired because you didn't defer it
Ah
I reached this method after too much attemps
I me I used too much types and diff codes
I tried to play woth the code alot
Anyways thanks I'll check
also not to shill but @slim heart doesn't your lib have decorator support
yeah
renamed by ai
2 years since last commit
( @sharp geyser ) it’s just jadl now
jadl is the one with decorators
discord-rose still works but is dep
ah ic
Jadl?
how do i trigger an event on voting for my Server in JDA (java)?
@robust trellis
how can get the members has role after deleted
module.exports = {
name: Events.GuildRoleDelete,
/**
*
* @param {Role} role
* @param {Client} client
*/
async execute(role, client) {
await role.guild.members.fetch();
const membersWithRole = role.guild.members.cache.filter(member => member.roles.cache.has(role.id));
console.log(`Members with role ${role.name}:`);
membersWithRole.forEach(member => {
console.log(member.user.tag);
});
can use this thing ?!
discord.js v14
Check who had the role before the role got deleted?
Maybe look at the GuildMemberUpdate event
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
I mean use Events.GuildRoleDelete
You can't (I guess, never try it. On theory)
role.members
try it and look
My suggestion would be, that you use GuildMemberUpdate event, because when a role got removed from a user, then it will trigger the event.
Role delete when Role gets deleted from whole servers i recommend use guildmemberupdate
bruh i miss read everything but still use guildmemberupdate
Okay, but how can I tell if the role was changed by a person or because the role was deleted from the server?
just sync it up with the audit log
fetch the most recent audit logs, check if the action is related to roles (deleted roles, remove roles from a member) and check what roles were removed/deleted/added/whatever
^
What's a site like Pastebin but for code?
so the others dont matter? 🙄
yes, they don't.
bit upfront but okay
😊
One message removed from a suspended account.
One message removed from a suspended account.
Anyone knows why this conditional typing doesn't work?
filter: "id" | "name", character: typeof filter extends "id" ? number : Name
am I doing it wrong?
nvm fixed it
I was doing it wrong
bro has not seen gpt 4 or 3 for that matter
Nuero-Sama
do you guys think it would be better if i used unix timestamps instead?
if the DBMS already supports dates natively, dont think you need to
did anyone here ever setup ipv6 in proxmox on a hetzner system?
I did think about setting up a proxmox before, though ngl dont have the time and money for it
how to , another website in my website
"how to embed another website inside my site?"
use <iframe>
main site https, web http
what?
hmm,ty
Got a question, Im not being consistent with my coding projects, and stopped coding, and I remember around the time I stopped coding - around a year ago, there were some changes going on with git. I can't find, what I remember to be, git line? Am i mistaking this for something?
I'm pretty sure it does, specify http in the iframe link
Am I crazy? I thought there was a way to have an array or roles from slash command options.
Crazy? I was crazy once
No, pls stop
Good luck
🗿
rip your acc
if you disable for more than 14d it deletes your account fully and cannot be reversed
oh wait
did they change that?!?!
Guys how can do/learn vote checker system on my bot?
it used to be 14d/30d before deleted fully
Disabling your account doesn't do that
Deleting does it
i thought it used to tbh 
if discord disables it then it starts the 14d timer
but other than that i think its fine
Anyone able to help me figure out why my bot was declined? I'm new to Top.gg and am really unfamiliar with the process. I did some reading which said I should get something saying why it was declined but I don't see anything.
OH, it seems like it'll be in the #mod-logs. Lemme dig through there.
Yep, I figured it out. No worries 
Can someone ban him already?
Lol
Yea, he's using self bot to ghost ping you
I have an EntitySelectMenu that is retaining it's selection after editing the message. I'm wanting the values to be reset when the message is edited. I'm using the java JDA discord library. Any thoughts?
Why did people dislike my question and close it on stack overflow?
I have this code but it only works when put in the HTML file while it does not in the js file that the other js code works in.
const container = document.getElementById("scroll");
container.addEventListener("wheel", function (e) {
if (e.deltaY > 0) {
container.scrollLeft += 100;
e.preventDefault();
} else {
container.scrollLeft -= 100;
e.preventDefault();
}
});
The guy who closed it does not know what he is talking about because it works
SO is usually pretty toxic for questions that aren’t super complex
A decent amount of overconfident people trying to receive validation because they are insecure and have an inferiority complex tbh
Now my stackover flow is banned from questions for 2 days
which js file did you put it on?
when do you load the js file?
At the header with <script src="/script/script.js"></script>
put it at the end of body
👍
lmao
its 3 am, i need sleep
just finished giving a 3 hour class on js oop
i need ideas for an interesting "final project" to make my students do
some of them are geniuses
but its mostly first timers and newbies
so it cant be anything too complex
went through bind/call/apply today and i felt like some of them didnt quite get it
basically #development then

for those interested deleting the message and sending a new one does the trick 👍
He deleted his comment after this guy responded
ego go 📉
e go 📉
e o 📉
o 📉
If anyone here is using patreon-discord npm library, have you found a solution to expiring access token? Have you additionally used the official patreon API to refresh the token?
im having problem setting up my dns. Not sure what im doing wrong but my website isn't loading when I try go on it.
On my vps, it is showing the application has been running for 7hours - Its just a really simple personal website
not sure what im doing wrong, any ideas?
thats not the same as DNS
thats reverse dns
so if i was to go and look up your IP address, it would show your domain as the reverse DNS
(helps hosts set server names, etc)
if only we had 1.1.1.1 bot here 
@whole knot could we possibly get the cloudflare 1.1.1.1 bot here so its easier to help with DNS questions 🗿 https://developers.cloudflare.com/1.1.1.1/other-ways-to-use-1.1.1.1/dns-over-discord/
flashbacks to cybersecurity class setting up dns with windows server 2022
It was a pain
dns is always a pain tbh
@covert ingot you do not have any nameservers setup for your domain
You do need that
i would recommend using Cloudflare since they can handle SSL for you and proxy it for you
and its free
^
I will try cloudflare and let u know. thanks

They have a bot?
Probably a stupid question - but where do I change the nameserver? Using 123-reg for domain and GG for vps
on 123-reg it says invalid, probably doing it wrong let me look more
I think i done it - would you be able to double check for me if i done it correct
I’ll check now
thanks
i just restarted pm2 cuz thought that would fix it - still when i go on website doesnt load. maybe thats y it errored? not sure
Keep in mind that your DNS results are cached, so if your DNS did update and works fine on another device, it likely won't on your current one as the result is cached
Had that too
so uh how do i fix that
I'm getting this, gona try fix - if anyone knows what to do this is whats happening :
Consider looking into how to properly work with dns
As well as what cloudflare proxy is
patreon uses oauth2 for authentication, it's the same as any other oauth2
you authorize and then get an access token + refresh token
and the expiration ofc
save those 3 data to the database, whenever you reach the expiration date use the refresh token to request another token
also mind you, patreon is terrible to work with, idk how abstracted that lib is but expect a lot of headache
Conceptually yes, but Patreon API is documented quite poorly, and the only way for oauth i found to work is for pledged members, not for the patreon creator
It's unlikely your VPS right now
It's your DNS setup
That is why I'm telling to look into what DNS is and what cloudflares proxy is
they put 10 parts with the same name in the payload and let you figure out which one is the field you want
The /token endpoint which returns access and refresh token only works if code parameter is provided, and as far as I understood i can only get it from a logged in pledge member
yes, but once you have the refresh token you can use it directly (to refresh the access token)
would you be able to tell me whats wrong iwth my dns set up? I have no clue atm
Disable your proxy, and see what error you get when visiting your website
Aight, I will try to initially get the refresh token from the developer portal and then work with that, thanks a lot 👍
yw
same
Or do you not get cloudflare anymore
Ctrl+f5
nothing changes
Then you're still using cloudflare proxy, make sure you've saved your changes on your dns
wait i turned them back on, 2 secs
changed from london to manchester
only difference error code still same
I can use any port, or does it have to be a designated port btw
maybe thats y?
It has to be 80 if you're planning on using cloudflare
That is why I said to look into what cloudflare proxy is
i've been looking into it - still can't find fix. changed port to 80
Can't help you then
there was another account that posted that exact same text, or was it also you?
smells fishy
@rustic nova that guy again
Seems legit 
@crude orchid please avoid posting recruitment things anywhere on the server
since I haven't properly warned you yet, consider yourself warned now
Sure
anyone uses hostinger?
Only for tutorials 
lmao are they that bad? I see the pricing is super low compared to other providers
and i see some positive reviews tho
It probably depends what you need. It's best to look at different hostings and choose the most suitable offer
And after checking, for example, vps hosting, it seems to me that $ 14 per month is quite a lot for the smallest package
Maybe it's worth the price in other aspects than just the number of cores and the amount of ram
from what i can see its $7.99 for 2vCPU and 8GB RAM $12.99/mo for 4vCPU 16GB RAM. Im looking for the catch as the prices are super low
compared to me paying 40$ a month for 4CPU 8GB RAM on vultr hosting
Not really
You pay $6 per month when you buy hosting for a whole year
If you want to pay monthly then you pay $14
$13 for me, for 4cpu and 16gb ram
which is alr so cheap
why so cheap whats the catch
ah its 13$ per month for 12 months
still cheap imo
hmm
183$ for a year, with that resources is still good
4cpu, 16gb ram, dedicated ip, 200gb ssd
pretty huge resources for low price. whats the catch here, hmm
no firewall ig or something idk
ig KVM and VM are different?
it looks like they spike CPU usage on purpose to get you to buy a better plan hmm, red fag 1
ye okay im seeing bad reviews now lol
check htop
unless you didnt buy one yet
just get contabo or hetzner
pretty trustworthy
didnt buy yet just checking some reviews. One review said they show high CPU usage (wrong info) and just kill your website to get your to upgrade with 403 itseems. sounds pretty bad
Why they hate hetzner so much 
why contab no have 4cpu 8gb ram
they start with 24gb ram
way too much for me
amd processors hjmm
Hetzner is awesome
tf hetzner why i gotta submit my ID Proof lmao
Fraud protection
wdym
Yeah, though Hetzner servers are crazy cheap for the specs they provide
ur looking at virtual dedis
well, it's the whole server for u exclusively
yeah the whole machine right
thats what vultr offers too right?
dedicated cpu and ram
it's 3 phys cores btw, so 6 virtual cores
If you aren't gonna host something big or do something really resource-intensive on a dedi then it's a waste of money
I have 12gb of ram and I only host a bot on discord 
gotcha, i always thought dedicated VMS are meant to be exclusive for you, and cloud vps is shared right? so if someone else is compromised my appl is also at risk?
It's just a waste of money but at least bot is working
The first part is correct, the last isn't
It's "shared" as in the resources and stuff are, if someone else does a fuck up in an instance of a shared VPS, that doesn't really affect you, unless they literally compromise the entire server running all the instances of those shared VPSs
Not exactly. Shared hosting probably only applies to resources, so let's say 3 people use one processor. There is probably no way that by accessing one account you could endanger others using the same machine
yeah so like if the resources are shared, chances are my app will be slow cause the cpu is being used by someone else no? even with cloud vps i mean
not talking about shared hosting
talking about cloud vps and dedicated vps
that used to be a problem with contabo, but they changed their policies and infra to tackle at that issue
dedis are only worth if you're hosting something that'd demand a ton of resources from the server, like gaming (dedi host) or remote rendering
or some very big project
hmm i see
so vultr is cheaper in that way or used to be, cause they offer dedicated vcpu
honestly, "dedicated vcpu" is ironic
cuz like, if ur buying a dedi you'd technically own the phys cpu
I mean, own in the sense of rent cuz u cant really take it from them
but anyway
yeah alr
yeah, got this for 50€ https://fs.rjns.de/v/VeftSNcwohtQZcMMoM
just wanna make sure i get efficient resources when i use cloud vps
iirc the formula is (threads * cores) * phys cpu = vcpu
I would also recommend Datix
Datalix
2023 Sale Server from 1.95 € from 1 core, 4 GB ram, 25 GB CEPH memory, 1000 Mbit connection in Frankfurt am Main
They are good, that's true
14 days from contract date
yep, they are definitely good for small kvms, just dont get a dedi there, very overpriced
2.6TB a month, outbound traffic
Yeah
That's awesome, also Proxmox ASCII art cool af
Hetzner gives 32tb ☠️
for 12 months yeah
It won’t matter unless you run a popular site with like lotsssss or traffic
yeah
afaik hetzner doesnt count incoming too
Guys
Their dedi limit is like 250tb/month
❌ choose a distro based on performance/ease of use
✅ choose a distro based on ascii art
dafuq

I created own bot but it's getting saying unmodified of some kind bot
Wht do I do now
so what do you not like about the network?
Slow
did u start from some template?
Also the servers are kinda slow
It struggled to even handle a basic Mongodb install
AMD processers yeah
Speed really does not matter that much
Even 100mbps is good
never had issues with them, at least not after the infra change
Unless you’re Amazon who lose hundreds of millions a year if it takes more than 2s to load a page, I wouldn’t worry about network speed that much
Ye bro
dont want it to be too slow
that's the reason
I would just get an Ashburn server from Hetzner
Wht I will do now bro , I wanna grow my bot :/
tbh should be fine ig, i see that my vultr network speed is not more than 5mbps
Ashburn gets 15ms ish ping to discord
you need to modify at least 51% to be considered not a copy (since the revs dont know the underlying code, consider this as "51% unique commands")
does contab not offer like a free trial
Nope
would like to try it before i buy hmm
Most hosts don’t
50 new cmds?
Due to abuse
percent
Like new commands tht he don't have?
if the bot has 4 commands, u need at least 3 (as u cant have 2.04) new commands
big hosts like giving trials
well, then yeah, a bunch of commands
Now what I do
Yeah
:/
the easier and most sustainable choice would be to simply write your own bot
instead of starting from an existing project
Plus bigger hosts can live with the cost off abusers
Since they have large clients spending $$$$$$$
Timmy’s lil host can’t afford to lose the cost of servers compared to a large host
I was shocked when I found out hetzner sent me an invocie 1 day after I already had full access to the dedi without even asking for id
GCP (Google Cloud Platform) is also pretty good
any host that doesn't start with "Ora" and ends with "cle" is pretty good 
Plus their startup program also got me intercom for a year free for 10 agents
Which is worth like £7000 or smth stupid
and I also got Zendesk too
1 year for the full package with unlimited agents iirc
https://fs.rjns.de/v/DIaZkGqwYiiKJCQigz best vscode font btw
I'm not sure if other VPS providers do this but GCP shuts down your server and changes your server's IP address if it goes into maximum load and stays like that, no static IP address assigned so it can be annoying for teams that work on the same server via SSH
computercraft be like
Looks like a minecraft font 
I think you can solve that by assigning a static ip separately
Kinda like DigitalOcean, you can basically pay for the IP and add it to any server
Hmm yeah, though never saw that behavior in any other VPS provider






