fix: trim tags
This commit is contained in:
parent
4e2afcc7f8
commit
fcb37570ae
3 changed files with 30 additions and 23 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,3 +7,5 @@ dist
|
|||
.env.local
|
||||
|
||||
eslint_report.json
|
||||
|
||||
.DS_Store
|
||||
|
|
47
src/index.ts
47
src/index.ts
|
@ -18,7 +18,7 @@ import { tagsCommand } from './commands/tags';
|
|||
import { jokeCommand } from './commands/joke';
|
||||
|
||||
import random from 'just-random';
|
||||
import { green, bold, yellow } from 'kleur/colors';
|
||||
import { green, bold, yellow, cyan } from 'kleur/colors';
|
||||
import 'dotenv/config';
|
||||
|
||||
const client = new Client({
|
||||
|
@ -39,26 +39,28 @@ client.once('ready', async () => {
|
|||
console.log(green('Discord bot ready!'));
|
||||
|
||||
console.log(
|
||||
client.generateInvite({
|
||||
scopes: [OAuth2Scopes.Bot],
|
||||
permissions: [
|
||||
'AddReactions',
|
||||
'ViewChannel',
|
||||
'BanMembers',
|
||||
'KickMembers',
|
||||
'CreatePublicThreads',
|
||||
'CreatePrivateThreads',
|
||||
'EmbedLinks',
|
||||
'ManageChannels',
|
||||
'ManageRoles',
|
||||
'ModerateMembers',
|
||||
'MentionEveryone',
|
||||
'MuteMembers',
|
||||
'SendMessages',
|
||||
'SendMessagesInThreads',
|
||||
'ReadMessageHistory',
|
||||
],
|
||||
})
|
||||
cyan(
|
||||
client.generateInvite({
|
||||
scopes: [OAuth2Scopes.Bot],
|
||||
permissions: [
|
||||
'AddReactions',
|
||||
'ViewChannel',
|
||||
'BanMembers',
|
||||
'KickMembers',
|
||||
'CreatePublicThreads',
|
||||
'CreatePrivateThreads',
|
||||
'EmbedLinks',
|
||||
'ManageChannels',
|
||||
'ManageRoles',
|
||||
'ModerateMembers',
|
||||
'MentionEveryone',
|
||||
'MuteMembers',
|
||||
'SendMessages',
|
||||
'SendMessagesInThreads',
|
||||
'ReadMessageHistory',
|
||||
],
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
if (process.env.NODE_ENV !== 'development')
|
||||
|
@ -71,6 +73,9 @@ client.once('ready', async () => {
|
|||
});
|
||||
|
||||
client.on('messageCreate', async (e) => {
|
||||
if (e.channel.partial) await e.channel.fetch();
|
||||
if (e.author.partial) await e.author.fetch();
|
||||
|
||||
if (!e.content) return;
|
||||
if (!e.channel.isTextBased()) return;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ export const getTags = async (): Promise<Tag[]> => {
|
|||
name: _file.replace('.md', ''),
|
||||
embed: {
|
||||
...data.embed,
|
||||
description: content,
|
||||
description: content.trim(),
|
||||
color: COLORS[data.embed.color],
|
||||
},
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ export const getTags = async (): Promise<Tag[]> => {
|
|||
tags.push({
|
||||
...data,
|
||||
name: _file.replace('.md', ''),
|
||||
text: content,
|
||||
text: content.trim(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue