const express = require('express');
const { Client, GatewayIntentBits } = require('discord.js');
const app = express();
const port = 3000;
// إعداد البوت
const botToken = 'YOUR_BOT_TOKEN';
const guildId = 'YOUR_GUILD_ID';
const channelId = 'YOUR_CHANNEL_ID';
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
client.login(botToken);
// قائمة الجمل العشوائية
const sentences = [
"الجملة الأولى",
"الجملة الثانية",
"الجملة الثالثة",
"الجملة الرابعة",
"الجملة الخامسة"
];
// وظيفة لاختيار جملة عشوائية من القائمة
function getRandomSentence() {
return sentences[Math.floor(Math.random() * sentences.length)];
}
app.get('/send-message', async (req, res) => {
const sentence = getRandomSentence();
try {
const guild = await client.guilds.fetch(guildId);
const channel = await guild.channels.cache.get(channelId);
await channel.send(sentence);
res.send('Message sent successfully');
} catch (error) {
console.error(error);
res.status(500).send('Error sending message');
}
});
app.listen(port, () => {
console.log(`Server is running at http://localhost:${port}`);
});