#development
1 messages · Page 768 of 1
yeh i cba with that XD
but code blocks are for code highlighting, i doubt you'll get anything good out of that
what about if i tried like
okay that should be fine then
see how you done the css
any way to change the colour of that?
infact
nvm
all markdown rules except image refs, headers and tables apply
yup
when trying to intall the fivem api
i get an error
Package mem
Patched in >=4.0.0
Dependency of fivem-api
Path fivem-api > npm > libnpx > yargs > os-locale > mem
More info https://npmjs.com/advisories/1084 ```
thats never happened to me, guess you could try get a different version or just try ping the server and if you dont get a response then you know its offline
that's npm reporting a vulnerability in the package
yeh is that bad @late hill
The full log should contain suggestions on what you can do
yeh its okay ill figure another way
any way to space my fields between each other i.e have a line inbetween in them?
\n doesnt work
it should
you can only use it in field values
not field names
if you mean a horizontal space, there isn't a consistent way to do it but you can try a blank field
since every client renders it differently
nah it literally says embeds fields cannot be empty xD
you can fake blank fields by adding a zero width space as the field name and value
what about .addBlankField()
that does exactly that
d.js ends up doing a lot of things for the end user because frankly a lot of the userbase is, well, stupid
lmao yeah
i mean blankfield worked xD
@quartz kindle , do you know how to do a server status request?
what do you mean?
you mean to check if the discord servers are online?
they are online if you can connect, else they are offline
Maybe just Guild#available in discord.js
fivem
You should probably ask how to get the status of a fivem server on the fivem discord
nvm
anyone here for a python 3 question not currently related to my bot I will be making?
So I am getting a syntax error on a conditional statement in the divide section of my code which is currently being used for a calculator in Python 3.
while True:
print("Options:")
print("Enter 'add' to add two numbers")
print("Enter 'subtract' to subtract two numbers")
print("Enter 'multiply' to multiply two numbers")
print("Enter 'divide' to divide two numbers")
print("Enter 'quit' to end the program: ")
user_input = input(": ")
if user_input == "quit":
break
elif user_input == "add":
print('add')
num1 = float(input("Enter a number: "))
num2 = float(input("Enter another number: "))
result = str(num1 + num2)
print("The answer is " + result)
elif user_input == "subtract":
print('subtract')
num1 = float(input("Enter a number: "))
num2 = float(input("Enter another number: "))
result = str(num1 - num2)
print("The answer is " + result)
elif user_input == "multiply":
print('multiply')
num1 = float(input("Enter a number: "))
num2 = float(input("Enter another number: "))
result = str(num1 * num2)
print("The answer is " + result)
elif user_input == "divide":
print('divide')
num1 = float(input("Enter a number: "))
num2 = float(input("Enter another number: "))
while num2 == 0:
{
print("Number to be divided by 0. This is invalid.")
num2 = float(input("Enter another number: "))
}
result = str(num1 / num2)
print("The answer is " + result)
else:
print("Unknown input")
and of course I get it to work once I take a break from it
lol
Can someone tell me why this is an empty message? https://gyazo.com/8ef021d87ed8925a9e74c8f3a71cc5ef
I had forgot my : initially then thinking it was a {} tried that then figured out I was missing the : and then couldn't figure out why it wouldn't work until now
currentWeather is https://gyazo.com/199d698527ce0e6170671992a221ee82
ik imma feel stupid when someone sees the problem immediently
where is the description?
What?
They aren't in your currentWeather
I'm pulling from currentWeather
currentWeather isnt my embed
let currentWeather = data.currently
console.log(currentWeather)
let embed = new Discord.RichEmbed()
.setTitle(`Weather for ${args[0]}`)
.setDescription(`This is the current weather for ${args[0]}!`)
.addField('General', currentWeather.icon, false)
.addField('Summary', currentWeather.summary, true)
.addField('Tempature', currentWeather.tempature, false)
.addField('How it feels', currentWeather.apparentTempature, true)
.addField('Wind Speed', currentWeather.windSpeed, false)
.addField('Wind Gust Speed', currentWeather.windGust, true)
.addField('Precipication Percent', currentWeather.precipProbability)
.addField('Precipitation Intesntity', currentWeather.precipIntensity);
.addField('Tempature', currentWeather.tempature, false)
.addField('How it feels', currentWeather.apparentTempature, true)
are these displaying correctly?
nothing is displaying
at item.request.gen.end (C:\Users\Aj Stoner\Desktop\Coding\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
at then (C:\Users\Aj Stoner\Desktop\Coding\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)```
Oh wait i've had this problem before I think
well can you show us where you sent the message in your code
let currentWeather = data.currently
console.log(currentWeather)
let embed = new Discord.RichEmbed()
.setTitle(`Weather for ${args[0]}`)
.setDescription(`This is the current weather for ${args[0]}!`)
.addField('General', currentWeather.icon, false)
.addField('Summary', currentWeather.summary, true)
.addField('Tempature', currentWeather.tempature, false)
.addField('How it feels', currentWeather.apparentTempature, true)
.addField('Wind Speed', currentWeather.windSpeed, false)
.addField('Wind Gust Speed', currentWeather.windGust, true)
.addField('Precipication Percent', currentWeather.precipProbability,false)
.addField('Precipitation Intensity', currentWeather.precipIntensity, false);
message.channel.send(embed)
are you sure it's coming from that part of your code?
Wait nvm
lol
I always get the problem cuz I use message.channel.send(embed) rather than message.channel.send({embed})
I mean
why would you get an error for doing that
I never add {} and never get an error
I don't know, it just happens :/
I had that problem before too
Most of mine don't need them but some do :/

You don't need to do {embed} (maybe depends on version)
tell that to my errors
I doubt, but was it fixed by replacing it with {embed}?
pfft found the problem
I was requiring Discord.js rather than discord.js
wait no that wasnt the problem that was just a problem I think
Welp I have a weather command now
I mean if you were importing the wrong package then the error you got wouldn't even be there 
Uhhhhhh
Good job you fucking broke reality
@coral trellis Not sure if this is something that interests you
yay
what
my 31gb log download is finally done
looks like they started to throttle my spidering during the night, but got it all
now just have to feed it all into my bot's learning system, thats going to take days
b r u h
what? 😛
yeah, but patience... its a dedicated server and it'd get it all eventually 😄
im now up to 2.2 million facts in sporks, doubled its database over the past 2 days with just 5% of whats in that new dump
i may even have to rethink how i store it all
Use Jsons 😂
whats the best to get images from subreddit? im using snootstorm but its trash
any recommendations? js
reddit api
currently i use node-fetch and the reddit api
how to make the bot create an invite link never expire from a server that the cmd did run in
#memes-and-media for other languages
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.
SMH
@prisma lion have u found it yet?
w3ll
?
@sage bobcat not actually.
One message removed from a suspended account.
i dont think so its mini modding to get pppl into right channel
One message removed from a suspended account.
so?
One message removed from a suspended account.
i did put this name like 3 years ago so, i didnt change it (i did i mean i keep some other name whole but then put back
You can name yourself whatever you want
except if it is racist, homophobic, other negative crap
Use the widget.
how would I get it tho?
Press on the edit button and scroll down, there should be a widget source below if I remember correctly.
how to send a msg to every server that the bot is in and have a channel with a specific name (to send the msg in)
at the end i want to send a msg to every server by "specific" channel name
Api abuse?
Sounds like API abuse, but just filter every channel by its name and send
that's against tos i think
depends
Depends if you have a time and limiter or requests
well i just gonna make it for a partner bot
I use a system that sends like feeds from crunchyroll and we have a dynamic system to make sure we don't go past the rate limit
I use a system that sends like feeds from crunchyroll and we have a dynamic system to make sure we don't go past the rate limit - CF8
Just have a list of guild IDs you iterate through and yh have a limiter
Also I meant live feeds not like feeds xD
Well yes but actually no
For sending messages it's around 5 message a sec across the whole of discord
So youre looking at 10Mins to send everything if you don't have anyone run any other commands and send any other messages
Cuz as soon as you get rate limited that cap get cut in half or more
Itterate through a list of Ids
Get ovjects
Send
Repeat
At I still wouldn't do 3/s
Like
1/s k
Yh that's about the max u can safely go
i guess this is what sharding is for
I'm not gonna spoonfeed you the code xD
I told you
Iterate through a list of channel ids
Get channel object
Send the thing
Repeat the loop
That's essentially what it is
How long the bots are approved on average?
2 weeks atm
Thanks
@prisma lion don't forget to add a 1 second sleep in your loop if you want to send 1 message per second
well
ill make it random
i mean btw 1 & 2
xD
@modest maple there is a problem when the bot HOST (shutdown) , ill lose the data and im using firebase to do some stuff
but fb doesn't use arrays (not compatible) when updating data
@modest maple still?
?
Hello can someone help me with the heroku host? it's nothing to complicate at least I imagine that it's a pretty stupid thing that I'm going to ask?
ow okay
Can I Nest Message collectors? d.js
@small prairie wdym nest message collectors?
Like one message collector for yes and no then i ask another question and start a collector
uh
Or in one collector can i get two inputs?
u can't get 2 inputs iirc
Okie lack of my knowledge thank You
it resolves when only 1 input is answered
ye
cool thank you
Guys i Need Add gif emoji in bot msg
And? Is there an issue in doing so?
Hi
yes
me too
so I need to create it with encoding @modest maple
link example?
which part of the stack overflow
the question or the comment?
oh
-*- coding: <name> -*-?
in the overflow?
open(fp, type, encoding)
in your open function do encoding='<encoding type>'
and its unicode so no
u need a unicode encoding
e.g
UTF-x
x is a number btw
what's the x stand for
UTF-8: Only uses one byte (8 bits) to encode English characters. It can use a sequence of bytes to encode other characters. UTF-8 is widely used in email systems and on the internet.
UTF-16: Uses two bytes (16 bits) to encode the most commonly used characters. If needed, the additional characters can be represented by a pair of 16-bit numbers.
UTF-32: Uses four bytes (32 bits) to encode the characters. It became apparent that as the Unicode standard grew, a 16-bit number is too small to represent all the characters. UTF-32 is capable of representing every Unicode character as one number.
it's able to store the entire character in binary without splitting it
Ignoring exception in command fish:
Traceback (most recent call last):
File "C:\Users\Lemon\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Lemon\Desktop\EconomyBot\cogs\generalcommands.py", line 121, in fish
log(ctx, f'caught 1 fish')
File "C:\Users\Lemon\Desktop\EconomyBot\cogs\generalcommands.py", line 568, in log
log = open("log{}.txt".format(rannumber), "a", 'UTF-8')
TypeError: an integer is required (got type str)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Lemon\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 863, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Lemon\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 728, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Lemon\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: an integer is required (got type str)```
type str
what
in your open function do
encoding='<encoding type>'
what letters is not able to display?
what
Python String replace() Method - Python string method replace() returns a copy of the string in which the occurrences of old have been replaced with new, optionally restricting the number of r
@modest maple it ain't formatting this
16:25:37 | console ['Traceback (most recent call last):\n', ' File "C:\\Users\\Lemon\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\discord\\ext\\commands\\core.py", line 79, in wrapped\n
\n
what do you want it formatted to?
to make it so that \n does newline
but it isn't doing that
it works when I have it in in the string
but if it's in the vars it says yeet
but it is in string form
logtxt = str(logtext)
log.write(f"\n{ct} | {ctx.author} {person} {logtxt}")
log.close()```

guys i need your help
Don't ask2ask
what
Dw
We are helping telepathically
Just think about your problem and we will fix it
@modest maple how does one use starred expressions
wdym
because they give me an error 99% of the time
logtxt = *logtext
^
SyntaxError: can't use starred expression here```
i'm trying to unpack a list
and it say no
it tells you how to do it properly
Stackoverflow is a good place to look for questions of what's broken
@earnest phoenix I'm bad at math, pls halp? var sec_num = parseInt(this, 10); var days = Math.floor(sec_num / 86400); var hours = Math.floor((sec_num - (days * 86400)) / 24; var minutes = Math.floor((sec_num - (hours * 3600)) / 60); var seconds = sec_num - (hours * 3600) - (minutes * 60);
I keep getting wildly different bullshit
ignore the syntax error
that's fixed
did someone tell you to do this on your own because there are very lightweight libraries out there that can do this for you
I wanted to do it on my own
oh ok
But my math is bad
why are you using a radix of 10
10 is the server tick?
????
have you tried parseInt without the 2nd parameter
your code looks correct for the most part
var sec_num = parseInt(this, 10);
var days = Math.floor(sec_num / 86400);
var hours = Math.floor((sec_num - (days * 86400)) / 24);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60);
if (days < 10) {days = "0"+days;}
if (hours < 10) {hours = "0"+hours;}
if (minutes < 10) {minutes = "0"+minutes;}
if (seconds < 10) {seconds = "0"+seconds;}
var time = days + " days, " + hours + " hours, " + minutes + " minutes, and " + seconds + " seconds";
return time;
}```
That's the whole function
the sec_num line?
yeah but dont remove the first param
I mean
It gets the days right
It's gotten time right before
It used to not do days
Everything worked fine
Then I went to add days once I had longer uptimes and I've had trouble ever since
also i dont understand why hours is using (days * 86400)
so you're still sure you don't want to use an npm package that does this for you
god damn that's a thicc function
I wanna do this myself
it can be way shorter
Good practice
who said it was good practice
...I did?
you know what never mind
also with the statement above, the thing youve been trying to do has been done before
you could just use a bunch of mod to find what you want
and there are much shorter solutions
I wanna do it myself though
give me a moment to read over your code one sec
Tryna actually get good at coding
the code looks exactly like yours
why the fuck you lyin
I'm not?
const s = (seconds) % 60;
unless mod does something different in js
no it looks like blatant copy paste except for the days variable
modulo doesnt change lmao
unary operators are supposed to do one thing
ok
I typed it out and started fucking with it
i mean in theory your code should work

no it should be right
because obviously if you have a duration > 86400 seconds math.floor should round it down to 1 and so on
@pliant needle define "weird numbers"
@pliant needle what you want to use is modulus also known as %
for example to get the seconds you can do
var seconds = sec_num % 60;
because it's 3 minutes and 0 seconds remaining
100 % 60 would be 40 seconds
because it's 1 minutes and 40 seconds
oh i see
I could also give an example how to do it for minutes, but that would be a bit too close to spoonfeeding
it is the remainder of 100/60 if you would only return whole numbers
100/60 would be 1 remainder 40
oh ok
it is a weird operator that has a few nice uses
Bro i want to setup bot in my server..will anyone tell how
You can select any bot you want on https://top.gg/ and click on the invite button
oh was he not talking about his own bot
No idea, but I just noticed this is the wrong channel
It's just set to the same color as the background. It's not really transparent.
It might be visible with a light theme
@empty owl you can find the branding colors here, which may contain the color you're looking for: https://discordapp.com/branding
thanks
wait
So creating a fisheye distortion of the logo is illegal?
bruh
Hello, I just voted for the mudae bot, but didn't get a vote reset. Now I don't know how exactly that works, but the support there says they can't do much about it. It seems you guys have more control over these kinds of exceptions, could you guys check that out?
it's happened twice to me now, basically what should happen is a reset of a timer caused by a vote. The vote happens (can't vote again) but nothing happens with the bot.
https://ghostbin.co/paste/7b44p
m.edit({embed: embed})
^
TypeError: Cannot read property 'edit' of undefined
Anyone have a solution?
is m defined in the code
yea
hm, can you show the whole file
bot.channels.get(object["channel"]).fetchMessages(object["message"]).then(m => {
})
its in a ready event
m is undefined then
how should i define it
maybe add a .catch block and see what logs in the console
@modest maple how does one use the epic discordbots api
like you would use any other
what
have you tried reading https://top.gg/api/docs
I saw that
every endpoint is doc'd
but that is not helpful
it is
only one mention of what I want to do
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)```
the docs are badly written but they explain all endpoints
what do you need to know that isn't clear?
that code snippet is just an example of how to receive votes.
logger.info will log the message that it received an upvote
https://top.gg/api/docs#webhooks
It is a JSON object with the data at the bottom of that page
where is the test button
I never checked it myself, but that is what the documentation says
You can print the data if you want to be sure what it is
Go to the page where you can edit your bot and at the bottom there is a test button
nice token
time to regen
time to reset that
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
print('TopGG Cog')
self.bot = bot
self.token = dbltoken
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
still doesn't work
GeneralCommands ErrorHandler OwnerCommands HelpCommand Main Loaded, with 1 shard(s) Version 2.2.0 TopGG Cog
Test button does nothing
I think there are also some problems with voting right now, so you might want to test it later
it could be your code, or it could be the site
is that a self, bot that I see
im pretty sure that was a joke
How can i get the content of an embed?
Like field,footer,author,title'content
d.js
@lyric hawk you didn't even activate the webhook
XD
i can get the message which has the embed
@cursive kiln hey
Regenerate your token
Token is your private data
- Iearn basic is before making a bot
- it's not asynic
It's async
There is alot wrong with that code for simple code
Yo take a few steps back and learn basic programming
?
He said learn is
Learn basics.
What baiscs?
Programming basics.
????
What's confusing you?
Whats programming
@coral trellis I can't tell if troll or not.
!help
@cursive kiln I suggest you go onto google and learn a little about the subject and research about what you wanna create
Im not from english sorry
Ah alright.
Don’t mention me plz & thx
That makes a little more sense.
I ask you later when i learn
Anyone else?
No just he or she
I am asking if anyone else got the dm
I dont know
WARNING:discord.gateway:Heartbeat blocked for more than 130 seconds.
why is this error coming?
Your getting rate limited maybe
for j in search(query, tld="co.in", num=1, stop=1, pause=2):
await ctx.send(j)```
for this one i think
u know any alternatives to it?
I'd bet it's blocking
i mean doesnt google change it every now and then
Find an async version or use run_in_executor provided by asyncio
async with session.get(my_url) as resp:
if resp.status != 200:
return await channel.send('Could not download file...')
data = io.BytesIO(await resp.read())
await channel.send(file=discord.File(data, 'cool_image.png'))```
will do ig?
Looks good
@coral trellis how can i do so it says how many servers my bot is in? (its coded in python)
On your bot page?
yea
I suggest you read this https://top.gg/api/docs#pylib
You actually sent a post request
To actually send the server count
Also you have a async function to print some text 
what do i have to change? (btw i copied the code from the Official API Site)
It's cause that only sets you up with the DBL api
You need to actually post the count.
how?
Oh I didn't see the autopost
Did you wait 30minutes
showa
Does anyone have issues with the ccleaner popup telling me that its out of date causing script issues with bots?
oh thats why @glad charm sorry ;D will report back
;p
@glad charm Bro nah
there's no need to wait 30 minutes if they restart the bot :^)

