Untitled

 avatar
unknown
plain_text
2 years ago
2.7 kB
28
Indexable
> This can donate to either blog, wiki or chat.
> `Object link >>> line 15`
> `Community_id >>> line 16`
> `Email/password >>> line 17`
> Lines 39, 40 and 41 are to choose between blog, wiki or chat.
```python
from pymino import Bot
from pymino.ext import *
from random import choice

try:
    from alive_progress import alive_bar
    from colorama import Fore
    from pyfiglet import figlet_format
    from colored import attr
except ModuleNotFoundError:
    from os import system
    system("pip install alive-progress colorama pyfiglet colored")
    exit()

objectLink = ""                 # Enter the link to the object you want to send coins to here.
bot = Bot(community_id=None)    # Enter the community ID here.
bot.run(email="", password="")  # Enter your email and password here.

def random_color(text : List[str]) -> str:
    raw_colors = vars(Fore)
    excluded_colors = ["BLACK", "WHITE", "LIGHTBACK_EX", "RESET"]
    colors = [raw_colors[x] for x in raw_colors if x not in excluded_colors]
    return ''.join([f"{choice(colors)}{x}" for x in text])

def print_banner(totalCoins: str) -> None:
    figlet_text = figlet_format("COIN TRANSFER", font="smslant")
    banner_text = random_color(figlet_text)
    version = random_color([f'Coin balance: {totalCoins}', ' '*16, "github.com/forevercynical"])
    top = random_color("┄"*65)
    bottom = random_color("┄"*65)
    mid = "#"*65

    print(top, mid, banner_text, mid, bottom, version, sep="\n")
    print(attr('reset'))

def send_coins(amount: int, objectId: str, bar: alive_bar) -> None:
    if bot.community.send_coins(
        coins=amount,
        blogId=objectId,    # This sends coins to a blog.
        wikiId=None,        # This sends coins to a wiki.
        chatId=None         # This sends coins to a chat.
        ).message =="OK":
        print("Coins sent successfully!")
    else:
        print("Failed to send coins!")

    return bar()

def main_function():
    print_banner(int(bot.account.fetch_wallet().totalCoins))
    try:
        amountOfCoins = int(input("How many coins do you want to send? "))
    except ValueError as e:
        raise ValueError("You must enter a number! e.g. 1000") from e
    objectId = bot.community.fetch_object_id(link=objectLink)
    progressBar = amountOfCoins // 500
    if amountOfCoins % 500 > 0: progressBar += 1
    with alive_bar(progressBar, dual_line=True, theme="smooth") as bar:
        for _ in range(amountOfCoins // 500):
            send_coins(amount=500, objectId=objectId, bar=bar)
        if amountOfCoins % 500 > 0:
            send_coins(amount=amountOfCoins % 500, objectId=objectId, bar=bar)

    print(f"Your new coin balance is {int(bot.account.fetch_wallet().totalCoins)} coins.")

main_function()
```
Editor is loading...
Leave a Comment