TheRealToxicDev / Config Validation
0 likes
0 forks
1 files
Last active
Validate the bots config values
1 | const config = require('../configs/main.config'); |
2 | |
3 | module.exports.configCheck = async function({ client }) { |
4 | |
5 | if (!config.Discord.Tokens.main || config.Discord.Tokens.main == '') { |
6 | |
7 | await client.logger('Please provide a valid production token.', { |
8 | header: 'INVALID_CONFIG', |
9 | type: 'error' |
10 | }); |
TheRealToxicDev / Guild Member Add Event
0 likes
0 forks
1 files
Last active
Guild member add event for discord bot using discord.js v14.12.1
1 | module.exports = { |
2 | name: 'guildMemberAdd', |
3 | once: false, |
4 | |
5 | async execute(member, client) { |
6 | |
7 | if (!member.guild.id === '') return; // Ignore the event if triggering guild is not the support guild |
8 | |
9 | try { |
TheRealToxicDev / Team Acks
0 likes
0 forks
1 files
Last active
Kinda pointless function that checks a user staff roles and adds them to an array to be used in commands for enfinity
1 | module.exports.getTeamAcks = async function ({ client, guildId, userId }) { |
2 | |
3 | let guild = await client.guilds.cache.get(guildId); |
4 | let user = await guild.members.cache.get(userId); |
5 | |
6 | /** |
7 | * DEFINE TEAM ACKS |
8 | */ |
9 | |
10 | let teamAcks = []; |
rootspring / webhooks.md
0 likes
0 forks
1 files
Last active
Parsing webhooks
To parse webhooks, here is the algorithm you should/must follow:
Examples are provided in JS as of right now
- Check the protocol version:
- The current protocol version is
splashtail
- Check the
X-Webhook-Protocol
header and ensure that it is equal to the current protocol version
- The current protocol version is
rootspring / d
0 likes
0 forks
1 files
Last active
1 | func (w *GatewayClient) HandleEvent(event []byte, typ string) { |
2 | if w.EventHandlers.RawSinkFunc != nil { |
3 | w.EventHandlers.RawSinkFunc(w, event, typ) |
4 | } |
5 | |
6 | if typ == "Bulk" { |
7 | // Bulk is a bit unique, special handling is required |
8 | err := w.HandleBulk(event) |
9 | |
10 | if err != nil { |
rootspring / sofar.go
0 likes
0 forks
1 files
Last active
1 | // Event handler for the websocket |
2 | type EventHandlers struct { |
3 | // Not an actual revolt event, this is a sink that allows you to provide a function for raw event handling |
4 | RawSinkFunc func(w *GatewayClient, data []byte, typ string) |
5 | |
6 | // An error occurred which meant you couldn't authenticate. |
7 | // |
8 | // <Note that grevolt handles these for you in general, but you can provide additional logic here> |
9 | Error func(w *GatewayClient, e *events.Error) |
rootspring / User Auth External Example
0 likes
0 forks
1 files
Last active
1 | type iLogin struct { |
2 | code string |
3 | state string |
4 | } |
5 | |
6 | var loginCh = make(chan iLogin) |
7 | |
8 | func init() { |
9 | // Load login webserver |
10 | http.HandleFunc("/auth/sauron", func(w http.ResponseWriter, r *http.Request) { |
Newer
Older