#development
1 messages ยท Page 1151 of 1
@lusty quest like this ?
const mongoose =require("mongoose");
const {Guild} =require('../models/guild');
module.exports = async (bot, guild) => {
const newGuild ={
guildID: guild.id,
guildName: guild.name
};
const merged =Object.assign({_id: mongoose.Types.ObjectId()},newGuild)
const createGuild = await new Guild(merged);
createGuild.save()
.then(result => console.log(result))
.catch(err => console.error(err));
console.log('I have joined a new server!');
};
SQLite is a database, so
@dreamy cedar looks good
@lusty quest
still the same problem
i dont get any server information in the database
frick then
@drifting wedge You want a remote db. Not local
MongoDB has a free db with Atlas
I can link a video for using MongoDB in C#. But the general principles may still apply
MongoDB is a NoSQL database type that works really well with C#. Learn how to perform CRUD operations, how to modify the schema of a document, and how to get just the data you need back.
This covers MongoDB 4, which is now ACID-compliant and is a direct competitor for major r...
i mean i have a ton of my stuff in json
iirc, the docs for mongo are really good
iirc, the docs for mongo are really good
@solemn latch Not for their compass client lol
compass is self explanatory isnt it?
@dreamy cedar did you get any error?
I was unable to specify data types that were supposed to be available in it
no
Docs has nothing about that issue
did you have a connection to your db?
yes
ah, i havent really used mongo for anything
other querys work?
only have compass because someone needed help
@faint prism some Mongodb clients doesnt allow all data types. as example mongoose doesnt allow bigint
i have just guildCreate
@faint prism some Mongodb clients doesnt allow all data types. as example mongoose doesnt allow bigint
@lusty quest what do you use?
sorry
i mean woo
not you
wrong ping
currently Atlas (was running my own Cluster before but switched bcs its cheaper)
i use MySQL and Prometheus
why a Time series DB?
so you log your Guildcount etc?
yeah, just bot stats
@lusty quest so any solution ?
hmm wanted to add influxdb to my bot but the docs are not that good and the querys are wired (atleast for me)
there is somewhere something that goes wrong
considering doing a poll command with graphing over time, was going to use a different tsdb for that.
add _id: mongoose.Types.ObjectId() to your object and remove the merged line
maybe this helps
ok ill try
does it work?
nope
im watching this vid
In this video, we create a level system that allows users to level up based on how many messages they send in the server.
Join here: https://discord.gg/4Fy88WN
If you have suggestions for future video topics, leave it in the comments below.
And yes I did get a new mic :D
#...
how would i apply mongo to it?
just like instead of users.json
use the db?
yeah
keep the object data in the db
works really well if your users.json is a collection or array of <user>
then if <user> has an Id, you can use that for the objectId i the mongodb
huh?!
whats the variable for the voice channel name ???
its called Astrobot
@oak sentinel this one
can anyone send me an example mongo comamnd?
just so i can see how it works?
mine is giving me tons of errors
What code do you got so far
if its a remote ip, dont send it
no
if its just like localhost it doesnt matter
do not send
i dont think it does
but i wont
just to be safe
@client.event
async def on_ready():
print("mongo yay")
@client.command
async def test1(ctx):
mango_url = ""
cluster = MongoClient(mango_url)
db = cluster["db1"]
collection = db["prefixes"]
ping_cm = {'command' = 1}
collection.insert_one(ping_cm)
await ctx.channel.send('worked')```
the first code is just so i see if it works
but its not wokring
mongodb has a free course
im getting like INDENTATION ERROR
well it loaded
dict values should be setted using :, like this: {'key': 'value'} not {'key' = 'value}
is there a easier db?
most databases are pretty simple
you just kinda have to accept that youll need to spent an hour learning it
where are you learning from?
youtube google
@solemn latch can you tell me whats the problem here
const mongoose =require("mongoose");
const {Guild} =require('../models/guild');
module.exports = async (bot, guild) => {
const newGuild ={
guildID: guild.id,
guildName: guild.name
};
const merged =Object.assign({_id: mongoose.Types.ObjectId()},newGuild)
const createGuild = await new Guild(merged);
createGuild.save()
.then(result => console.log(result))
.catch(err => console.error(err));
console.log('I have joined a new server!');
};
the parent directory
from pymongo import Connection
connection = Connection()
connection = Connection('localhost', 27017)
db = connection.testdb
collection = db.testcollection
for post in collection.find():
print post
this connects it
@earnest phoenix the parent of the current folder
p i n g f t w
add the mono thing?
๐ฆ
@earnest phoenix sorry can you say that normally, I didn't understand
anyone can help
with what
const mongoose =require("mongoose");
const {Guild} =require('../models/guild');
module.exports = async (bot, guild) => {
const newGuild ={
guildID: guild.id,
guildName: guild.name
};
const merged =Object.assign({_id: mongoose.Types.ObjectId()},newGuild)
const createGuild = await new Guild(merged);
createGuild.save()
.then(result => console.log(result))
.catch(err => console.error(err));
console.log('I have joined a new server!');
};
what's the problem
d.js?
?
discord.js?
yes
when your bot joins a guild, you need to be watching the guildCreate event
how i do that
I've enabled top-level await in my TypeScript application (as you can see, broker.connect() and broker.subscribe() seem to work fine), but the for-await-of loop seems to error out. How can I fix that, or is the feature working as intended?
somewhere in your main file
client.on('guildCreate', function(guild) {
// insert code that adds the guild to your database
});```
ty
ill try
@opaque eagle it's not an async function
Ok I guess I won't help if your gonna be a dick about it
ok
follow the rules please
typescript was compiling just fine, but webstorm (my editor) doesn't support it yet
Webstorm finds everything to be wrong
Told me my code was wrong because I used it elsewhere lol
that's super vague but cool
Hello
Does anyone know whats the problem..
["console", "command", "event"].forEach(x => require(`./handlers/${x}`)(bot))
^
TypeError: Cannot read property 'event' of undefined
at Object.<anonymous> (C:\Users\hajji\OneDrive\Desktop\Attitude\index.js:6:1)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47```
from pymongo import Connection
connection = Connection()
connection = Connection('localhost', 27017)
db = connection.testdb
collection = db.testcollection
for post in collection.find():
print post
@drifting wedge don't use pymongo. use motor instead
pymongo is blocking lib
is there a way to dynamically check how long my bot should wait to avoid hitting the ratelimit?
if you're using a discord library, the library does that for you already
if you're working directly with discord, check the x-ratelimit headers
?
im using d.js but my bot still ends up getting rate limited but only once in a blue moon when i announce an event or something to my server
oh and tim i implemented what you told me about reaction menus
wait i think i told u already
lmfao
idr
or just barely functioning
@slender thistle barely

so i suggest not using mongo db at all and use psql instead
@near ether is it an actual rate limit or only the rateLimit event?
@drifting wedge don't use pymongo. use motor instead
@wintry mountain well i got motor
I've used pymongo in my private bots and I wouldn't say it's blocking much
an actual rate limit - my bot is temp banned for an hour
like wtf do i do?
do you use the sharding manager?
yes
like wtf do i do?
@drifting wedge Try the code snippet you sent
do you have any code that does api requests across shards?
theres only one which loads emojis across all shards after every one has launched, but that one is pretty lightweight and has never gotten me rate limited before
async def test1(ctx):
mango_url = ""
cluster = MongoClient(mango_url)
db = cluster["db1"]
collection = db["prefixes"]
ping_cm = {'command': 1}
collection.insert_one(ping_cm)
await ctx.channel.send('worked')``` didnt work
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "test" is not found
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationFailure: bad auth Authentication failed., full error: {'ok': 0, 'errmsg': 'bad auth Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}
at least its talking to mongp
although that event only fires when discord.js prevents a rate limit, not when actual rate limits happen, but it can still help to see which commands/requests are hitting the api too much
will it give me a stack trace to the command? or do you mean the REST/HTTP get/post stuff
the rest stuff, including a path
from a performance standpoint, is it worth it to allow normal users to have a gif profile card? For example, I have the ring around their profile changing from grayish to greenish like money in a loop - just wanted another opinion on it, since it does use a good amount of cpu power
when you say path do you mean the route like /channels/27829378293/etc
yes
how do i know which command of mine is hitting the d.js limit?
most of them do the same stuff
@queen moss should be fine if the image is cached
It's not the djs limit
but if every time you need to generate a new image, because some data changes, like a xp bar or something, then maybe its too much
It's the discord rate limit
yeah it generates a coin count bar, so maybe it is a bit too much
I'd just make the card very customizable to make up for not supporting GIF pfp
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationFailure: bad auth Authentication failed., full error: {'ok': 0, 'errmsg': 'bad auth Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}``` wut does dis mean?
authentication failed apparently
true, I think ill make it for people at a certain level and donors if I ever do that
Most likely not
@near ether you need to find it yourself. you get for example the channel where a limit was hit, check that channel and see which commands were used in that channel
or is it the mango connect stuff?
Make sure you are passing correct credentials to connect to the database
mongo connecting
you can log commands and channels for example to find it easily
ahh gotcha, makes sense
wait
ty!
do i replace the password with my password?
whatever Atlas gave you as a password
LMAO
if it's not customizable
i am retard
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationFailure: bad auth Authentication failed., full error: {'ok': 0, 'errmsg': 'bad auth Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}
one last question, if d.js has its own ways to help stop my bot from getting rate limited (ie temp banned for an hour), how come it fails sometimes and my bot ends up getting rate limited anyways?
it cannot track rate limits across shards
they are not aware of each other's rate limits
you mention it only really happens when you announce new features.
what about opening those features up slowly to people?
my bot has nearly 0 discord api usage across shards which is why im a little confused as to why this is the case
you mention it only really happens when you announce new features.
what about opening those features up slowly to people?
thats a damn good idea!
also make sure you're not swallowing errors too much, for example dont do .catch(() => {}) and log something instead
wdym by swallow errors tim
catching errors and not logging them
so maybe there are errors happening and you dont know
i throw em into the cold void
its always a good idea to implement your own rate limiting or cooldowns
for example maximum amount of commands per channel per 5 seconds
i only rate limit my canvas commands
i ratelimit my ratelimits
i do have a per-person cooldown, also most my my reaction menu-heavy commands are limited to once every 20+ minutes
but yea a per-channel cooldown is a good idea
my canvas command are per server 
if you have a reaction menu that can be reacted by anyone, limit the amount of reactions it can accept per 5 seconds as well

oh lmao
damn honestly i didnt even think of that
there is no limit to how often you can react
imagine you have 20 people reacting at once

hey guys
is there a obligation writing form in englisch ?
yep
I guess so
I'm questioning making post_server_count return the posted stats in a dictionary to the developer (dblpy) ๐ค
5/20s
5 presence changes per 20 seconds
@slender thistle i pinged u to tell u that it finally worked
now my bot is connected to the website and i can do the dashboard stuff
thank u ^^
Ey you figured out the most part of it though, I just gave you the preferred way of accomplishing what you wanted ๐

How much is the limit to a auto-changing status.
but do it wisely, please. like around 30 secs per change
You see the section "TITEL"? Is here anyone a pro with fs? I dont want to load the name with fs, which is under the section:"NAME"
Anyone an idea how to get the information from TITEL and save it into an array?
that informetion is stored inside the file
there is no easy way to do it with fs, you'd need to know the structure of the file to be able to extract it from there
but there are many npm libs that can do that for you
for example https://www.npmjs.com/package/node-id3
ok, I got it, I thought I ask before I go and search for other libs
oh
thanks man
How to make a changing status (all playing) for discord.js ^12.2.0
How to read the docs
where is docs @restive willow
I believe you can find them on https://www.google.com
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
i searched no answer @restive willow
what is the variable for message author channel id ?
message.author.dmChannel gives you the channel
wdym @earnest phoenix
but it might not exist
if it doesnt exist you need to create it
await message.author.createDM()
message.member.voice.channel
message.member.voice.channel.id is for id ?
yes
k thx
wait what is the difference between:
message.member.voice.channel.id
and
message.member.voice.channelID
Tim I need your opinion, and possibly some help, what do youthink is better for caching prefixes, redis or an lru cache?
@midnight blaze if for some reason the voice channel is not cached or doesnt exist
@earnest phoenix i'd cache them in memory
if you have guilds cached, you can even attach it to the guild object
Just plain out no lru?
yeah
hm, alrighty.
I need something that works well due to the fact that it will be getting accessed a LOT
What does "lru" happen to be?
in-memory is the best way
least recently used
oh
you can make a quick lru thing yourself, but its not really needed
unless you're an optimization freak
prefixes are literally a couple bytes of ram lol
what's that?
<client>.user.setActivity('<activity>'); <--- does that work for discord.js 12.2.0
yes
yes
what's that?
@quartz kindle its like i dont know but there is a thing called fapi
and some people use it
<client>.user.setActivity('<activity>'); or client.user.setActivity('<activity>');
like image generation or website screenshots
um
<client> is your client
if <client> = client then both of them are correct
How to config ts compiler so it can handle async :^)
ok thank you
how do i add shards
I almost got triggered there because of a missing colon
how do i check for mentions in discord py?
im pretty sure it errored me
How to config ts compiler so it can handle async :^)
cOfF
but i can try again
how do i add shards
.a
Jaja dotpost
huh it worked this time. thank you!
Magic
yup
Hello I am having a problem with custom emojis in messages. They are spitting out like this and not showing the actual emoji. :outage: Only the bot owner can use these commands Im using discord.py
Is the bot in the same server as the emoji?
What are you using for the emoji? (what is your emoji string thing)
Why is my ts compiler giving me !async and not async
now i tried it a different way as it is the way that would work much better, but it gives me typerror can only concatenate str not list to str with this code: if message.content.startswith('*'): if message.content.startswith('*tip ' + message.mentions): await message.channel.send('BLAH')
im dumb sorry
Is the bot in the same server as the emoji?
What are you using for the emoji? (what is your emoji string thing)
@misty sigil Yes bot is in same server this is the string !outage
Ok
So, your custom emoji is isn't in the correct format
Do you mind sending the emoji here so I can make it the correct format?
Im trying to send it formatted correctly but discord says no
Can you send the emoji here?
With no ID?
So <:outage:> or :outage:
<:outage:ID>
@glossy elk how many servers ur bot in ?
u should add shard when ur bot in 1000+ servers
@misty sigil Thats what I have been trying
not the point
message.mentions is giving me a type error that it can concatenate only str and not a list
message.mentions returns a list then
still returns a list
in js we just message.mentions.users.first()
but im sure py is different
i'll give it a shot acc brb
Does anyone know a bot that can give Multiple roles to someone from a command?
[Not A Reaction role, A Command that gives the member roles]
now i tried it a different way as it is the way that would work much better, but it gives me typerror can only concatenate str not list to str with this code:
if message.content.startswith('*'): if message.content.startswith('*tip ' + message.mentions): await message.channel.send('BLAH')
There's a way to get around this @lone coyote
What exactly do you want to do?
ะะพะผะพะณะธัะต, ะบัะดะฐ ั ะฒะพะพะฑัะต ะฟะพะฟะฐะป? ะะฝะต ัััะปะบั ะบะธะฝัะปะธ ะธ ั ััั. ะฃ ะฒะฐั ััั ััััะบะธะน ะบะฐะฝะฐะป ะตััั?
i want my bot to check for * in an if statement, then if it starts with *, then check for *tip + a mention
ะขะพะปัะบะพ #memes-and-media
ะ ะตะบะพะผะตะฝะดัั ะฟะพัะธัะฐัั #502193464054644737 ั ัะฐะผะพะณะพ ะฝะฐัะฐะปะฐ, ะตัะปะธ ะฒะพะทะฝะธะบะปะธ ะบะฐะบะธะต-ัะพ ะฒะพะฟัะพัั
you can speak russian? nice. I can hardly read it, but can speak it much better, but anyway, back to my bot
i want my bot to check for * in an if statement, then if it starts with *, then check for *tip + a mention
@lone coyote Then something like this
if message.content.startswith('*'):
if message.content.startswith('*tip ') and message.mentions:
await message.channel.send('BLAH')
this would check if message started with *tip and included at least one mention
i would do that, but i want it to be explicitly *tip followed by at least one mention not *tip blah blah blah mention if possible
if message.content.startswith('*tip '):
if len(message.mentions) > 0:
await message.channel.send('BLAH')
there's also this option
I think you need to create a role reaction if you want the bot to assign more than one role @slate ravine
thats not true
Why
I don't think it can get any more explicit than that
!giveroles Role1 Role2
gives two roles
unless you go fuck-all and create a custom function if_message_starts_with_arg_and_has_mentions
or any number of roles
well maybe i should?
haha ill try
Could just slap a comment between both of those ifs also
what do you mean by that?
# message starts with prefix
if message.content.startswith('*tip '):
# message contains a mention
if len(message.mentions) > 0:
# everything passed, time to get working
await message.channel.send('BLAH')
i thought it would somehow change what the code would do so i was confused. Sorry about that
makes sense

thank you

how would i gok about creating a custom function? (I am seriously staring to think I have bitten off more than I can chew)
i think i know what you mean
but im not certain
Well
im sorry that I keep asking more and more questions, but I am truly grateful that you keep responding
def check_mentions_and_message(message: discord.Message):
# some of your other stuff here possibly
# etc etc
if message.content.startswith('*tip '):
if len(message.mentions) > 0:
return await message.channel.send('BLAH')
return None
@client.event
async def on_message(message: discord.Message):
result = check_mentions_and_message(message)
if result is None:
# message not sent
else:
# message was sent
Something like this basically
You can play around with it 
Hmm, you could also probably return a tuple with a custom response
Well, there's the option of going the regex way...
or calculating character positions manually
Do you want only one mention to be allowed?
Oh, do you think you could utilize d.py's commands extension?
if message[5] = @?
idk
one mention is ok
but more would be better i guess, buti am becoming a hassle i feel like
what do you mean by that?
im a big noob, and this is my biggest project
or at least it will be bu the end
*tip @mention catch this you poor noob
Where catch this you poor nob is the "reason" or some sort of a "message" to the mentioned person
because it is a crypto tipping bot
Oh oops, forgot about a number
haha no worries
Give me a second to try something
sure sure
*tip 999 @user9 thank you or *tip @user9 999 thank you?
number 2 if possible if thats what you are asking
Actually, do you think you would like to accept usernames and IDs as user input for the member?
use string indexes to get the mention
like string[5] must be @?
How do I delete a file using eval?
oh ok
Ping me
I'm thinking of suggesting you discord.py's commands extension
@commands.command()
async def tip(ctx, member: discord.Member, amount: int, reason: str):
await ctx.send("BLAH")```
i'll try that
so for example you get an array of words like ["*tip","<@user>","999","message","words","here"]
yes
then you can check if array[1] matches a valid id by using regex and extracting the numbers from it
We're kind of going two ways here and I don't want to confuse you anymore. I shall take my leave for now ๐
lol sorry
thank you for being so helpful
mongodb works with heroku?
nah Tim it's fine, I'm only suggesting the half-assed way because d.py's cmds extension simplifies most of the stuff
not if you host it on the Heroku machine
client.on('voiceStateUpdate', (oldState, newState) => {
})```
How can i get here the channel id for newState ?
newState should have a channel property, shouldn't it?
or just help out testing bots?
Both
how do i get it
sowwy
@earnest phoenix get your bot to 76 servers + submit passport/ID
hm ?
oldState and newState are VoiceState objects
VoiceState objects contain a channel property
How do I delete a file using eval?
so VoiceState.channel
There's a separate channelID property also
aka newState.channel
How do I delete a file using eval?
Like a file on your machine?
fs.unlink
Y tho
it doesnt work because at least in my version of discord py, it uses client.event() and it says it's missing some argument
@pure lion its for my ticket system
you can delete files using fs.unlink
ok
Is there any particular reason it's named that and not something like remove like os.remove in Python?
because thats how the linux function is called
Oh
@quartz kindle so require(fs).unlink("./helpall.js")?
windows also uses unlink actually
@earnest phoenix
Ok
your way works if you use unlinkSync
when i tried commands.command() it didnt work as my discord py vers uses client.event(), but changing commands.command to client.event made it say that it was missing an argument
Oh yeah
require("fs").unlinkSync("./helpall.js")
You'll have to do the following
from discord.ext import commands
# I suggest renaming this variable to `bot` to avoid any confusion in the future
client = commands.Bot(command_prefix="*")
# if you want to remove d.py's default help command
# client.remove_command("help")
@client.event
async def on_message(message):
# my stuff
await client.process_commands(message)
@client.command()
async def tip(...):
# ...
Since await client.process_commands(message) is responsible for actually making commands.Bot work with the commands
ok do i need to pip install discord.ext?
oh ok
Why is it when i run my bot on VSC the enmap settings save but once i deploy on heroku the settings disapear and reset to default
heroku doesn't update files realtime
oh
Tim big brain
new word of the day
ikr
you can read more here
Rails 5.2 introduced Active Storage as a way of managing attaching and saving files to Active Record models. This guide will cover how to use Active Storage on Heroku.
Thanks
so tim, how did you get so good about helping people with their random issues?
just a lot of time on stackoverflow/support communities?
being good at googling and getting the gist of the issues lul
๐ค
TypeError: event() missing 1 required positional argument: 'coro'
Send your full code please
hold on i may have fixed it
testing
didnt work so here is my code:
from discord.ext import commands
client = commands.Bot(command_prefix="*")
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('*'):
if message.content.startswith('*tip ') and message.mentions:
await client.process_commands('test')
@client.event()
async def tip(ctx, member: discord.Member, amount: float, reason: str):
await ctx.send("BLAH")
client.run('MY TOKEN')```
idk how to keep the syntactical highlighting
```py
```
just the part where you create a function tip
ok thanks
can i get an explanation why if you are in the mood?
still didnt work
this error now: File "C:\Users\Sam\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 312, in _run_event await coro(*args, **kwargs) File "c:/Users/Sam/Soycoin Bot.py", line 17, in on_message await client.process_commands('test') File "C:\Users\Sam\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 936, in process_commands if message.author.bot: AttributeError: 'str' object has no attribute 'author'
of course
basically what d.py does with the decorator is add it to some sort of dictionary that is used internally
What await client.process_commands(message) does is it gets the message content, creates a Context object for it, and then parses everything according to your command's function parameters (In tip, you have the parameters member, amount, reason which d.py will try to place correctly as well as convert if there's type annotations)
You are supposed to pass a message object to process_commands, not a string
exactly
i misunderstood the reason for it
it didnt error me, but didnt say BLAH
what input parameters should i try?
*tip 571120962138013708 0.1 test
oh wait
Change your on_message to
@client.event
async def on_message(message):
if message.author == client.user:
return
await client.process_commands(message)
fuck
ey nice
I suggest reading a bit on d.py commands extension on their official docs for more info

bye
hoo ping me
@pure lion
messages.fetch
no, messages.fetch
@glossy elk das v11
k
how 2 sort mongoose documents by -1 and then get the first docc?
(ik all the things except from sort and finding from that sort)
I'm making a custom embed bot and I've made the embed, but I'm wondering how I turn the command into variables to use
ive never used an embed bot.
what do you want the argument structure to look like?
message.channel.overwritePermissions(message.guild.id, {
SEND_MESSAGES: false
})```
Uncaught Promise Error: TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites.
so i want the command to read -embed '...' '...' '...' '...' and change whats in the ' to variables
error is self explanatory
second parameter isnt an object
use split, phil
how 2 sort mongoose documents by -1 and then get the first docc?
@Full Stack Dice#2213 -1?
like sort by value?
yeah
.sort()
sort() of?
hes talkign about mongo queries
like
find().sort(whatever your sorting by)
its not an array
h m
ooooooo ty
isnt .find a query
find().sort({timestamp: 1})
How can i check in discord js if 2 guild members aare in the same voice channel ?
as a sorta hypothetical, how would you test code that involves getting votes from people? would you only be able to test it once a day or is there something you can do?
find().sort({timestamp: 1})
tank
https://cdn.discordapp.com/attachments/714045415707770900/743572785586110555/unknown.png
using this code, how would i find out what is input after the command '-embed' and make it into a variable
@dusty onyx there is a test button for testing the vote webhook
oh nice
i can run a file python with js?
what
no
u talking about compiling python or smthing?
i mean, like:
//in js:
!runfile file.py
you can use child_process.exec
with or without runtime?
exec lets you run a command in your terminal, the same way you would run any other terminal command
oh, ok
await Bot.find().sort({ timestamp: 1 })[0].inviteLink
```dis gud?
yes probably
i dont think it returns an array but idk, try it
iโd use the gte key thingy cuz its just simpler imo
also
'https://ale-bot.xyz/bots?id=test'
```this is my url , i want to parse it and get the value of ID
but all im getting is id=test
ah
https://cdn.discordapp.com/attachments/714045415707770900/743572785586110555/unknown.png
using this code, how would i find out what is input after the command '-embed' and make it into a variable
might i need to parse?
How do i check if 2 guild members are on voice connected in the same channel ??
compare their voice channel id
do u just want it to return โtestโ, dice?
its going to be a dynamic url ting that queries if the param is there
i could substring 3
fuck it ill do that
u dont need to
if its id=t u want it to return t? if its id=gg u want it to return gg?
if so
yeah
its just req.params.id
show ur code
console.log(req.params)```
show the full endpoint
isnt that all thats necessary
no
how i can put a "watching" activity in py?
just remove any other things, so like just show
app.get(...., {
console.log(req.params)
})
nvm it works for some reason
Yo
can you use emojis in footers?
Where do I go to make recommendations on donatebot.io
nope, fits
Can I talk to someone high up?
wut
what
the github iirc
bruh
Thanks
how i can put a "watching" activity in py?
@earnest phoenixbot.change_presencemethod where you pass adiscord.Activityfor theactivitykwarg
the discord.Activity instance must be instantiated with name and type=discord.ActivityType.watching kwargs
Shortly speaking, you would get something as big as bot.change_presence(activity=discord.Activity(name="you", type=discord.ActivityType.watching))
hetzner
check pins
@thick gull didnt even know that was there thanks bud
i just have to say. Using OVH was a pain ^ (its in the "suggested services")
super good?
id go with some big name like google or digital ocean
am i stupid or what is it classed as on digital ocean
vps?
if(message.member.voice.channel.id !== chanel.channel.id){
return message.channel.send(`Trebuie sa va aflati pe acelasi canal de voice.`)
}```
is this good ?
user.user
what
wot
damn no offense but how are u a dev
and your github is called davidproscripter
i am new in node js
@earnest phoenix oof
and your github is called
davidproscripter
Peg
@earnest phoenix what is your main language then, if it is not node.js?
Hey all, if i did something like "blagg".substring(3), it should return "gg", right?
can i just say, lowkey proud of this https://img.rovi.me/UtWB0a6ZSc.png
@grizzled isle you could literally try this in your browser
@placid iron you should be! Very well done :3
Okay. Thanks for the phenomenal help.
@pure lion thank you my G 
open any decent browser. Press ctrl shift i. paste the code you showed us
Np g :D
ok and back to toradora! XD
I want to make my prefix command available only to me and those who have the "Manage Server" permission. I tried using || and &&
The code snippet for the permission?
specifically
if (message.author.id !== "my id" || message.member.hasPermission(`Manage Server`)
use && and the permission value is MANAGE_GUILD
But isn't && and
shouldn't there be ! before the member permission check?
doing things from memory
that code is for return, right?
that would mean if (message.author.id = false)
don't think so
I'll try it
why
logModel.findOneAndUpdate({ id: message.guild.id }, { $set: { log: 'canalID' } }, { new: true }).log
dont work?
if the author ISN'T you AND the person has no permission, return
if one of those condition is true, it won't return
use && or ||
&&, AND
-ask2ask
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
just
no errors, no issues. 
What is the issue tho
"Guys help! My bot is giving no errors!"
"Does it work?"
"Yes but I'm still sure there's a problem"
yeah, what isn't happening that should be happening or vice-versa
like i can saend code
and yeah send ur code too
Are you:
Connecting
Saving
that helps people
Bin
hastebin as usual
Use my bot
you have a bin bot?
aa!bin does stuff
Testing 1
how?
rip python
your mongo url is the full url including username and password right?
did you whitelist your ip address?
@torn ravine you wanna use || for what your saying. Youd wanna check if the author is your id OR if the member has Manage Server.
well they're using !== id right
issue fixed
I tried &&
but what I didn't realize was that I was using the commands on the incorrect bot
is aws good?
like as a db?
and id aws good as a host?
and how behind r u guys on apps?
and how behind r u guys on apps?
@drifting wedge bot approval?
dumb css question: how do i center a div vertically
yes
yes
@drifting wedge wrong channel to ask, but the last bot to be approved was submitted ~28 days ago
just passed 4 weeks queue time recently iirc
@sick cloud not a dumb question at all
lol
youve asked about pretty much every host ๐ค
youve asked about pretty much every host ๐ค
@solemn latch well i talked to my parents
and they said theyd be happy to pay for google or aws
that just breaks it
now its squished to one side of the page
i highly recommend digital ocean or galaxy gate
well which one of the 2? @solemn latch
digital ocean all the way
digital ocean is a bit more expensive but more well known
center it then
what
galaxygate is a smaller company but cheaper
now its squished to one side of the page
@sick cloud use this thing called mobrise
its really good
what
<div style="display:flex;justify-content:center;align-items:center;">
<div></div>
</div>```
yes but then you complain about not centering it horizontally
that code i just sent does that too i think
Hi, I have a question, im trying to send an image using a link that has no "format at the url", when I use the message.channel.send({file: [['URL']}) it sends a file but isnt an image, is there a way to change the file format when sending it?, hopefully my eng isnt that bad and you guys understand what im saying 
idk, just learn flexboxes and you will be happy ยฏ_(ใ)_/ยฏ
backend as in backend
stop suggesting i use a drag and drop shit thing when all i need is some css to style an existing, fully complete prototype
which one is better, aws or google?
@placid iron this is without nay other code, the container is the right length and all
but i want to centre it vertically
both are huge and massively used
for all server stuff
Code -> https://sourceb.in/af07c17ea3
Error -> https://sourceb.in/4ee78a2efc
The Code Is Supposed to play the music in the list called "edmpick" which is a random song picked out of the list "edmmusic"

they sell by the hour iirc rather than monthly
there is the free thing
flex center
google flexbox centering
@earnest phoenix i tried to say that
Can someone help me please w my code?
.container {
display: flex;
justify-content:center;
align-items:center;
}
.toCenter {
width: fit-content;
}```
i assume you get this from this http://howtocenterincss.com/#contentType=div&horizontal=center&vertical=middle&browser.IE=none
flexbox doesnt mix well with bootstrap
@ionic dawn try doing .send({files: ['url']}); instead
thats how im doing it
what's the url
that's not what you put in ur original message
ill check if I can render the link or somethin to get the actuall image
you're just doing 'file' rather than 'files'
just miss that S
yeh, but the file dnst have an extension
so discord dont load any image
just sends a raw file
do you know what the extension will be?
it needs to be a valid extension matching the file header
otherwise the rendering will fail
you can't present a jpg as a png
is anyone elseโs bots 401ing at some events
no
how can I use await in template literal
just me
Give me a stupid command idea
for whatever reason, my code always says Unknown Recipient with a valid recipient, and also gives me the same error i have in except for an invalid one. code is: @client.command() async def tip(ctx, member: discord.Member, amount: float, reason: str): try: await ctx.send(str(message.author) + " tipped " + str(member) + " " + str(amount) + " for " + reason) except discord.ext.commands.errors.BadArgument: await ctx.send("Unknown Recipient")
Can you even use ctx with client, don't you have to use Bot
Also I would advise looking up f strings
it worked before i tried to break it
i know about f strings, but i am not advanced enough to understand them too well. Ehh i guess i'll go do that
no?
Where does message come from then
https://discordhosting.com/ can yโall tell me if this is a trustworthy bot hosting service?
here's the full code:
from discord.ext import commands
client = commands.Bot(command_prefix="*")
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
await client.process_commands(message)
@client.command()
async def tip(ctx, member: discord.Member, amount: float, reason: str):
try:
await ctx.send(str(message.author) + " tipped " + str(member) + " " + str(amount) + " for " + reason)
except discord.ext.commands.errors.BadArgument:
await ctx.send("Unknown Recipient")
client.run('MY TOKEN')```
@lone coyote yeah you have to think about message.author still
so how would you recommend i do it? i am a big noob after all ๐

Where does message come from
You just use message but it's not created anywhere in that function
yes it is
No
async def on_message(message)
I'm talking about the tip function
What host is that? @solemn latch
ctx.author would work
oh ok
@lone coyote I think you should try to learn some more of the basics of python before venturing deeper into discord bots

14rovi, i agree with you, but i really do want to try this one bot
I mean, nothing is stopping you
it is a real place though
someone just buying from another company and reselling the servers for more money
or well. selling less resources for the same amount

probably buying 1 euro servers and reselling 10 of them for $1 each
Damn
well, the site errored and linked to fragbytehosting
Good marketing strategy lmao
Jfc
People visit the first link not knowing any context
You get what you pay for
can i except errors that occur through discord.py?
honestly, buying a nice vps with a few cores and a few gigs of ram.
probably could start up some containers and provide bot hosting for people who need small bot hosting.
sure
Your answer is in there I know
Okay so let me get this straight @solemn latch

