Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
بعض الإصلاحات + تغير اسم التطبيق
Browse files Browse the repository at this point in the history
  • Loading branch information
islamiaat committed Apr 28, 2022
1 parent 6c7e402 commit 811863c
Show file tree
Hide file tree
Showing 26 changed files with 424 additions and 424 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
<br><br>

<p align="center">
<a href="https://snapcraft.io/islam-bot">
<a href="https://snapcraft.io/islam_bot">
<img alt="احصل عليه من Snap Store" src="https://snapcraft.io/static/images/badges/ar/snap-store-black.svg"/>
</a>

```bash

sudo snap install islam-bot
sudo snap install islam_bot

```
</p>
Expand Down
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const createWindow = () => {
center: true,
resizable: false, // قابل لتكبير والتصغير
frame: false, // ايطار البرنامج
title: 'islam-bot',
title: 'islam_bot',
icon: path.join(Path_Local, '/build/icons/icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js')
Expand All @@ -45,13 +45,13 @@ const createWindow = () => {
event.preventDefault();


if (fs.existsSync(path.join(Path_appDate, '/islam-bot/Settings.json'))) {
if (fs.existsSync(path.join(Path_appDate, '/islam_bot/Settings.json'))) {

let Settings = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Settings.json'));
let Settings = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Settings.json'));
if (Settings.start === true) {

let data = Object.assign({}, Settings, { start: false })
fs.writeJSONSync(path.join(Path_appDate, '/islam-bot/Settings.json'), data, { spaces: '\t' })
fs.writeJSONSync(path.join(Path_appDate, '/islam_bot/Settings.json'), data, { spaces: '\t' })

}
}
Expand All @@ -78,7 +78,7 @@ const createWindow = () => {
]);
tray = new Tray(path.join(Path_Local, '/build/icons/icon.png'));
tray.setContextMenu(trayMenu);
tray.setToolTip("islam-bot");
tray.setToolTip("islam_bot");
tray.on('click', () => {
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show()
});
Expand All @@ -97,9 +97,9 @@ app.whenReady().then(async () => {

}

if (fs.existsSync(path.join(Path_appDate, '/islam-bot/Settings.json'))) {
if (fs.existsSync(path.join(Path_appDate, '/islam_bot/Settings.json'))) {

let Settings = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Settings.json'));
let Settings = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Settings.json'));

if (Settings.start === true && Settings.off_on === 'on') {

Expand All @@ -111,14 +111,14 @@ app.whenReady().then(async () => {

setInterval(async () => {

if (fs.existsSync(path.join(Path_appDate, '/islam-bot/Settings.json'))) {
if (fs.existsSync(path.join(Path_appDate, '/islam_bot/Settings.json'))) {

let Settings = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Settings.json'));
let Settings = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Settings.json'));
if (Settings.start === false && Settings.off_on === 'on') {

islam_bot(app.getPath("appData"), Path_Local, Notification);
let data = Object.assign({}, Settings, { start: true })
fs.writeJSONSync(path.join(Path_appDate, '/islam-bot/Settings.json'), data, { spaces: '\t' });
fs.writeJSONSync(path.join(Path_appDate, '/islam_bot/Settings.json'), data, { spaces: '\t' });

}
}
Expand Down
14 changes: 7 additions & 7 deletions src/Telegram/Error.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');

module.exports = async function Error(error, Path_appDate) {

let json = fs.readJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'));
let json = fs.readJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'));

if (error.response !== undefined) {

Expand All @@ -16,7 +16,7 @@ module.exports = async function Error(error, Path_appDate) {
[id_new]: json[id_old]
})[id_old]
json[id_new].id = id_new
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json, { spaces: '\t' });
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json, { spaces: '\t' });

}

Expand All @@ -25,7 +25,7 @@ module.exports = async function Error(error, Path_appDate) {
let id_user = error.on.payload.chat_id

delete json[id_user]
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json, { spaces: '\t' });
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json, { spaces: '\t' });

}

Expand All @@ -34,7 +34,7 @@ module.exports = async function Error(error, Path_appDate) {
let id_user = error.on.payload.chat_id

delete json[id_user]
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json, { spaces: '\t' });
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json, { spaces: '\t' });

}

Expand All @@ -43,7 +43,7 @@ module.exports = async function Error(error, Path_appDate) {
let id_user = error.on.payload.chat_id

delete json[id_user]
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json, { spaces: '\t' });
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json, { spaces: '\t' });

}

Expand All @@ -52,7 +52,7 @@ module.exports = async function Error(error, Path_appDate) {
let id_user = error.on.payload.chat_id

delete json[id_user]
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json, { spaces: '\t' });
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json, { spaces: '\t' });

}

Expand All @@ -61,7 +61,7 @@ module.exports = async function Error(error, Path_appDate) {
let id_user = error.on.payload.chat_id

delete json[id_user]
fs.writeJsonSync(join(Path_appDate, '/islam-bot/Users.json'), json, { spaces: '\t' });
fs.writeJsonSync(join(Path_appDate, '/islam_bot/Users.json'), json, { spaces: '\t' });

}

Expand Down
10 changes: 5 additions & 5 deletions src/Telegram/Save_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ module.exports = async function Save_db(id, username, first_name, type, Path_app

try {

if (fs.existsSync(path.join(Path_appDate, '/islam-bot/Users.json')) === false) {
if (fs.existsSync(path.join(Path_appDate, '/islam_bot/Users.json')) === false) {

fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), {});
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), {});


}