You could use the manual way to post to quickly see.
But I assume it waits 30minutes upon startup.
How are you loading that class
Are you doing client.add_cog anywhere in your code
Because all you really are doing is making TopGG class and leaving it be
nope not doing that oops.... where do i put that?
eh... after creating all your commands I'd say
so right before the BOT token?
okay, I have no right to tell you what to do, but this is a suggestion, I suggest you should make a JSON file for the bot config
how do i get that to work? lol xd
k
@obtuse wind Good idea if handled properly
are you programming a discord bot with javascript?
welp, the "if handled properly" option goes out of the window
nope. python
that's python
python is kind of the same
just go into the bot folder
make a file called "botconfig" or <whatevername>.json
and then in there
{
"token":"your token here",
"prefix":"what ever prefix you use"
}
and remove that from the main file?'
and then, in your bot file just add a line some where "const cofig = require(`./<name of file>.json`)"
pretty much its simple
then you go to your token area, and put config.token
Working with JSON files in Python is different
let's not cause even more confusion
oh well
I guess python is different
also
WHICH SON OF A BITCH
""
had a bot message me those
Just when I thought headache could go away
i know but.....
Over the last 5-10 years, the JSON format has been one of, if not the most, popular ways to serialize data. Especially in the web development world, you'll likely encounter JSON through one of the many REST APIs, application configuration, or even simple data storage. Given i...
Read the Reading JSON from a File part
thx bro
Basically what you would do is before declaring any variables and after importing anything, you open your .json file and save its stuff under different variables
one of them being the top.gg token which you use in DBLClient
Read stuff on JSON syntax
k
soryr if this message is incoherent, and this isnt necessarily discord bot development, but im writing something in python and i was just having trouble getting this function to work the way i wanted and figured one of y'all could help me??? i want my program to take two different inputs, and alternate between them to get one combined string. i made a diagram of what i want it to do, as well as what my code is right now, which gives me an output of "cHhAaDd" thanks !!!
the two print statements are just so i could see where it was going wrong lol
are you getting any errors?
It's not an error
if this is the wrong channel to put this in im really sorry
It's just what's left is replacing duplicate text
My first advise is switch to python 3 rather than Python 2 as it has some handy functions that will help you that python 2 doesnt
oh okay!
as for mashing up the text just have a toggle var
And switch between one input and the other
To make the string
okay thank you!
One message removed from a suspended account.
^
'^' why everyone do that (including me), whats the point?

why do you care about someone's pfp
^
How do I find member Jasper#0005 with search string jas, jasper, member id or 0005?
if the user is cached, you can loop over the cached users and match by username
if the user is not cached, then its not possible
Well if you have their id, use that. Otherwise all of those other things arent unique and could return the wrong thing or nothing at all if, as tim said, they aren't cached
if you know the guild the user is in, you can try using fetchMembers()
are you using discord.js?
You could also cache all members on start but, uh that's bad
Yes I am
But what do I do when I have all the members?
You can use .find if you just have their username
It will return the first element to pass the filter
@lean tinsel omg why are you even using JS syntax in python omg
someone send me the code
do you have the right code or ?
if you knew python syntax then you wouldn't have donde that bc you'd automatically recognize that isn't python
yea...
than?
then what
is that all?
not really
but there's no way of doing things
you gotta do everything your own way
msg guild members fetch (id)
@glacial mango
little bit late but anyways
and id get it by looping
xd
you can also go to https://google.com and search "how to read and parse json files in python"
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.
Is using 'with' in any language bad practice?
// For example
let obj = null;
with (Object)
{
obj = create({ });
}```
Using with is not recommended, and is forbidden in ECMAScript 5 strict mode. The recommended alternative is to assign the object whose properties you want to access to a temporary variable.
I have a question (discord.js) related I have a hackban command (allows users to be banned via ID) I have seen a few bots with this feature but my question is the command works and all but doesn't send the message to the channel after saying User was banned I have it set to send a message but it doesn't and provides no error
I have the normal ban command set up the same way (minus the banned via ID function) and all works including the message that says the user was banned
Sorry if I'm not explaining it the best.... just woke up and not really sure how to explain this
Example:
user.ban(7).then message.channel.send("Done")
send code
One sec
Here's the actual code
It doesn't send the message saying they were banned or the log and I have it set to do both
aight lemme see
Sorry I know it's not the cleanest setup I am working on making it look better to 😁
I have tried a few things and failed so I'm open to opinions 😁
but change those find('name', 'kddkns')
to a function
find(channel => channel.name === 'kddkns')
yeah
You should be getting a deprecation warning in the console using find like find('name', 'namehere')
^
Honestly the only thing I get is this (node:135) DeprecationWarning: Collection#find: pass a function instead
But I thought it was for something else since it doesn't really specify
Yeah that's the dep warning.
Alright well atleast I know what it means now 🤦🏻♂️
It specifies that a collection using the pass method wants a function.
Did passing a function fix it?
Ah okay so I need to change it to a fucntion and should fix that warning?
Gimme one sec I'll do that now
Yeah I did that it fixed the depreciation warning but didn't help with getting the bot to send the messages afterwards
Yes the ban works
Just doesnt do anything after that (IE: Logs, ect)
I have it set to send a message in a pre named mod logs channel
Aswell as a confirmation message in the channel the command was executed in but it doesn't do either
The bot has permissions to send messages into the channel?
Yes
Mhh, Odd.
Yeah I'm not sure
First command that has given me this issue
But I still learnt something new about the depreciation warning so thank you guys for the info on that 😁
Ohhh I got it 😁 I guess I didn't have the fucntion set up to find the channel properly 🤦🏻♂️ thank you for your help @warm marsh & @copper cradle
Sorry for the tag 😬
On the bright side I finally got rid of that depreciation warning 😂😂
No worries!
How do I remove the first 2 words from an array item?
import discord
import asyncio
@client.command()
async def translate(ctx , query):
await ctx.send('Translation:', translate.translate( query , 'en'))```
from an array item
^^meaning that's not what you meant or ..?
giving the following error Traceback (most recent call last): File "C:\Users\S Som\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped ret = await coro(*args, **kwargs) File "D:\Saved Pictures\bot.py", line 433, in translate result = translate.translate( query , 'en') AttributeError: 'Command' object has no attribute 'translate'
why so?
@vital lark I mean how to remove the first 2 words from the first array item? array[0]
use slice
Provide information about the item
You can also use the term element for items in an array
I mean if the array is
['case #1 this is the reason', 'case #2 this is the other reason']```
It removes `case #1`
Well as you've shown you already know how to get the element
So the only thing you need to figure out is how to remove the first 2 words of a string
Yes but that's the thing I don't know
TypeError: 'module' object is not callable```
Can't find anything on Google
lmao gives the followiing error
just saying
thats not how modules work in python
xD
you cant just assign A module to a var
from yandex_translate import YandexTranslate <--- Youre declaring this a module
import discord
import asyncio
@client.command()
async def translate(ctx , query):
await ctx.send('Translation:', translate.translate( query , 'en'))```
oh i got it thanks
@vital lark the case number could be anything so that won't work?
You could indeed hardcode it to remove a certain amount of characters
But that doesn't match your definition of removing "words"
^
A solution to that could be splitting the string on spaces which gets you an array of all words
Meaning all that's left is to remove the first 2 entries
There's possibly a more efficient way do this
Perhaps using a regex
¯_(ツ)_/¯
I would use Wesley's solution of splitting the string on spaces
There might be more efficient ways, but this is the easiest way
I don't know how to do that
cuz global vars are a thing
scope exists
a subrutine cant see vars outside itself unless its defined as global var
ah i see
@client.command()
async def translate(ctx , *, query):
await ctx.send('Translation:', translate( query , 'en'))```
tried it like this
says command is not callable
once again variable scope, secondly how are you calling the function
what is it supposed todo
What
you know if you do split on \n it removes the \n right?
yeah but I want to count the amount of \n
string.readlines()?


if you're splitting on \n then the amount would be len(content) - 1
but as shiv pointed out you could just do string.readlines and give it a limit
but would that limit it to the last 5
no?
you can set the range with readlines()
so the range would be -5:? (Or :-5)
I dont use that method much
meh lemme try one more thing
what would be easier is doing file.readlines()[<Total Length of list - the amount you want to take from the end>:]
I got another method working, I think
But now it completely resets when the list returns true
Lemme try to fix it hh
how do you activate the webhook
more of a #topgg-api question
Thanks CF and shiv. I kinda merged your two answers and got it working exactly how I wanted it to

>>> List = [2, 34, 5, 6, 7,3, 5]
>>> print(List[:5])
[2, 34, 5, 6, 7]
>>> print(List[5:])
[3, 5]
>>> print(List[len(List)-5:])
[5, 6, 7, 3, 5]
>>> print(List[len(List)-2:])
[3, 5]
>>> ```
python is goood
splicing hurts my brain
how
I don't see how the hell it makes sense
that is quite the complicated system xD
all the - does is flip the list so yh
yh
But yeah you know me
I try to make my code work in the most inefficient and annoying way possible
why do anything simple, thats what i always say xD

