#development
1 messages ยท Page 1194 of 1
Nevermind, it's working now, just took some time to update
@slender thistle lol
use an http request library, or a command line http client, or an API testing software like Postman
you cannot send the authorization header directly in a browser without using code
"garbage"
bro when i was using requests this code worked perfectly
it's just that you are refusing to accept that your code is not working perfectly
it worked perfectly
How is it a module's fault though
Define "awful"
๐ค
or are you just not trying to accept that your code is wrong
@fluid basin so my link is good but must to be in the code using request library ?
my code isn't wrong
it worked with the requests library
well why are you asking for help then
if your code is correct
because async is trash
and i have to go through loops
just leep across the border
so you just came to say async is trash?
just to get a request
i came for help
Try using except Exception as e: and printing e instead of handling certain exceptions
but clearly no one can try it
i did that
there are no errors lol
- i know which errors i need to catch and not catch
as i said, it worked with requests
you're breaking rule 1 (indirectly saying you're a potato)
Handling AttributeError for int() told me the opposite
Do you still have the code with the requests library
Can you send it
what language are you using?
where must I post the request ? in init ?
why do I see different URLs in both code snippets
how can i add my bot?
is this even valid
f.read or something is probably what he means
Yeah. f.read()
this guy is literally explaining that "my code is perfect"
i don't care abt f.read()
token = f works fine
gonna press Alt + F4
ok
didn't ask
whitename

l$botinfo
whitename
shit sorry
>>> with open("test.txt") as file:
... token = file
...
>>> token
<_io.TextIOWrapper name='test.txt' mode='r' encoding='cp1251'>
>>> str(token)
"<_io.TextIOWrapper name='test.txt' mode='r' encoding='cp1251'>"
``` you should start caring
because if you need file content, you need to use .read
Are you saying I shouldn't point someone in the right direction?
yeah
do any of you have weird/cool libraries to share
yeah
read my status
hey bro that's weird
bye
why does it work for me?
cuz
you cared
SMH
code leave it
ok so would anyone know how to get the most significant bit of an int
code leave it yeah man
im master coder
ur guys aren't
clearly
ok so would anyone know how to get the most significant bit of an int
@knotty steeple huh???
either you're not sending me your up-to-date code or it doesn't actually work
ok so would anyone know how to get the most significant bit of an int
@knotty steeple shit I should know this, that was just covered in my class
and drop that attitude, both of you
@slender thistle uh what?
i sent u the working code
and the nonworking code
async is clearly the problem here
only if ppl knew how to use threads
"https://example.comname=test yo&year=2016&token=<_io.TextIOWrapper name='test.txt' mode='r' encoding='cp1251'>"
``` does this look like a valid URL to you
@knotty steeple I have a PDF that covers bitwise operations, and probably has what you need
aaaaaa
.....?????????
@knotty steeple manually iterate?
mien doesn't show that man
for some reason it got 1000+ downloads in a week
this site is quality
just btw
while number > 0, rightshift by 1?
hellooo
oh ok
Your code seems to be out of sync with the actual running script
then keep the last bit or something
where is the error right here ? it give me the responses [404]
@knotty steeple This might help
runs out of sync
@leaden lake request headers, not query parameters
does it not?
that's the issue with this entire thing,whoever thought of async
a mad man
I didn't mean that
how ? @slender thistle
bro my head that doesn't help
@knotty steeple The first bit is the most significant
I suggest you use Google, JeSuis
okay
im sorry for any attitude this async is retarded man
where is the error right here ? it give me the
responses [404]
@leaden lake why is there a:in the URL that isn't a valid query
Restart your code and see if you have any issues on your end with syncing your actual script with the code
@knotty steeple or the easy way, take log base 2 and round down
because line 117 doesn't contain a valid URL, which you must enter in order to properly send a request
well if yall need an api i have a certain repo i could shill :^)
rule 5
@earnest phoenix hey waft what do you think of my package
especially the docs page
the docs are beautiful
This website is powered by DOGE
????
lmao wut
@earnest phoenix nice little ad
?
i didnt post anything
what are you on about alhassan
we're talking about my package that he brought up
we're not advertising
just chatting
well if yall need an api i have a certain repo i could shill :^)
oh he thought i was ad'in for you
Selamleykรผm
???
i love when green names micromod
and they dont even know the context

