botblock / blapi Goto Github PK
View Code? Open in Web Editor NEWA package to handle posting your discord bot stats to all botlists [Typescript (and JavaScript) - maintained by @maybeanerd]
License: MIT License
A package to handle posting your discord bot stats to all botlists [Typescript (and JavaScript) - maintained by @maybeanerd]
License: MIT License
Describe the bug
I see that if you update what is the number of servers that the bot has, but you don't see that it updates the number of users that the bot has, on the page it shows as "Unknown" and I do it manually if I can put it, but this package does not put that field for that page, and I imagine that also for other pages that I have not tried.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
See the total number of servers with the bot and the total number of users with the bot on discordbotlist.com (or on other pages that I have not tried).
We would want to add an automatic release to GitHub packages into the existing CI.
It should already exist partly but does not work fully yet. Most likely, the access key is invalid, as we probably need one from @botblock/libs directly, and not myself.
The goal:
Make it deploy to both npm and GitHub packages at the same time.
This affects the pr/14 branch.
When the handle()
function is called, it uses the passed in client object to get the shard (if existent), and then calls fetchClientValues()
. If all shards aren't ready, this throws an error and fails to post the information.
This happens because shards are started at a delay. If shard 0 doesn't call handle()
when every shard is ready, this will error every time. The solution is to wait until all shards are ready before running the fetchClientValues
code.
Normally, you might think 'Just use the event that runs when all the shards are ready.' That event doesn't exist, though. The only way to dynamically wait before calling the function is to write your own implementation of an allShardsReady
event or some other way of waiting for every shard to get ready.
Another, a simpler solution would be to just wait 45 or so seconds before calling the function and hope your shards are ready then.
feel free to open a PR for this issue! It's currently not being worked on
Discord.js isn't the only library developers use.
Eris has types and should, therefore, be somewhat easy to also be added.
We would want a clear distinction of both libs within BLAPI, depending on the differences.
Describe the bug
BLAPI does not post through the handle
function on start when using traditional sharding. It is unclear how one is meant to use BLAPI with traditional sharding. Am I meant to use manualPost
, and if so, can an example be provided?
To Reproduce
Steps to reproduce the behavior:
// index.ts
const manager = new ShardingManager('./dist/bot.js', { token: process.env.DISCORD_TOKEN, totalShards: 3 });
// bot.ts
import { Client } from 'discord.js';
import { handle, setLogging } from 'blapi';
const client = new Client();
await client.login(process.env.DISCORD_TOKEN);
const botListAPIKeys = {
'voidbots.net': process.env.VOIDBOTS_KEY
};
setLogging({
extended: true,
logger: logger
});
await handle(client, botListAPIKeys);
BLAPI: Error [ShardingInProcess]: Shards are still being spawned.
Expected behavior
BLAPI posts to bot lists without any issues.
currently all contributors are listed in the package.json as well as the file AUTHORS
package seems to not do anything, not even on npm, so if there's no reason to include everyone in there , i'd clean it up to only contain maintainers (in this case,me)
id like to rework the AUTHORS file so that instead of it, we use https://allcontributors.org/docs/en/bot/overview in the readme.
this makes it easier to find contributors as well as crediting them in general
Describe the bug
Improper jsdoc throws errors in typescript
To Reproduce
Steps to reproduce the behavior:
use blapi.manualPost
with the 5th argument in typescript
// direct copied code
// this: Eris.Client extended by eris-sharder
let g = [];
for(let i = 0;i < this.bot.shards.size; i++) g.push(Object.values(this.bot.guildShardMap).filter(s => s === i).length);
blapi.manualPost(client.bot.guilds.size,client.bot.user.id,config.botLists,0,client.bot.shards.size,g);
// error at g:
// Argument of type 'any[]' is not assignable to parameter of type '[any]'.
// Property '0' is missing in type 'any[]' but required in type '[any]'.ts(2345)
Expected behavior
No error should be thrown by typescript
Screenshots
TypeScript Error
Additional context
Works fine in normal javascript, but jsdoc is still messed up
Describe the bug
Looks like when blapi is posting through botblock it attempts to post to bfd (set in my code as botsfordiscord.com, a legacy id for discords.com), but when botblock is disabled, it does not log anything for bfd
Expected behavior
Should Post to bfd as well
Additional context
Could be related to legacy ID handling
In the documentation I do not see an example of how to do it with the Sharding Manager of Discord.js, I would like to know how to do it since I cannot put the handler method in the onReady of my Discord client because of the Shards that are being created, no they all have the same guild value.
Describe the bug
This is probably somehow a bug in https://github.com/ddugovic/lishogi-discord , but I don't understand how to troubleshoot it. Upon attempting to retrieve the server count, my bot crashes.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Bot does not crash
Screenshots
lichess@vps178028:~/lichess-discord$ /usr/bin/node /home/lichess/lichess-discord/index.js
[ERROR] BLAPI Discord client seems to not be connected yet, so we're skipping this run of the post. We will try again in 1 minutes.
Bot is online!
2 users, in 1 servers connected.
Uncaught Promise Error: TypeError: Cannot read property 'size' of undefined
at /home/lichess/lichess-discord/node_modules/blapi/dist/blapi.js:241:42
at step (/home/lichess/lichess-discord/node_modules/blapi/dist/blapi.js:57:23)
at Object.next (/home/lichess/lichess-discord/node_modules/blapi/dist/blapi.js:38:53)
at /home/lichess/lichess-discord/node_modules/blapi/dist/blapi.js:32:71
at new Promise (<anonymous>)
at __awaiter (/home/lichess/lichess-discord/node_modules/blapi/dist/blapi.js:28:12)
at handleInternal (/home/lichess/lichess-discord/node_modules/blapi/dist/blapi.js:203:12)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
Additional context
Bot is hosted on OVH. I just switched to using this library from using dblapi.js which produced a similar error.
Hey everyone I didn’t know how else to go about doing this so I figured maybe I should just make a issue. About a month or two ago (maybe longer) I was banned from the BotBlock server for “being toxic” after simply asking for support and having a member attack me but anyways that’s not what I’m here for
I was wondering if it’s possible for me to appeal this ban, I am deeply sorry for my actions that day I was just having a bad day in general and I realize now that maybe I should have just said nothing to the person who started the argument.
90% of our users for both Paradise and Infinity use the BotBlock API and honestly the best way I can see to offer them any support they may need with these lists is to be a member of the server.
My actions on the day of my ban were uncalled for and that I understand if given another chance I promise I will keep to myself unless directly asked for assistance ❤️
Edit: I just realized I posted this on the API Repo not the main Repo my bad 😬 sorry I just woke up like 20 mins ago lol
Thanks in Advance
Is your feature request related to a problem? Please describe.
Not related to a problem just an idea by @Huskydog9988
Describe the solution you'd like
Passing your own logger so you dont get console outputs for people that are using some special logger like bunyan or something. Would required their logger to at least have a loglevel for info, warn and errors.
Describe alternatives you've considered
I thought about overwriting the console.log method globally but that didn't feel right.
Concept
blapi.setLogger(myLogger)
EDIT:
Alternative Conept
blapi.setLogging({
extended: true,
logger: myLogger
})
Currently BLAPI doesn't have any code for sharding support. Will there ever be support to send shards along with their server counts to supported listings?
Describe the bug
No stats have bene posted to any bot list when i started using sharding...
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should post all stats and shards, i tried without sharding and worked again.
Question
is there anything i have to do to use Sharding with it?
It's a great work. I appreciate 😀❤️. It would be better if you add support for more sites. I've found one discord-botlist.eu
.
Describe the bug
I was running the bot on a standard PM2 server config all fine now we have switched to Docker-Compose and the BLAPI will show no errors at all and at the start shows its working just no bot lists have been updated?
To Reproduce
Make a bot using Docker-Compose and send the stats to a botlist using the AutoPost with it set to 60 minutes.
Expected behavior
should post.
Is your feature request related to a problem? Please describe.
Ability to log if the count has been successfully / failed to send to the list.
Describe the solution you'd like
Basically an option to log to log as stated above.
Describe alternatives you've considered
N/A
Additional context
N/A
My bot is on thousands of servers and has 4 shards. BLAPI is sending to server listings that support shards and don't that it has 4 shards and is only on 912 servers (the first shard's server count).
I am running the latest version of BLAPI from GitHub and I'm not using manual posting.
Why is this happening and how can I fix this?
Is your feature request related to a problem? Please describe.
Discordjs v14 was released, and most likely it brings some changes to the client type.
Describe the solution you'd like
Support the type of v14 without the addition of a new required dependency. Maybe add it as optional peer dependency, if that makes it easier to manage
It would be nice to return the promises to give devs more ways to work with BLAPI.
It would be rather convenient if BLAPI could just get all tokens from the Environment.
An Idea would be to prefix them with BLAPI_ oder BOTLIST_TOKEN
An Open question is how to map them. An Idea:
Domain name (without ending or subdomain)
Would only work if there are no duplicates with other endings or subdomains, an example would be:
BLAPI_ondiscord for bots.ondiscord.xyz
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Package dependencies
require line
Expected behavior
No error is thrown.
Screenshots
screenshot of error when viewing typings
error when compiling
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
).github/workflows/nodejs.yml
actions/checkout v4
actions/setup-node v4
.github/workflows/npmpublish.yml
actions/checkout v4
actions/setup-node v4
package.json
centra 2.7.0
@types/centra 2.2.3
@types/node 20.14.15
@typescript-eslint/eslint-plugin 7.18.0
@typescript-eslint/parser 7.18.0
eslint-config-airbnb-base 15.0.0
prettier 3.3.3
rimraf 5.0.10
typescript 5.0.4
discord.js 13 - 14
.nvmrc
node 20.16.0
Metalist rebranded to BotBlock, the package should be updated as the URL for the API has changed.
Is your feature request related to a problem? Please describe.
I'm always frustrated when I want to install a package and it comes with node-fetch and therefore unneded clutter. Please use something more lightweight like centra or the aero fork of it.
Describe the solution you'd like
Use something more lightweight like centra or the aero fork of it. (https://www.npmjs.com/package/@aero/centra)
Describe alternatives you've considered
If you guys want i can make a pull request and implement it for you.
It'd be cool if LBots.org could be added, and supported, by this module
I checked everything correctly, for others sites it's working fine. But for infinitybotlist.com, it's not posting stats
Is your feature request related to a problem? Please describe.
If botlists rebrand and/or change names, when and how does the library adapt?
Describe the solution you'd like
Make the lib support new and older, legacy versions of botlist IDs
Describe alternatives you've considered
None
Additional context
Botblock will add this as well, so we only need to handle it on calls which don't use botblock.
Was created based on #39
It would be nice to be able to quickly and safely release new versions e.g. with package/dependency updates.
Adding tests for the default use cases should help doing that with confidence.
Is your feature request related to a problem? Please describe.
VoidBots.net isn't listed on BLAPI and therefore should be added.
Describe the solution you'd like
Adding voidbots.net to BLAPI should be considered.
Additional context
You can find a link to their documentation here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.