else if (fs.existsSync(path.join(Path_appDate, '/islam-bot/Users.json'))) {
else if (fs.existsSync(path.join(Path_appDate, '/islam_bot/Users.json'))) {

let json = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Users.json'));
let json = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Users.json'));

if (Object.keys(json).includes(id.toString()) === false) {

Expand All @@ -31,7 +31,7 @@ module.exports = async function Save_db(id, username, first_name, type, Path_app
}


fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), Object.assign({}, json, db));
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), Object.assign({}, json, db));

}

Expand Down
2 changes: 1 addition & 1 deletion src/Telegram/broadcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = async function broadcast(bot, Path_appDate, Path_Local) {
const photo = fs.readJSONSync(path.join(Path_Local, '/src/Telegram/button/Photo_Json.json'));
const video = fs.readJSONSync(path.join(Path_Local, '/src/Telegram/button/Video_json.json'));
const QuranJson = fs.readJSONSync(path.join(Path_Local, '/src/Telegram/button/Quran.json'));
const json = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Users.json'));
const json = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Users.json'));
const user = Object.keys(json);
const me = await bot.telegram.getMe();

Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/button/Lectures.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module.exports = async function Lectures(bot, Path_appDate, Markup, Path_Local)
let id = ctx.chat.id;
let Lectures_json = fs.readJSONSync(path.join(Path_Local, '/src/Telegram/button/Lectures.json'));
let random = Lectures_json[Math.floor(Math.random() * Lectures_json.length)]
let json = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Users.json'));
let json = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Users.json'));
json[id].message_id !== undefined ? ctx.deleteMessage(json[id].message_id) : ''
let but_1 = [Markup.button.callback('🔄', 'Lectures'), Markup.button.callback('الرجوع', 'start')];
let button = Markup.inlineKeyboard([but_1]);
let caption = `<b>▪${random.Lectures}</b>\n\n`
caption += `${random.Author ? `\n\n<b>الشيخ:</b> ${random.Author} 🔊` : ''}`
let { message_id } = await ctx.replyWithVideo({ url: random.FilePath }, { caption: caption, reply_markup: button.reply_markup , parse_mode: 'HTML' });
json[id].message_id = message_id
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json);
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json);


});
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/button/Names_Of_Allah.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module.exports = async function Names_Of_Allah(bot, Path_appDate, Markup, Path_L
let id = ctx.chat.id;
let Names_Of_Allah_json = fs.readJSONSync(path.join(Path_Local, '/src/Telegram/button/Names_Of_Allah.json'));
let random = Names_Of_Allah_json[Math.floor(Math.random() * Names_Of_Allah_json.length)]
let json = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Users.json'));
let json = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Users.json'));
json[id].message_id !== undefined ? ctx.deleteMessage(json[id].message_id) : ''
let message = `<b>الإسم: ${random.name}</b>\n\n`
message += `المعنى: ${random.text}\n\n`
let but_1 = [Markup.button.callback('🔄', 'Names_Of_Allah'), Markup.button.callback('الرجوع للقائمة الرئيسية', 'start')];
let button = Markup.inlineKeyboard([but_1]);
let { message_id } = await ctx.reply(message, { reply_markup: button.reply_markup , parse_mode: 'HTML' })
json[id].message_id = message_id
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json);
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json);


});
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/button/Quran.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = async function quran(bot, Path_appDate, Markup) {
bot.action('quran', async (ctx) => {

let id = ctx.chat.id;
let json = fs.readJSONSync(path.join(Path_appDate, '/islam-bot/Users.json'));
let json = fs.readJSONSync(path.join(Path_appDate, '/islam_bot/Users.json'));
json[id].message_id !== undefined ? ctx.deleteMessage(json[id].message_id) : ''
let quran_menu = 'قم بإختيار القارئ 🔊 \n\n'
quran_menu += '1- أدريس أبكر \n'
Expand All @@ -28,7 +28,7 @@ module.exports = async function quran(bot, Path_appDate, Markup) {
let button = Markup.inlineKeyboard([but_1, but_2, but_3, but_4, but_5, but_6]);
let { message_id } = await ctx.reply(quran_menu, button);
json[id].message_id = message_id
fs.writeJsonSync(path.join(Path_appDate, '/islam-bot/Users.json'), json);
fs.writeJsonSync(path.join(Path_appDate, '/islam_bot/Users.json'), json);


});
Expand Down
Loading

0 comments on commit 811863c

Please sign in to comment.