but off topic
Sa
-notr
also in my package am I correct with naming all the thingys Functions instead of Methods
ฤฐngilizceden baลka dillerde sohbet etmek iรงin #memes-and-media kanalฤฑnฤฑ, top.gg hakkฤฑnda (Tรผrkรงe olarak da) destek almak iรงin #support kanalฤฑnฤฑ kullanฤฑn.
Bu kanalda Tรผrkรงe konuลmayฤฑn.
since all of em are properties of exports object
functions attached to classes or objects are methods
And here I was thinking only C# called their functions "methods"
litterally everyone but scripting languages do
so like java c# c++ etc etc
methods
methods are functions but are usually called so in the context of classes/objects
but general functions are functions
gotcha
Kotlin calls them member functions
methods are functions but are usually called so in the context of classes/objects
@fluid basin what about in the context of a useless npm package
C# is a strictly OOP languages, so all functions are methods
if your function is within a class, its a method
C# is a strictly OOP languages, so all functions are methods
unity supports C# more than they love their mom
technically functions are classes in js :^)
what about arrow functions
if your function is within a class, its a method
@fluid basin i just set em like:
exports.someFunction = function() {}
those can't be initialized with new
arrow functions are just anonymous functions
what about arrow functions
@sudden geyser aka lambda, or anonymous functions
responses : 418 ๐
please, all methods are functions but not all functions are methods
anyone take math notes as psudocode?
technically functions are classes in js :^)
functions are not classes, they're objects in JS
but yes behold simpletons ```js
function amAClass() {
this.number = 1
}
let a = new amAClass()
console.log(a.number)```
truley disgusting
no
that's a constructor
this is a class:
JS has interfaces right?
no
nop
does TS? might be what i'm thinking of
typescript does
but ts types are compile time only
Can anyone help me ? it responses 418 ๐ญ```import requests
url = 'https://top.gg/api'
headers = {'Authorization':'eyJh..........JslLg8'}
res = requests.get(url, headers=headers)
print (res)
class someClass {
constructor smth(smth) {
this.smth = smth
}
someMethod () {
}
}
Classes can store stuff like constructors and methods (they can be constructors on they're own too but not vice versa)
Google what 418 http status code is
classes are syntactic sugar, Waft's snippet and the class keywrod are the exact same thing, using classes is cleaner
How can u get the song cursor and tell where it is for example
node classes are litterally just function expressions
in python
Google what 418 http status code is
@faint prism lmao it's "I'm a teapot" error
they are truley special
lmaooooo
search yourself lmao you'll see
tl;dr use ES6, functions will be functions and classes will be classes
represents the current instance of a class but JS likes to be JS so it differs in some ways to some degree
418 I'm a teapot (RFC 2324, RFC 7168)
This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by teapots requested to brew coffee.[53] This HTTP status is used as an Easter egg in some websites, such as Google.com's I'm a teapot easter egg.[54][55]
the concept of classes do not exist before es6
ts does that tbh, assigning types to objects[
The only reason that doesn't work it's because it's an anon function, and they don't have this, willi
418 I'm a teapot (RFC 2324, RFC 7168) This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by teapots requested to brew coffee.[53] This HTTP status is used as an Easter egg in some websites, such as Google.com's I'm a teapot easter egg.[54][55]
@faint prism it doesn"t help me to have a functionnal request lmao
this behaviour still works
yea obligatory Ts IscOmPilED_JA_VascRipt
It's a meaningless status code
you set types like that
it reserves that object with the interface/type you specified
doesnt that require 'use strict' though
like im talking regardless you cant change type iirc
i never could bother getting into ts because ts is just js
Uh, that is an anon function, but you can still use functions instead of the class keyword
let a = 1;
a = '1';
es6 functions do have their own scope, so I don't see why they are not considered anon functions
let a = 1;
a = '1';
@opal plank I hate how it's a dynamic data type
@cinder patio yes, I know, I am referring to strictly es6 syntax if you want to argue about classes and whatnot
even assigning string to number type
since there is no "classes" before es6
client.on('message', function(message) {
let bots = new Set
bots.add("747954087236206623")
if(message.mentions.has(bots))
{
return message.reply('test working!')
}
})
``` I'm trying to get my bot to respond with a message when I mention it, how can I do that?
๐
no errors
@opal plank
I strongly discourage the use of dynamic in C# though.
Since it was mostly added for compatibility with other languages iirc
@wheat mesa why do you need a set for the mentions
i might have to rename it to indes.d.ts
I was just trying something out since my attempt at grabbing the mentions wasn't working
guys anyone need help im probot creator if anyone need help you can mention me
anyone got cool libs, making a list
also message.mentions is a MessageMention, it is not a collection/map
auto is good keyword :+1:, even the type is chosen in compile time.
anyone got cool libs, making a list
@earnest phoenix I can make you a lib. What do you want it to do?
you will need either MessageMention#users, MessageMention#members or MessageMention#roles
anyone know why my request doesn't work on python ?
thats prolly why I didn't stick with TS, stuff that is well documented and typed works awesome, otherwise its just errors and warnings
it even compiles, its just a hiccup somewhere
it might be cuz i named it interfaces.ts
rather than index.d.ts
actually dont mind me
im retarded
forgot to import my interface

