small fixes and add chat timestamp thrw command
This commit is contained in:
parent
9567a875f1
commit
fddedac210
@ -5,6 +5,7 @@ import Message from './Message'
|
||||
import Exec from './Exec'
|
||||
import syncMessages from './syncMessages'
|
||||
import setChatChannelId from './setChatChannelId'
|
||||
import throwChatTimestamp from './throwChatTimestamp'
|
||||
|
||||
const commands = new Collection
|
||||
|
||||
@ -14,5 +15,6 @@ commands.set(Message.data.name, Message)
|
||||
commands.set(Exec.data.name, Exec)
|
||||
commands.set(syncMessages.data.name, syncMessages)
|
||||
commands.set(setChatChannelId.data.name, setChatChannelId)
|
||||
commands.set(throwChatTimestamp.data.name, throwChatTimestamp)
|
||||
|
||||
export default commands
|
||||
|
27
src/commands/throwChatTimestamp.ts
Normal file
27
src/commands/throwChatTimestamp.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { CacheType, ChatInputCommandInteraction, Message, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
||||
import ConfigManager from '../controller/ConfigManager';
|
||||
import ChatController from '../controller/ChatController';
|
||||
import { error } from 'console';
|
||||
|
||||
// const adminPermissions = new PermissionsBitField('Administrator');
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('throw_chat_timestamp')
|
||||
.setDescription('throw chat timestamp')
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
async execute(interaction: ChatInputCommandInteraction<CacheType>, config: ConfigManager) {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
try {
|
||||
global.config.messageTime = 0
|
||||
|
||||
await interaction.followUp("Время сброшено")
|
||||
return
|
||||
} catch (error) {
|
||||
await interaction.editReply("Ошибка сброса времени")
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
};
|
@ -70,14 +70,15 @@ export default class ChatController {
|
||||
}
|
||||
|
||||
messages.forEach(async m => {
|
||||
if (global.config.messageTime !== m.Timestamp) {
|
||||
if (global.config.messageTime < m.Timestamp)
|
||||
global.config.messageTime = m.Timestamp
|
||||
// const me = new EmbedBuilder()
|
||||
// me.setDescription(m.Text)
|
||||
// me.setAuthor({ name: m.Sender })
|
||||
// ch.send({ embeds: [me] })
|
||||
console.log(`${m.Sender}: ${m.Text}`)
|
||||
await ch.send(`**${m.Sender}**: ${m.Text}`)
|
||||
}
|
||||
})
|
||||
|
||||
isSyncing = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user