suhas 1 year ago
parent 54d0aa98e3
commit 1fffefa961

@ -10,7 +10,8 @@ import {
Message,
GuildMember,
TextChannel,
EmbedBuilder
EmbedBuilder,
messageLink
} from 'discord.js'
const client = new Client({ intents: [131071] })
@ -45,80 +46,13 @@ creator
client.once('ready', async () => console.log('ready!'))
client.on(Events.GuildCreate, async (g: Guild) => {
await prisma.guildConfig.create({
data: {
id: g.id
client.on(Events.MessageCreate, async (msg: Message) => {
if (msg.channel.id == '1164025412574265364' && !msg.content.startsWith('e')) {
const m = await msg.channel.send(`<@${msg.author.id}> e`)
await msg.delete()
await new Promise((r) => setTimeout(r, 2000))
await m.delete()
}
})
})
// client.on(Events.MessageCreate, async (msg: Message) => {
// if (!msg.guild || msg.author == client.user) return
// const u = await prisma.user.findFirst({
// where: {
// guild_id: msg.guild.id,
// id: msg.author.id
// }
// })
// if (!u) {
// await prisma.user.create({
// data: {
// guild_id: msg.guild.id,
// id: msg.author.id,
// messages: 1
// }
// })
// return
// }
// const newMessagesCount = (u.messages ?? 0) + 1
// await prisma.user.update({
// where: {
// id_guild_id: { id: msg.author.id, guild_id: msg.guild.id }
// },
// data: {
// messages: newMessagesCount
// }
// })
// })
// client.on(Events.GuildMemberAdd, async (m: GuildMember) => {
// const gc = await prisma.guildConfig.findFirst({
// where: {
// id: m.guild.id
// }
// })
// if (gc.welcome_on) {
// const ch = (await m.guild.channels.fetch(gc.welcome_channel)) as TextChannel
// const me = new EmbedBuilder({
// title: 'Welcome!',
// description: gc.welcome_message.replace('%USER%', `<@${m.id}>`),
// footer: {
// text: `member #${m.guild.memberCount}`,
// icon_url: 'https://www.giantfreakinrobot.com/wp-content/uploads/2022/08/rick-astley.jpg'
// },
// color: 0x7289da
// })
// await ch.send({ content: `<@${m.id}>`, embeds: [me] })
// }
// })
// setInterval(async () => {
// const now = new Date()
// const messages = await prisma.dailyMessage.findMany({
// where: {
// hour: now.getUTCHours(),
// minute: now.getUTCMinutes()
// }
// })
// for (const m of messages) {
// const g = client.guilds.cache.get(m.guild_id)
// if (!g) continue
// const ch = (await g.channels.fetch(m.channel)) as TextChannel
// await ch.send(m.text)
// }
// }, 1000 * 60)
client.login(process.env.TOKEN)

Loading…
Cancel
Save