make me a lib that sends me your entire bank account
@earnest phoenix
public static class GetSomeonesBankBalance
{
public static string Balance(int accountNumber)
{
var rng = new Random(accountNumber);
return $"{(rng.Next() + rng.NextDouble()):C}";
}
}
hey java or c# very cool
im hungry but dont want to leave my room cause then ide have to interact
socially
isnt it ```c
#import something from somewhere
i do vaguely recall some language needing # before
im not sure tbh
I think it is for bash
python comment
@earnest phoenix just order a pizza 
its 9am
@opal plank you are probably referring to C++
#include <iostream>
#include "myinterface.hpp"
So?
Never is to early for a pizza
my favorite part of c++ is define
https://modeus.is-inside.me/1SoBP6M9.png this looks dumb but it works lmao
emojilang ftw
i knew it was one of those C's langs
@faint prism shame on you for not recognizing your counterpart

Elo
@knotty steeple Math.round(Math.log(218) / Math.log(2))
use math
wait you want the most significant bit value?
its always 1
unless its 0
o h o k
or unless you have a fixed type (int32, int64, int16 etc)
8bit int lul
hm
@faint prism shame on you for not recognizing your counterpart
@opal plank ah damn i knew that :c
2^8 = 256
128bit architechture when
Super secret bank account peeker ๐ฆ
https://repl.it/repls/SugarySalmonOctagons#main.exe
dgfg really
wait
it should be (num & 128) != 0
or (num & 128) == 128
bitwise operations are much faster
compared to string and string again XD
also since nodejs treats 0 as a "falsey" value
you can just use num & 128 as the condition
yup

.
no
Cool
Can someone explain to me/send the mdn page for bitfield?
const clowns = new Set() //w!clown command
clowns.add("313481150637277197")
client.on('message', function(message) {
if(message.content.startsWith(`${prefix}clown`)) {
if(!message.member.hasPermission('ADMINISTRATOR')) return message.reply('cant use this L')
if(message.mentions.everyone || message.mentions.roles) {return message.reply('Improper mention.')}
let person = message.mentions.users.first()
if(person.bot) {return message.reply('You cannot clown bots.')}
let newClown = message.mentions.users.first()
if(!newClown) return message.reply('You need to mention the user you want to clown.')
if(clowns.has(newClown.id)) {
clowns.delete(newClown.id)
message.reply('removed clown :(')
} else {
clowns.add(newClown.id)
message.reply('new clown in town!')
}
}
})
client.on('message', function(message) {
if(clowns.has(message.author.id)) {
message.react('๐คก')
}
})
I'm having a problem with the bot when someone does w!clown @granite pagoda and it says improper mention. Why is that? When I get rid of message.mentions.roles if they do w!clown @role then it stops working.
whoops I didn't mean to mention user
my bad
oh no multiple events for a command
this is the 3rd day I've been doing this I'm not great at it lol
please don't do this```js
client.on('message', function(message) {
// command
});
client.on('message', function(message) {
// command
});
client.on('message', function(message) {
// command
});```
do this instead```js
client.on('message', function(message) {
if (message.content == "a") {
// command a
}
if (message.content == "b") {
// command b
}
});```
message.mentions.roles is a collection, so even if its empty, it exists, because its an empty collection. so that IF works anyway
how do you make the bot come to your server
invite it
how do you make the bot come to your server
@wild inlet invite it
k
you need to check if message.mentions.roles is empty instead of if it exists:
message.mentions.roles.size
client.user.setActivity(`-help`, {
type: 'PLAYING'
});
@fringe axle tyyy
https://discordpy.readthedocs.io/en/latest/api.html#discord.PublicUserFlags.team_user how would one acquire this flag?
What's defined as "team" in this context? The team on Discord Developers portal?
If yes, then wouldn't I be required to use OAuth2 to access the team_user flag?
If yes, then wouldn't I be required to use OAuth2 to access the team_user flag?
@slender thistle yeah
Got it, thanks
@slender thistle it says "responses [418]" please help me, this error is an easter egg ๐ญ๐
It's not an error lol
You are just sending a request to the base URL so it's an easter egg
@slender thistle
Discord really added Easter eggs to its API?
Ohh
but yeah the request is fine, JeSuis
Really makes you forget that discord logs every single message ever sent huh
@pale vessel I don't speak bitfields but thanks in any case
1024 is team user
okay thx, I believed it was another error ๐
Oh, I see
hi
where do I must to send the request ? it give me the error 403 @slender thistle
Where are you trying to send a request?
in the cog
Show your code
import discord
from discord.ext import commands, tasks
import asyncio
import logging
import requests
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
import requests
url = 'https://top.gg/api'
headers = {'Authorization':'eyJ.........lLg8'}
res = requests.get(url, headers=headers)
print (res)
def __init__(self, client):
self.bot = client
self.token = 'eyJh........JslLg8'
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
@commands.Cog.listener()
async def on_ready(self):
print("Cog charge !")
@tasks.loop(minutes=3.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
def setup(client):
global logger
logger = logging.getLogger('bot')
client.add_cog(TopGG(client))```
I put it in the class TopGG ๐คท
Remove the manual request stuff
update_stats should be updating the server count automatically
const client = new Discord.Client({ ws: { intents: 8191 } })```
is this how i use intents?
yes
ok thnx
in my main file I put client = commands.Bot(command_prefix = '+')
okay I fixed this error, thx @sudden geyser
but I got ANOTHER error (for change) ๐
good job
what is new error
self.update_stats.start()
AttributeError: 'TopGG' object has no attribute 'update_stats'```
here is my code ```class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
import requests
url = 'https://top.gg/api'
headers = {'Authorization':'eyJ.........slLg8'}
res = requests.get(url, headers=headers)
print (res)
def __init__(self, client):
self.bot = client
self.token = 'eyJh.........JslLg8'
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
self.update_stats.start()
def setup(client):
client.add_cog(TopGG(client))```
the TopGG class has no update_stats method
so how to use it ? how to start the program ?
are you making an api wrapper for an api wrapper
@every-one
are you making an api wrapper for an api wrapper
@sonic lodge I just want to have the server count ๐ญ
Where did the update_stats thing go
in the init... nah ?
who is bot plz
you previously had async def update_stats somewhere, but not anymore in this snippet
could someone explain me this?
what in the world is going on
is there a way to get your bot to dm specific users mentioned within a command?
no, it is writen to react with the two emotes (but thats not the error
Hi, I have a problem with my bot, it's using discord.js, shard 1 is basically getting destroyed every x amount of time, it gets reconnected after a few hours automatically. I turned on extra logs and I'm getting the following 'errors': https://hastebin.com/yijosumomu.js
Feel free to mention me if you have an idea.
your syntax is incorrect bruv
new Discord.Client; should be new Discord.Client();
have a look at line 10
but why does it output at line 1
how would you even get a bot to dm a specific user?
you haven't saved your file
i have
i have and still error (token is hidden by me)
the token you provided is invalid read the error wrong
is that a zws
learn js please
Forbidden: Forbidden (status code: 403)
Traceback (most recent call last):
File "C:\Users\Shaal0wFR\Desktop\Bot Discord\cogs\topgg.py", line 36, in update_stats
await self.dblpy.post_guild_count()
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\client.py", line 142, in post_guild_count
await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 169, in post_guild_count
await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload)
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 143, in request
raise errors.Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403)``` @sonic lodge
i have the token, but in the picture not, cuz users could steal it
what property would make bot dm a specific user?
you sure it is inside ""
and as i said before, learn js. please.
@urban olive what library
discord js 12
btw i created the file in cmd with echo //react >> index.js
if you have a user object, user.send('whatever');
bruh, fixed... dont use files created with cmd echo command
why would you do that
too lazy to click a maximum of 2-3 times to make a new file
yes
๐
how would i define user though?
It says to me error 403. Forbidden. Why ? ๐ญ```class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
import requests
url = 'https://top.gg/api'
headers = {'Authorization':'ey..........Lg8'}
res = requests.get(url, headers=headers)
print (res)
@commands.Cog.listener()
async def on_ready(self):
print("Cog pret !")
def __init__(self, client):
self.bot = client
self.token = 'ey........Lg8'
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
@tasks.loop(minutes=3.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
def setup(client):
global logger
logger = logging.getLogger('bot')
client.add_cog(TopGG(client))```
i actually just can create new file by Super key, type cmd, then go to right folder with cd cli command, and then type code . and then just click the "+" button.
easy
hello could someone help me with this? :
the errors are given at the bottom, but im not sure what its asking me to input
umless you use bigints, and your library supports it
ty
@sonic lodge should be fine if you're comparing but it's still a good practice to use strings
now there are more problems with the code :(
TypeError: user.send is not a function
how is user defined
you need to convert that id to a user object
do i do message.user.send('OK');?
think about that for a moment
oh ok
you're telling it that user is a string, then you attempt to call send() on a string
and that doesn't make sense, does it?
and "stop making up your own methods and properties and read the docs"
the magic of google
i just changed mine back to this because using command function didnt work
or whatever it was lol
does anyone know how to keep ur bot online, like mee6 is always online. everytime i close visual code it goes offline?
When I post this code, ```url = 'https://top.gg/api'
headers = {'Authorization':'ey.......Lg8'}
res = requests.get(url, headers=headers)
print (res)
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
@commands.Cog.listener()
async def on_ready(self):
print("Cog pret !")
def __init__(self, client):
self.bot = client
self.token = 'ey.......Lg8'
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
@tasks.loop(minutes=3.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
def setup(client):
global logger
logger = logging.getLogger('bot')
client.add_cog(TopGG(client)) I got this errorFailed to post server count
Forbidden: Forbidden (status code: 403)
Traceback (most recent call last):
File "C:\Users\Shaal0wFR\Desktop\Bot Discord\cogs\topgg.py", line 36, in update_stats
await self.dblpy.post_guild_count()
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\client.py", line 142, in post_guild_count
await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 169, in post_guild_count
await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload)
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 143, in request
raise errors.Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403)```
args[1] == "ADMINISTRATOR" || args[1] == "CREATE_INSTANT_INVITE" || args[1] == "KICK_MEMBERS" || args[1] == "BAN_MEMBERS" || args[1] == "MANAGE_CHANNELS" || args[1] == "MANAGE_GUILD" || args[1] == "ADD_REACTIONS" || args[1] == "VIEW_AUDIT_LOG" || args[1] == "PRIORITY_SPEAKER" || args[1] == "STREAM" || args[1] == "VIEW_CHANNEL" || args[1] == "SEND_MESSAGES" || args[1] == "SEND_TTS_MESSAGES" || args[1] == "MANAGE_MESSAGES" || args[1] == "EMBED_LINKS" || args[1] == "ATTACH_FILES" || args[1] == "READ_MESSAGE_HISTORY" || args[1] == "MENTION_EVERYONE" || args[1] == "USE_EXTERNAL_EMOJIS" || args[1] == "VIEW_GUILD_INSIGHTS" || args[1] == "CONNECT" || args[1] == "SPEAK" || args[1] == "MUTE_MEMBERS" || args[1] == "DEAFEN_MEMBERS" || args[1] == "MOVE_MEMBERS" || args[1] == "USE_VAD" || args[1] == "CHANGE_NICKNAME" || args[1] == "MANAGE_NICKNAMES" || args[1] == "MANAGE_ROLES" || args[1] == "MANAGE_WEBHOOKS" || args[1] == "MANAGE_EMOJIS"
I seriously do not want to do this. Is there a simpler way to do this
what the fuck
does anyone know how to keep ur bot online, like mee6 is always online. everytime i close visual code it goes offline?
@calm junco heroku
avoid heroku
or buy a vps
avoid glitch
buy a vps
array.includes
I seriously do not want to do this. Is there a simpler way to do this
@shy turret something like["SPEAK", "MANAGE_NICKNAMES"].includes(args[1]), depends on what you're trying to do
https://hastebin.com/
@urban olive haha thx I didn't know this website exists
so i guess that works
but nothing helps me lmao
wait
@shy turret
you might be able to do Object.keys() on this
https://discord.js.org/#/docs/main/stable/class/Permissions?scrollTo=s-FLAGS
you'll get an array of valid permissions
["ADMINISTRATOR","CREATE_INSTANT_INVITE","KICK_MEMBERS","BAN_MEMBERS","MANAGE_CHANNELS","MANAGE_GUILD","ADD_REACTIONS","VIEW_AUDIT_LOG","PRIORITY_SPEAKER","STREAM","VIEW_CHANNEL","SEND_MESSAGES","SEND_TTS_MESSAGES","MANAGE_MESSAGES","EMBED_LINKS","ATTACH_FILES","READ_MESSAGE_HISTORY","MENTION_EVERYONE","USE_EXTERNAL_EMOJIS","VIEW_GUILD_INSIGHTS","CONNECT","SPEAK","MUTE_MEMBERS","DEAFEN_MEMBERS","MOVE_MEMBERS","USE_VAD","CHANGE_NICKNAME","MANAGE_NICKNAMES","MANAGE_ROLES","MANAGE_WEBHOOKS","MANAGE_EMOJIS"]
@shy turret you can use if (require("discord.js").Permissions.FLAGS[m.args[1]])
BRUH i just typed that all out
please don't do that
that too
i keep forgetting that js objects are just fancy dictionaries and that you can index them
imagine writing useless code that your lib does for you
ikr me
ikr
||if you didnt get the joke, i made my own bitwise converted||
does it matter how i define the object holding the id of the user i want the bot to DM?
||which dj.hs with .Permissions()||
i actually very scared i can read that now
||that code up there is mine and completely reduntant cuz d.js has it, it was a joke, laugh ffs||
........ if that was djs code and i understood it...
discord.js lib*
d.js has its own way of checking it with a method that flaze said. It does the conversion for you. That code you see me doing up there is mine, not discord.js's, since why i jokingly said ' are you stupid for doing something so redundant?', cuz i did it too. T'was a joke, now i had to explain it, now it lost all its funny'ness

im also scared i wrote my own scripting lang and didnt understand that
here is my code : https://hastebin.com/ilitemagun.py
and here is my error : https://hastebin.com/magudafoxu.sql
Can anyone help me please ?
Failed to post server count
Forbidden: Forbidden (status code: 403)
same error as you @shy turret
you forgot ur api key i think
nope, her is in my code
@leaden lake i just pasted what ur hastebin said
url = 'https://top.gg/api' doesn't seem right
yeah
yes it is shivaco said
post to /bots/YOUR BOT ID/stats
where is it ?
server_count
Change it to url = 'https://top.gg/api/bots/YOUR BOT ID/stats'
and change YOUR BOT ID to your bot id
oh okay
res = requests.get(url, headers=headers)
shouldnt it be res = requests.post(url, headers=headers)
(i dont code python btw)
Can i ask questions about web dev in here?
headers = {'Authorization':'ey........Lg8'} also
you need to add {'server_count':number} somewhere
@stoic hull a top.gg website developer or any developer you knows how to make websites?
Well.
I keep getting this error and cant find a fix online.
HTTP Error 404. The requested resource is not found.
bad url
bad url
@faint prism Hm i pointed the domain name to my servers ip on the good port with port forwarding.
I'm going to need more context about your issue
@stoic hull You can keep it in this channel in-case anyone else has a similar issue
So i bought a domain name, pointed the domain to the website servers ip address, which is hosted with apache2. And i just get the 404 not found error.
So i bought a domain name, pointed the domain to the website servers ip address, which is hosted with apache2. And i just get the 404 not found error.
@stoic hull We can keep the discussion in #development
Alright.
alright so is the url accessible via the IP? http://yourIPAddress not the domain
Jup
Are you testing with the public IP, not local?
Public ip, yes.
So it doesn't start with 192.168... right?
Nope, i know the difference between a public and local ip.
Okay, so try accessing the website via http://yourdomain.whatever/
That's when you get the 404?
HTTP Error 404. The requested resource is not found.
Nope i don't.
Oh sweet
Then your domain is correctly serving the webservice
however, you aren't serving anything on the root route /
like an index.html
Uh let me test something.
My index.html is in /var/www/html/index.html
and when i used a free dns service (dynu) it would work great.
really? hm
Yup, and i can't find any articles on the specific problem.
sounds like the domain provider may have some config that's messing up the routing
Hm, maybe the root apache2 folder?
The provider is bnamed
I mean you said the index page was being served with a different domain provider
anyone
Yup, maybe i can find a tutorial on how to use bnamed
can anyone suggest me a hosting service for free
I'll come back to it, yeah?
can anyone suggest me a hosting service for free
@modest smelt I don't know of any commercially available.
https://discordapp.com/channels/264445053596991498/272764566411149314/748209272663310447
but then i can't access json files
it literally says it 404
@ancient falcon So 404 means the service is responding, but nothing is at that domain.com/someresource url
yeah
So when you access it directly, it doesn't 404, right?
If so, your domain provider must be messing up
domain or subdomain is not found
the browser was able to communicate with a given server, but the server could not find what was requested
from wikipedia
yeah, ik what the status code means
404 doesn't have to do with client side
the server sends you a 404 code, so you were connected to the server at some point
yeah, true but it doesnt send the custom 404 i set.
4xx is a client error
yeah but 404 is an error in the request
yes
the error is in what was requested
So we are in agreement
@stoic hull that means exactly what it says
i get that.
im trying to make so when the bot creates the channel it generates a random number 1-1000 like ticket #1045
im trying to make so when the bot creates the channel it generates a random number 1-1000 like ticket #1045
@lean lintel just use a random int module?
tickets should definitely not be random lol
they should count up
ticket #0001
ticket #0002
..
lma0
@lean lintel did
couldnt be me
just add 1 to the previous ticket?
I don't know any more information ๐คทโโ๏ธ
no, we can't read your mind unfortunately
somone does .ticket and it creates ticket #1
and if somone does it again
it creates ticekt #1 again
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content === '-ping') {
msg.reply('Pong!');
} else if (msg.content === '-help') {
msg.reply('\n__**COMMANDS**__ \n-help : shows you this \n-ping : checks if bot is alive and running! \n-invite : Gets you invite link for bot and support server. \n-support : Sends a link to the support server. \n-beep : Random fun command, kind of like the -ping command. \n \n**More commands will be added soon.**')
} else if (msg.content === '-invite') {
msg.reply('\n**OMG! Please invite me to your server(s) because I can help you alot! \n**Bot Invite**: i aint showing \n**Support Server Invite**: i aint showing')
} else if (msg.content === '-beep') {
msg.reply('Boop.');
} else if (msg.content === '-support') {
msg.reply('Here is the link to our support server: i aint showing')
}
});
client.user.setActivity('-help', {
type: 'PLAYING'
});
client.login('i aint showing');
thats not what im trying to do
why wont it work
why wont it work
@sand skiff idk, what's the error?
when i try to run it
/Users/SiaYT/Desktop/MAY/index.js:22
client.user.setActivity('-help', {
^
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:22:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$ ```
if you want tickets you'll most likely need a database, otherwise there can be user interference and your system will do a big oopsie
my simple ticket system is fine hehe
it needs to be in client.on ready
just need to do that
can someone fix it for me?
no
huh
imagine wanting to be spoonfed
oh
[ERR_INVALID_CALLBACK]: Callback must be a function.
Can someone help me with that?
Callback isnt a function lol
@dawn plaza show full context
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
} client.user.setActivity('-help', {
type: 'PLAYING'
});``` @stoic hull like this?
yes
no that isnt right
make it one line tho
ok
huh
its not inside it
just
oh
@dawn plaza show code for insult.js
afk
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
} client.user.setActivity('-help', {
type: 'PLAYING'
});``` @stoic hull like this?
@sand skiff Javascript uses brackets to declare function body
client.user.setActivity('-help', { type: "PLAYING" })
client.on('ready', () => { // Opening of the function
console.log(`Logged in as ${client.user.tag}!`);
}); // Ending of the function
JS is whitecase insensitive iirc
missed a )
and yeah
module.exports = {
name: 'insult',
description: ".",
execute(message, args){
if(message.member.roles.cache.some(r => r.name === "Creator")){
message.channel.send("");
setTimeout(message.channel.send("1"),2000);
setTimeout(message.channel.send("2"),6000);
setTimeout(message.channel.send("3"),8000);
setTimeout(message.channel.send("4"),10000);
setTimeout(message.channel.send("5"),12000);
} else {
message.channel.send('No permissions');
}
}
}
@quartz kindle
@calm junco heroku
@leaden lake what that
setTimeout expects a function
setTimeout uses a callback function
message.channel.send() returns a promise
yeah
So how should I write it?
setTimeout(() => message.channel.send(), 2000)
Ohh, thank you!
shouldn't it be message.channel.send without parenthesis or am I too python
before or after?
its parenthesis after because send is a function
if you put parenthesis in python it'll pass the result of the function as an argument
yeah its the same in js
Thanks kyando and auger ๐
thats why we give a lambda function to setTimeout
client.user.setActivity('-help', { type: "PLAYING" }
@stoic hull still not workign
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
} client.user.setActivity('-help', { type: "PLAYING" }
});```
@stoic hull still not workign
@sand skiff is it in the ready event
no it isnt
still outside
oh
remove the bracket at the beginning of the client.user.setActivity
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('-help', { type: "PLAYING" })
});
^
close the setActivity
wait oh ye
fuCK im tired ok
fuCK im tired ok
@misty sigil relatable
one of the ways yes
i dont think so
I just realized that
ok thanks tim
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('-help', { type: "PLAYING" })
});```
this?
(() => )
you can also do function() {}
bc its still not working
yes
dang I'm too used to python sugar code
i was gonna send that falzepe
Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:23
client.user.setActivity('-help', {
^
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$
@sand skiff did you remember to save
DID
lmao
YOU
YES
I dont think you did
I SAVED IT
client.user is null because it's their old code?
.user.setActivity('-help', { looks like your old code
yea it does
Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:22
client.user.setActivity('-help', {
^
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:22:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$
new err
Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:23
client.user.setActivity('-help', {
^
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$```
someFuncThatExpectsALambda(() => console.log("bla"))
someFuncThatExpectsALambdaWithParams(a => console.log(a))
someFuncThatExpectsALambdaWithMultipleParams((a,b,c) => console.log(a,b,c))
someFuncThatExpectsALambdaWithParamsWithRegularFunctions(function(a) { console.log(a) })
Lol
1 line below
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('-help', { type: "PLAYING" })
});```
how
look at index
How quickly can you make a bot send messages before it breaks?
dont try and push it that far
How quickly can you make a bot send messages before it breaks?
@dawn plaza Sounds like API abuse
ratelimits bad
discord allows 5 messages per 5 seconds per channel
Okay, thanks
bruh what
@slender thistle y u spam
||maybe I was too quick to @ sorry <3||
can we not spam pls?
@faint prism Mine sends a message longer than 2000 characters and I didn't want other's messages to break the line
help pls anyone?
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('-help', { type: "PLAYING" })
});```
try saving it
show us proof that its saved
ill try again
i mean jeremy, it is one line lower than the previous error
client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
client.user.setActivity('-help', { type: "PLAYING" })
});
oops
see
indeed
then whast WRONG with IT
client.user doesn't exist
The IT industry has a lot of issues rn
its defined as client
console.log(JSON.stringify(client))
nO
its defined as client
@misty sigil so uh
no?
dont need to json stringify in console.logs iirc
client.setactivity?
no
can you not do that iwth client?

client.setactivity?
@sand skiff that's a question for d.js docs
infact luca needs a djs command
@leaden lake what that
@calm junco a host
// Set the client user's activity
client.user.setActivity('discord.js', { type: 'WATCHING' })
.then(presence => console.log(`Activity set to ${presence.activities[0].name}`))
.catch(console.error);```
thats from d.js
in the ready event
ok
it is on ready event though
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('-help', { type: "PLAYING" })
});```
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('discord.js', { type: 'WATCHING' })
.then(presence => console.log(`Activity set to ${presence.activities[0].name}`))
.catch(console.error);
});
i dont see typos either
like this?
yes
ok
let e save and run
sEnD eRrOr
^
no not that
(watch client not be defined https://canary.discordapp.com/channels/264445053596991498/272764566411149314/748600445940924466)
lmao
I wonder if there are discord bots with afk command?

Susantas-iMac:~ SiaYT$ cd /Users/SiaYT/Desktop/MAY
Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:25
client.user.setActivity('-help', {
^
TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:25:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$
UGH
IT WONT
WORK
lol
BRUH
make the api call directly then
^ do that
yes it doesnt
the heck?
not at fucking all
both bots on the same acc
replies to all commands except this, whcih only my local replies to
both are cloned from git
say what now?
no errors either

git pull ?
i did

no
learn the JS language
ยฏ_(ใ)_/ยฏ
If you actually learned the beginner stuff for Javascript language, you'd actually be able to solve most the syntax issues you run into @sand skiff
you can always google it lol
wait a second
you dont think this is doing it, do ya?
it should only return '' on that ${} bit
not set the whole message as ''

smh i have to wait again 3 weeks
why
i should prob add a getter method to channels cache tbh
aye
@opal plank might be that your running it twice
IM SO CONFUSED













