TBC LIBS
1. Resources Lib
Description: Handles user and global resources for managing data values associated with users or global settings.
Classes:
userRes(name, user=None): Manages resources associated with individual users.
Arguments:
name
(required, str): Name of the resource.user
(optional, str): Unique identifier for the user.
Methods:
value(): Retrieves the value of the resource.
add(value): Adds a specified value to the resource.
cut(value): Deducts a specified value from the resource.
set(value): Sets the resource to a specific value.
reset(): Resets the resource value to zero.
globalRes(name): Manages global resources that apply across all users.
Arguments:
name
(required, str): Name of the resource.
Methods:
value(): Retrieves the global resource value.
add(value): Adds a specified value to the global resource.
cut(value): Deducts a specified value from the global resource.
reset(): Resets the global resource to zero.
2. Webhook Lib
Description: Generates unique URLs for webhook integrations.
Functions:
genRandomId(): Generates an 8-character random ID.
Usage:
**getUrlFor(command, user_id=None, chat_id=None, options): Generates a webhook URL based on the command and optional parameters.
Arguments:
command
(required, str): Command to be executed.user_id
(optional, str): User ID.chat_id
(optional, str): Chat ID.
Usage:
3. Coinbase Lib
Description: Handles Coinbase API interactions for managing keys and generating API clients.
Functions:
setKeys(ApiKey, Secret): Sets API key and secret for Coinbase.
Arguments:
ApiKey
(required, str): Coinbase API key.Secret
(required, str): Coinbase API secret.
Usage:
post(ApiKey=None, Secret=None): Returns a Coinbase client instance.
Arguments:
ApiKey
(optional, str): Coinbase API key (optional if previously set).Secret
(optional, str): Coinbase API secret (optional if previously set).
Usage:
4. CSV Lib
Description: Manages CSV file creation, row manipulation, and retrieval.
Class:
CSVHandler(filename): Initializes a handler for a specific CSV file.
Arguments:
filename
(required, str): Name of the CSV file.
Methods:
create_csv(headers): Creates a CSV file with specified headers.
add_row(row): Adds a row to the CSV file.
delete(): Deletes the CSV file.
5. DateAndTime Lib
Description: Retrieves the current date and time in various formats.
Functions:
utcnow(): Returns the current UTC date and time.
Usage:
now(timezone_str): Returns the current date and time for a specified timezone.
Arguments:
timezone_str
(required, str): Timezone to retrieve the time for.
Usage:
6. Crypto Lib
Description: Provides crypto conversion and price retrieval functions.
Functions:
convert(_from, _to, _amo): Converts an amount from one currency to another.
Arguments:
_from
(required, str): Source currency._to
(required, str): Target currency._amo
(required, float): Amount to convert.
Usage:
get_price(_currency, _pricein): Retrieves the price of a currency in terms of another currency.
Arguments:
_currency
(required, str): Currency to get the price for._pricein
(required, str): Currency to display the price in.
Usage:
7. Paytm Lib
Description: Handles Paytm transactions and key management.
Functions:
setKeys(key, mid, token): Sets Paytm keys.
Arguments:
key
(required, str): Paytm key.mid
(required, str): Merchant ID.token
(required, str): Authentication token.
Usage:
send(amount, number, description=None): Sends a payment to a Paytm user.
Arguments:
amount
(required, float): Amount to send.number
(required, str): Recipient’s Paytm number.description
(optional, str): Description for the transaction.
Usage:
8. Oxapay Lib
Description: Integrates with the Oxapay API to create merchant payment clients.
Functions:
post(merchant_api_key): Initializes a client for the Oxapay API.
Arguments:
merchant_api_key
(required, str): API key for merchant account.
Usage:
9. ARB Lib
Description: Interacts with the Arbitrum blockchain for sending tokens and managing transactions.
Functions:
setKeys(private_Key): Sets the private key for ARB transactions.
Arguments:
private_Key
(required, str): The private key for transactions.
Usage:
send(value, to, contract, private_key=None): Sends tokens on Arbitrum to a specific address.
Arguments:
value
(required, float): Amount to send.to
(required, str): Recipient’s address.contract
(required, str): Contract address.private_key
(optional, str): Private key for signing the transaction.
Usage:
sendARB(value, to, private_key=None): Sends native ARB tokens directly.
Arguments:
value
(required, float): Amount of ARB to send.to
(required, str): Recipient’s address.private_key
(optional, str): Private key for signing the transaction.
Usage:
10. Coinpayments Lib
Description: Facilitates interactions with the CoinPayments API for payment processing.
Functions:
setKeys(public_key, private_key): Sets public and private keys for CoinPayments.
Arguments:
public_key
(required, str): Public key for API.private_key
(required, str): Private key for API.
Usage:
post(public_key=None, private_key=None): Returns a CoinPayments API client.
Arguments:
public_key
(optional, str): Public key (optional if already set).private_key
(optional, str): Private key (optional if already set).
Usage:
11. Polygon Lib
Description: This library enables interaction with the Polygon blockchain for sending tokens.
Functions:
setKeys(private_Key): Stores the private key for Polygon transactions in the database.
Arguments:
private_Key
(required, str): The private key for signing transactions.
Usage:
send(value, to, contract, private_key=None): Sends tokens to a specified address on the Polygon network using a smart contract.
Arguments:
value
(required, float): Amount to send.to
(required, str): Recipient address.contract
(required, str): Contract address for the token.private_key
(optional, str): Private key for signing the transaction.
Usage:
sendPolygon(value, to, private_key=None): Sends MATIC directly to a specified address.
Arguments:
value
(required, float): Amount of MATIC to send.to
(required, str): Recipient address.private_key
(optional, str): Private key for signing the transaction.
Usage:
12. Random Lib
Description: Generates random values, including integers, strings, and floats.
Functions:
randomInt(val, val2): Generates a random integer between the specified range.
Arguments:
val
(required, int): Start of the range.val2
(required, int): End of the range.
Usage:
randomStr(length, charSet=None): Generates a random string of a specified length.
Arguments:
length
(required, int): Length of the generated string.charSet
(optional, str): Character set to use.
Usage:
randomFloat(val, val2): Generates a random float between the specified range.
Arguments:
val
(required, float): Start of the range.val2
(required, float): End of the range.
Usage:
randomAscii(val): Generates a random ASCII string of five characters.
Usage:
13. Tomochain Lib
Description: Interacts with the TomoChain network for sending tokens and managing transactions.
Functions:
setKeys(private_Key): Stores the private key for TomoChain transactions.
Arguments:
private_Key
(required, str): The private key for signing transactions.
Usage:
sendTRC20(value, to, contract, private_key=None): Sends TRC20 tokens to a specified address on TomoChain.
Arguments:
value
(required, float): Amount to send.to
(required, str): Recipient address.contract
(required, str): Contract address for the token.private_key
(optional, str): Private key for signing the transaction.
Usage:
sendTomochain(value, to, private_key=None): Sends TOMO directly to a specified address.
Arguments:
value
(required, float): Amount of TOMO to send.to
(required, str): Recipient address.private_key
(optional, str): Private key for signing the transaction.
Usage:
14. TTcoin Lib
Description: Facilitates interactions with the ThunderCore blockchain, specifically for handling TTcoin transactions.
Functions:
setKeys(private_Key): Stores the private key for ThunderCore transactions.
Arguments:
private_Key
(required, str): The private key for signing transactions.
Usage:
sendTT(value, to, private_key=None): Sends TT tokens directly to a specified address.
Arguments:
value
(required, float): Amount of TT to send.to
(required, str): Recipient address.private_key
(optional, str): Private key for signing the transaction.
Usage:
Last updated