It's a great rule to live by and it ensures that no other dev wants to steal your code
^
my friend made an AI that learns by editing its own code file and restarting itself once its learnt somthing to apply the updated xD
its not pretty
but it works
xD
some_string.splitlines()
but I mean the rest of the code for it just checks if there is duplicate messages (from the same second)
in as usual, the most inefficient way possible
Duplicate lines?
Hey.
Anyone know how2 use the ternary operator in C#?
Doesn't really work with what I've done :/
double greatness = (greatness_calc > 100) ? 100 : ((greatness_calc < 0) ? 0 : greatness_calc);
What is greatness_calc
How exactly does it not work
If the greatness_calc is ex 100000 it returns 100000 in place of the expected 100.
Are you sure it could be because of the type you're giving to the variable
since that code snippet seems to be ok
Both double
Mind trying int?
aight.
2sec
Same result.
I'll ask it to my teacher tomorrow.
And another C# question.
Why use string.Format() in place of $""?
Also my last guess is to restart the bot or add an output somewhere to make sure the code is "up to date"
Nothing specifically wrong
I just want to know if it would work or not

I dont do much in js but I want it to still work better than the bad one I made before
I don't think I got the response from the http requests.
hecc
you got no response here either
Where are you importing fetch
Also afaik you can't use class like that
Just export an object with the functions as the body
ight
I thought it might have worked like that
I use python too much
much

