remove user function
This commit is contained in:
parent
1239481d4a
commit
a1388ca881
@ -18,15 +18,7 @@ export type Command = {
|
||||
|
||||
const commands = new Collection<string, Command>()
|
||||
|
||||
commands.set(syncUsers.data.name, syncUsers)
|
||||
commands.set(Alert.data.name, Alert)
|
||||
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)
|
||||
commands.set(UserMessage.data.name, UserMessage)
|
||||
commands.set(Link.data.name, Link)
|
||||
commands.set(RemoveLink.data.name, RemoveLink)
|
||||
|
||||
export default commands
|
||||
|
@ -35,50 +35,9 @@ export default class ChatController {
|
||||
}
|
||||
|
||||
try {
|
||||
const ch = await global.client.channels.fetch(config.chatChannelId)
|
||||
|
||||
const t = global.config.messageTime
|
||||
const time = (t / 3600 / 24).toString()
|
||||
const { data, status } = await axios.get<MessageI[]>(
|
||||
`${process.env.ECO_API_BASE || "https://eco.kamgames.xyz"}/api/v1/chat?startDay=${time}`, {
|
||||
timeout: 5000,
|
||||
headers: {
|
||||
"X-API-Key": process.env.ECO_API_KEY
|
||||
}
|
||||
});
|
||||
|
||||
if (status !== 200) {
|
||||
isSyncing = false
|
||||
return false
|
||||
}
|
||||
|
||||
if (data.length === 0) {
|
||||
isSyncing = false
|
||||
return true
|
||||
}
|
||||
|
||||
const messages = data
|
||||
|
||||
|
||||
if (!ch || !ch.isTextBased()) {
|
||||
isSyncing = false
|
||||
return false
|
||||
}
|
||||
|
||||
messages.forEach(async m => {
|
||||
if (["Общий", "General"].indexOf(m.Receiver) > -1 && m.Receiver !== global.config.inGameChat)
|
||||
global.config.inGameChat = m.Receiver
|
||||
|
||||
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] })
|
||||
await ch.send(`**${m.Sender}**: ${m.Text}`)
|
||||
}
|
||||
})
|
||||
|
||||
isSyncing = false
|
||||
|
@ -3,22 +3,6 @@ import UserI from "../types/UserI";
|
||||
|
||||
export default class UserController {
|
||||
public async sync() {
|
||||
try {
|
||||
const { data, status } = await axios.get<UserI[]>(`${process.env.ECO_API_BASE || "https://eco.kamgames.xyz"}/api/v1/users`, {
|
||||
timeout: 5000,
|
||||
headers: {
|
||||
"X-API-Key": process.env.ECO_API_KEY
|
||||
}
|
||||
});
|
||||
|
||||
if (status !== 200) return false
|
||||
|
||||
global.config.usersInGame = data
|
||||
|
||||
return true
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
@ -95,11 +95,6 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
try {
|
||||
await command.execute(interaction);
|
||||
} catch (error) {
|
||||
// console.log(`Error executing ${interaction.commandName}`);
|
||||
// console.log(error);
|
||||
// if (!interaction.deferred) {
|
||||
// await interaction.deferReply({ ephemeral: true })
|
||||
// }
|
||||
if (!interaction.replied && !interaction.deferred)
|
||||
await interaction.reply({ content: "Ошибка выполнения", ephemeral: true })
|
||||
else if (interaction.replied || interaction.deferred)
|
||||
|
Loading…
x
Reference in New Issue
Block a user