TheRealToxicDev / Sort Blog Posts
0 likes
0 forks
1 files
Last active
Sorts the posts by date and time!
1 | export const getSortedPosts = () => { |
2 | const fileNames = fs.readdirSync(POST_DIRECTORY) |
3 | |
4 | const allPostsData = fileNames.map(filename => { |
5 | const slug = filename.replace(FILE_EXTENSION, '') |
6 | |
7 | const fullPath = path.join(POST_DIRECTORY, filename) |
8 | const fileContents = fs.readFileSync(fullPath, 'utf8') |
9 | const { data } = matter(fileContents) |
TheRealToxicDev / CordX API | Fetch Discord User
0 likes
0 forks
2 files
Last active
Simple api used to fetch a discord user
1 | export type Snowflake = string; |
2 | |
3 | export type DiscordUser = { |
4 | id: Snowflake; |
5 | username?: string; |
6 | global_name?: string; |
7 | discriminator?: any; |
8 | accent_color?: ColorData['accent_color']; |
9 | banner_color?: ColorData['banner_color']; |
10 | created_at?: any; |
rootspring / permoverwrites.go
0 likes
0 forks
1 files
Last active
1 | func memberChannelPerms(g *discordgo.Guild, c *discordgo.Channel, m *discordgo.Member) int64 { |
2 | if g.OwnerID == m.User.ID { |
3 | return discordgo.PermissionAll |
4 | } |
5 | |
6 | // Get everyone role of the guild |
7 | var everyoneRole *discordgo.Role |
8 | |
9 | var roleMap = make(map[string]*discordgo.Role) |
10 | for _, role := range g.Roles { |
rootspring / reshard.go
0 likes
0 forks
1 files
Last active
1 | // Reshards an instance list |
2 | // |
3 | // EXPERIMENTAL: Set 'reshard' in experimental_features to enable this |
4 | func (l *InstanceList) Reshard() error { |
5 | if !utils.SliceContains(l.Config.ExperimentalFeatures, "reshard") { |
6 | return errors.New("reshard not enabled") |
7 | } |
8 | |
9 | if !l.RollRestarting { |
10 | return fmt.Errorf("cannot reshard during a rolling restart") |
rootspring / data_tasks.go
0 likes
0 forks
1 files
Last active
1 | package assets |
2 | |
3 | import ( |
4 | "popplio/state" |
5 | |
6 | "github.com/infinitybotlist/eureka/dovewing" |
7 | jsoniter "github.com/json-iterator/go" |
8 | "go.uber.org/zap" |
9 | ) |
rootspring / decryptTicket.ts
0 likes
0 forks
1 files
Last active
1 | interface DownloadFileCallbacks { |
2 | onDownloadStart?: (mode: string, url: string) => void |
3 | onDecryptStart?: (mode: string, url: string) => void |
4 | } |
5 | |
6 | const downloadFile = async (ticketId: string, encKey: string, attachment: Attachment, callbacks?: DownloadFileCallbacks) => { |
7 | // Legacy: CDN cached |
8 | if(attachment?.url || attachment?.proxy_url) { |
9 | // Download the file |
10 | let url = attachment?.proxy_url ? attachment?.proxy_url : attachment?.url |
rootspring / assetcleaner.rs
0 likes
0 forks
1 files
Last active
1 | use log::{info, warn, error}; |
2 | |
3 | pub async fn asset_cleaner(pool: &sqlx::PgPool) -> Result<(), crate::Error> { |
4 | let type_id_map = indexmap::indexmap! { |
5 | "bots" => "bot_id", |
6 | "servers" => "server_id", |
7 | "teams" => "id", |
8 | "partners" => "id", |
9 | }; |
TheRealToxicDev / User Warnings
0 likes
0 forks
1 files
Last active
Handles how many warns a user can have.
1 | if (cases && cases.length >= 3) return enfinity.interaction.guild.bans.create(member.user.id, { |
2 | reason: 'User has exceeded our allowed maximum of 3 warnings' |
3 | }).then(async banned => { |
4 | await log.send({ |
5 | embeds: [ |
6 | new enfinity.Gateway.EmbedBuilder() |
7 | .setTitle('Action: ban user') |
8 | .setColor(enfinity.colors.base) |
9 | .setThumbnail(enfinity.logo) |
10 | .setDescription('Whoops, someone messed up and got the bean') |