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 0856dcb commit a5f1ff6
Show file tree
Hide file tree
Showing 28 changed files with 456 additions and 500 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@

## تنزيل التطبيق

<br><br>

<p align="center">
<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

```
</p>

- **Linux**: [Download the .AppImage, .deb, or .rpm file](https://github.com/rn0x/islam_bot/releases/latest)
- **Windows**: [Download the .exe file](https://github.com/rn0x/islam_bot/releases/latest)

Expand Down
22 changes: 11 additions & 11 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 Expand Up @@ -159,6 +159,6 @@ app.on('window-all-closed', () => {

app.setLoginItemSettings({
openAtLogin: true,
path: path.join(process.resourcesPath, '../Islam_Bot.exe'),
path: path.join(process.resourcesPath, '../islam-bot.exe'),
args: ['--hidden']
})
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "islam_bot",
"version": "1.0.6",
"name": "islam-bot",
"version": "1.0.7",
"homepage": "https://github.com/rn0x",
"description": "Islam_Bot - publishes adhkar and the Qur’an ..",
"description": "islam-bot - publishes adhkar and the Qur’an ..",
"main": "index.js",
"type": "commonjs",
"author": {
Expand Down Expand Up @@ -31,9 +31,9 @@
"telegraf": "^4.7.0"
},
"build": {
"productName": "Islam_Bot",
"productName": "islam-bot",
"appId": "org.IslamBot.rn0x",
"copyright": "Copyright © 2022 Islam_Bot",
"copyright": "Copyright © 2022 islam-bot",
"extraFiles": [
{
"from": "./",
Expand Down Expand Up @@ -75,8 +75,8 @@
"installerIcon": "build/icon.ico",
"uninstallerIcon": "build/icon.ico",
"license": "build/LICENSE.txt",
"shortcutName": "Islam_Bot",
"uninstallDisplayName": "Islam_Bot",
"shortcutName": "islam-bot",
"uninstallDisplayName": "islam-bot",
"installerSidebar": "build/installerSidebar.bmp",
"uninstallerSidebar": "build/installerSidebar.bmp",
"installerHeader": "build/installerHeader.bmp"
Expand All @@ -85,13 +85,13 @@
"category": "Education",
"icon": "build/icons/icon.icns",
"vendor": "Ryan Almalki",
"executableName": "Islam_Bot",
"description": "Islam_Bot - publishes adhkar and the Qur’an ..",
"description": "islam-bot - publishes adhkar and the Qur’an ..",
"synopsis": "publishes adhkar and the Qur’an",
"target": [
"AppImage",
"deb",
"rpm"
"rpm",
"snap"
]
},
"directories": {
Expand Down
20 changes: 14 additions & 6 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,10 +52,18 @@ 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' });

}

else if (error.response.description === "Forbidden: bot was kicked from the supergroup chat") {

let id_user = error.on.payload.chat_id

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

}

}

Expand Down
12 changes: 6 additions & 6 deletions src/Telegram/Save_db.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const fs = require('fs-extra');
const path = require('path');

module.exports = async function Save_db(id, first_name, username, type, Path_appDate) {
module.exports = async function Save_db(id, username, first_name, type, Path_appDate) {

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, first_name, username, 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 a5f1ff6

Please sign in to comment.