I think it might be a little better?
you can have a class without a constructor
it just defaults to constructor() {}
you just need to fix your http requests
I said already I dont know js 
if you want to go for the object of functions, its easier to do like this js module.exports = { neko: function() { } anime: function() { } } or like this js function neko() { } function anime() { } module.exports = { neko,anime }
Thanks
using module.exports instead of exports.somename allows you to import it with any name, ie bla = require(yourfile); bla.neko()
as for your http request, node-fetch follows the same syntax as the fetch api present in browsers, and its syntax is a lttle bit weird
I want to eventually have others like searching
I dont know the syntax for either of them

from their docs: js fetch('https://api.github.com/users/github') .then(res => res.json()) .then(json => console.log(json));
fetch returns a promise containing a basic response, which in turn gives you the option to get the full response in another promise
Would instead of json, would .text work?
yes
Alright! Thanks
you can also use async/await syntax like this js let response = await fetch('https://api.github.com/users/github'); let json = await response.json();
or a chained promise one-liner js let json = await fetch('https://api.github.com/users/github').then(res => res.json())
response conversion/getting supports all of these:
chokes
tias
Try it and see
Meh fine
Yeet
I cant paste on mobile what's this fuckery
One message removed from a suspended account.
Sort of throwing this issue out here;
I seem to be having some sort of issue with my class that handles an SQL dB,
If I tell it to add data into the dB and then fetchall it gets all the data yet when fetching everything normally in its class function it returns nothing
looks okay, just make sure all the variables are properly scoped, right now they are all global, which is bad
And I have no idea why
Because connections and the cursor are both class vars
So in theory they shouldn't be seeing two different things
So I'm thinking maybe it's not committing the changes like it should or that it's something Todo with the class inheritance
I'm not sending code because it's long and it's late and this seems to be more of a logic issue for me and just wanna rant it iut
@west spoke i do
How could I made it to where JDA's log level is errors only? I kinda dont like the annoying debug messages that jda gives
nvm i forgot to config logback, am retarded
just re writ all my command handlers to implement per server prefixes
took a while but worth it
no
Is there now a limit to how often a bot can change its avatar?
yeah, so moose his bot might not be able to change the avatar often
Question: How does one change a bot's status from 'Playing' to 'Watching' Like Luca?
Second Question: Does anyone know if when discord.js will update to integrate custom statuses?
1: Read your library's documentation, it's usually described there
2: Reading custom statuses is no problem. Using the system is, however, not possible due to some API conflicts afaik
Most libs support 4 different status types: Playing, Streaming, Listening and Watching
How you use them depends on the library you use and will be described in the documentation
@blissful scaffold it's different on webhooks though (I think).
The ratelimit I meant as in changing the client user's avatar.
lmao memes
how do i get my bot unmuted
Probably give a mod your bot's id and explain to them.
