Skip to content

Commit

Permalink
UltroidCli init
Browse files Browse the repository at this point in the history
  • Loading branch information
iAkashPattnaik committed Aug 11, 2021
0 parents commit ec883de
Show file tree
Hide file tree
Showing 15 changed files with 1,096 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Files and directories created by pub.
.dart_tool/
.packages

# Conventional directory for build output.
build/

# Cuntom files and directories
pubspec.lock
bin/ultroid_cli.exe
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<h1 align="center" style="color: green;font-weight: bold;">UltroidCli</h1>
<br>

Welcome to the [`UltroidCli`](https://github.com/BLUE-DEVIL1134/UltroidCli) project built for [`The Ultroid`](https://github.com/TeamUltroid/Ultroid).
<br>
This Project is actively maintained by [`Akash Pattnaik`](https://github.com/BLUE-DEVIL1134).
<br>
All kinds of contributions are reviewed and accepted.


# What Is `UltroidCli` ?
Well, we allknow that `The Ultroid` is currently the best / largest Telegram Userbot Present.

So, as a former developer at `TeamUltroid`, I wanted to do something _out of the box_ to take `Ultroid` to the next level.


# How To Use `UltroidCLi` ?
It's simple. Just download the latest build from the `Github Releases` and open a terminal in the download directory.

Now, According to your OS, run the following command:

Here, `DownloadPath` is the path where you have downloaded the `UltroidCli` build.
For example -

✔️ `DownloadPath` - `~\Downloads\`
<br>
`DownloadPath` - `~\Downloads\ultroid.exe`
### Windows
```powershell
SET PATH=%PATH%;DownloadPath
```
### Linux
```bash
export PATH=$PATH:/DownloadPath
```
### MacOS
```bash
Well, idk
I am a smol dev, I don't hab MacOS
```
Now, you can run the `UltroidCli` by typing `ultroid` in the terminal.
# Contributions
To contribute to this project, just fork it, make commits and make a pull request.
16 changes: 16 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Defines a default set of lint rules enforced for projects at Google. For
# details and rationale, see
# https://github.com/dart-lang/pedantic#enabled-lints.

include: package:pedantic/analysis_options.yaml

# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.

# Uncomment to specify additional rules.
# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**
62 changes: 62 additions & 0 deletions bin/ultroid_cli.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

import 'package:ultroid_cli/main.dart';
import 'dart:io';

void main(List<String> arguments) async {
stdout.write('\x1B[2J\x1B[0;0H');
ultroidCliVersion();
var query = 'help';
var temp = 'help';
try {
query = arguments[0].toLowerCase();
} catch (error) {
query = 'help';
}
for (var i in ['help', '-h', '--help', '-v', 'version', 'run', 'upgrade', 'init', 'delete']) {
if (i != query.toLowerCase()) {
temp = 'help';
} else {
temp = i;
break;
}
}
query = temp;

switch (query) {
case '--help':
printHelp();
break;
case '-h':
printHelp();
break;
case 'help':
printHelp();
break;
case 'version':
version();
break;
case '-v':
version();
break;
case 'init':
init();
break;
case 'upgrade':
upgradeUltoid();
break;
case 'run':
runUltroid();
break;
case 'delete':
deleteUltroid();
break;
default:
printHelp();
}
}
Binary file added icon.ico
Binary file not shown.
25 changes: 25 additions & 0 deletions lib/delete.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

import 'package:colorize/colorize.dart';
import 'dart:io';

// Ultroid
import 'package:ultroid_cli/version.dart';

void deleteUltroid() async {
final rootDirectory = Directory('./TeamUltroid');
if (!rootDirectory.existsSync()) {
print(Colorize('Ultroid at [ ${Colorize("root://TeamUltroid").lightMagenta()} ] dosen\'t exists !').cyan());
} else {
print(Colorize('Removing Ultroid at [ ${Colorize("root://TeamUltroid").lightMagenta()} ]').cyan());
rootDirectory.deleteSync(recursive: true);
print(Colorize('Succesfully Removed Ultroid at [ ${Colorize("root://TeamUltroid").lightMagenta()} ]').cyan());
}
version();
print(Colorize('To Install Ultroid, Use The Command [ ultroid init ]').lightGreen());
}
35 changes: 35 additions & 0 deletions lib/help.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

import 'package:colorize/colorize.dart';

void printHelp() {
print(
'Manage Ultroid with UltroidCli\n'
'\n'
'Common commands:\n'
' ${Colorize("ultroid run").cyan()}\n'
' Run Ultroid Instantly.\n'
' ${Colorize("ultroid upgrade").cyan()}\n'
' Upgrade Ultroid Without Starting It.\n'
'\n'
'Usage: ironeye <command> [optional-arguments]\n'
'Global options:\n'
' ${Colorize("-h, --help Print this usage information.").cyan()}\n'
' ${Colorize("-v, version Print the required and current Python version.").cyan()}\n'
'\n'
'Available commands:\n'
' ${Colorize("init : ").cyan()}Install Ultroid To root://TeamUltroid.\n'
' ${Colorize("run : ").cyan()}Run Ultroid instantly.\n'
' ${Colorize("upgrade : ").cyan()}Upgrade Ultroid to latest version.\n'
' ${Colorize("-h, help : ").cyan()}Print this usage information.\n'
' ${Colorize("-v, version: ").cyan()}Print the version of all required dependencies.\n'
'\n'
'[ ${Colorize("Warning").green()} ]\n'
'Run \"${Colorize("ultroid delete").red()}\" only when advised by \"t.me/xditya\"\n'
);
}
60 changes: 60 additions & 0 deletions lib/init.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'package:colorize/colorize.dart';
import 'dart:io';

// Ultroid
import 'package:ultroid_cli/version.dart';
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

void init() async {
final rootDirectory = Directory('./TeamUltroid');
if (!rootDirectory.existsSync()) {
print(Colorize('Installing Ultroid to [ ${Colorize("root://TeamUltroid").lightMagenta()} ]').cyan());
await Process.run('git', ['clone', 'https://github.com/TeamUltroid/Ultroid', 'TeamUltroid'], runInShell: true);
print(
"${Colorize('Successfully Installed Ultroid to [ ').cyan()}"
"${Colorize('root://TeamUltroid/').lightMagenta()}"
"${Colorize(' ]').cyan()}"
);
print(
"${Colorize('Installing Ultroid Dependencies [ ').cyan()}"
"${Colorize('root://TeamUltroid/requirements.txt').lightMagenta()}"
"${Colorize(' ]').cyan()}"
);
await Process.run(
'pip', ['install', '-r', '-U', 'requirements.txt'],
runInShell: true,
workingDirectory: rootDirectory.absolute.uri.toFilePath()
);
for (var eachRequirement in [
'fonttools',
'covid',
'gtts',
'pokedex.py',
'pyshorteners',
'pyfiglet',
'pyjokes',
'quotefancy',
'wikipedia',
'textblob',
'lyrics_extractor==3.0.1',
]) {
await Process.run(
'pip', ['install', '-U', eachRequirement],
runInShell: true,
workingDirectory: rootDirectory.absolute.uri.toFilePath()
);
}
print(
"${Colorize('Successfully Installed Ultroid Dependencies [ ').cyan()}"
"${Colorize('root://TeamUltroid/requirements.txt').lightMagenta()}"
"${Colorize(' ]').cyan()}"
);
}
version();
print(Colorize('To Run Ultroid, Use The Command [ ultroid run ]').lightGreen());
}
35 changes: 35 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

library ultroid_cli;

import 'package:colorize/colorize.dart';
import 'package:http/http.dart';

// Ultroid
export 'package:ultroid_cli/help.dart';
export 'package:ultroid_cli/init.dart';
export 'package:ultroid_cli/version.dart';
export 'package:ultroid_cli/run.dart';
export 'package:ultroid_cli/upgrade.dart';
export 'package:ultroid_cli/delete.dart';


void ultroidCliVersion() async {
var req = await get(
Uri.parse('https://raw.githubusercontent.com/BLUE-DEVIL1134/UltroidCli/main/version.txt'),
);
if (req.body.trim() != '1.0.0') {
print(
" ${Colorize('╔══════════════════════════════════════════════════════════════════════════╗').cyan()}\n"
" ${Colorize('║').cyan()} A new version of UltroidCli is available! ${Colorize('║').cyan()}\n"
" ${Colorize('║').cyan()} ${Colorize('║').cyan()}\n"
" ${Colorize('║').cyan()} Please download the lastest release. ${Colorize('║').cyan()}\n"
" ${Colorize('╚══════════════════════════════════════════════════════════════════════════╝').cyan()}"
);
}
}
32 changes: 32 additions & 0 deletions lib/run.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

import 'package:colorize/colorize.dart';
import 'dart:io';

void runUltroid() async {
final rootDirectory = Directory('./TeamUltroid');
if (!rootDirectory.existsSync()) {
print(
"[ ${Colorize('root://TeamUltroid').lightMagenta()} ] does not exists.\n"
"Run [ ${Colorize('ultroid init').lightGreen()} ] first to install the repository and dependencies."
);
exit(1);
}
if (!File('./TeamUltroid/.env').existsSync()) {
print(
Colorize("Please create the file [ ${Colorize('root://TeamUltroid/.env').lightMagenta()} ]")
);
exit(1);
}
await Process.start(
'python', ['-m', 'pyUltroid'],
runInShell: true,
workingDirectory: rootDirectory.absolute.uri.toFilePath(),
mode: ProcessStartMode.inheritStdio,
);
}
49 changes: 49 additions & 0 deletions lib/upgrade.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// UltroidCli
// Copyright (C) 2021 Akash Pattnaik
//
// This file is a part of < https://github.com/BLUE-DEVIL1134/UltroidCli/ >
// PLease read the GNU Affero General Public License in
// <https://www.github.com/BLUE-DEVIL1134/UltroidCli/blob/main/LICENSE/>.

import 'package:colorize/colorize.dart';
import 'dart:io';

// Ultroid
import 'package:ultroid_cli/version.dart';

void upgradeUltoid() async {
final rootDirectory = Directory('./TeamUltroid');
if (!rootDirectory.existsSync()) {
print(
"[ ${Colorize('root://TeamUltroid').lightMagenta()} ] does not exists.\n"
"Run [ ${Colorize('ultroid init').lightGreen()} ] first to install the repository and dependencies."
);
exit(1);
}
await rootDirectory.delete(recursive: true);
print(Colorize('Installing Upgraded Ultroid to [ ').cyan().toString() + Colorize('root://TeamUltroid').lightMagenta().toString() + Colorize(' ]').cyan().toString());
await Process.run('git', ['clone', 'https://github.com/TeamUltroid/Ultroid', 'TeamUltroid'], runInShell: true);
print(
"${Colorize('Installing Ultroid Dependencies [ ').cyan()}"
"${Colorize('root://TeamUltroid/requirements.txt, root://TeamUltroid/package.json').lightMagenta()}"
"${Colorize(' ]').cyan()}"
);
await Process.run(
'pip', ['install', '-r', '-U', 'requirements.txt'],
runInShell: true,
workingDirectory: rootDirectory.absolute.uri.toFilePath()
);
await Process.run(
'npm', ['install'],
runInShell: true,
workingDirectory: rootDirectory.absolute.uri.toFilePath()
);
print(
"${Colorize('Successfully Installed Ultroid Dependencies [ ').cyan()}"
"${Colorize('root://TeamUltroid/requirements.txt, root://TeamUltroid/package.json').lightMagenta()}"
"${Colorize(' ]').cyan()}"
);
print("Running [ ${Colorize('ultroid version').lightMagenta()} ]\n");
version();
print(Colorize('To Run Ultroid, Use The Command [ ultroid run ]').lightGreen());
}
Loading

0 comments on commit ec883de

Please sign in to comment.