async def stats(self, ctx): """ Statistical information on Crypto Link system """ data = self.backoffice.stats_manager.get_all_stats() cl_off_chain = data["xlm"]["offChain"] cl_on_chain = data['xlm']['onChain'] guilds = await self.bot.fetch_guilds(limit=150).flatten() reach = len(self.bot.users) world = Embed(title='__Crypto Link__', colour=Colour.magenta(), timestamp=datetime.utcnow()) world.add_field(name='Guild reach', value=f'{len(guilds)}', inline=False) world.add_field(name='Member reach', value=f'{reach}', inline=False) await ctx.author.send(embed=world) on_stats = Embed(title='__Crypto Link On Chain__', colour=Colour.greyple()) on_stats.add_field(name=f'Total Deposits', value=f'{cl_on_chain["depositCount"]}') on_stats.add_field(name=f'Total Deposited', value=f'{cl_on_chain["depositAmount"]} XLM') on_stats.add_field(name=f'Total Withdrawals', value=f'{cl_on_chain["withdrawalCount"]}') on_stats.add_field(name=f'Total Withdrawn', value=f'{cl_on_chain["withdrawnAmount"]} XLM') await ctx.author.send(embed=on_stats) off_chain = Embed(title=f'__Crypto Link off chain__', colour=Colour.greyple()) off_chain.add_field(name=f'Total Transactions done', value=f'{cl_off_chain["totalTx"]}') off_chain.add_field(name=f'Total XLM moved', value=f'{round(cl_off_chain["totalMoved"], 7)}') off_chain.add_field(name=f'Total Public TX', value=f'{cl_off_chain["totalPublicCount"]}') off_chain.add_field(name=f'Total Public Moved', value=f'{round(cl_off_chain["totalPublicMoved"], 7)}') off_chain.add_field(name=f'Total Private TX', value=f'{cl_off_chain["totalPrivateCount"]}') off_chain.add_field(name=f'Total Private Moved', value=f'{round(cl_off_chain["totalPrivateMoved"], 7)}') off_chain.add_field(name=f'Total Emoji Tx', value=f'{cl_off_chain["totalEmojiTx"]}') off_chain.add_field(name=f'Total Emoji Moved', value=f'{cl_off_chain["totalEmojiMoved"]}') off_chain.add_field(name=f'Total Multi Tx', value=f'{cl_off_chain["multiTxCount"]}') off_chain.add_field(name=f'Total Multi moved', value=f'{cl_off_chain["multiTxMoved"]}') off_chain.add_field(name=f'Total Merchant Tx', value=f'{cl_off_chain["merchantPurchases"]}') off_chain.add_field(name=f'Total Merchant moved', value=f'{cl_off_chain["merchantMoved"]}') await ctx.author.send(embed=off_chain)
async def send_transfer_notification(self, ctx, member, sys_channel, normal_amount, emoji: str, chain_name: str): """ Function send information to corporate channel on corp wallet activity :param ctx: Discord Context :param member: Member to where funds have been transferred :param channel_id: channel ID applied for notifications :param normal_amount: converted amount from atomic :param emoji: emoji identification for the currency :param chain_name: name of the chain used in transactions :return: discord.Embed """ corp_channel = Embed( title=f'__{emoji} Corporate account transfer activity__ {emoji}', description= f'Notification on corporate funds transfer activity on {chain_name}', colour=Colour.greyple()) corp_channel.add_field(name='Author', value=f'{ctx.message.author}', inline=False) corp_channel.add_field(name='Destination', value=f'{member}') corp_channel.add_field(name='Amount', value=f'{normal_amount} {emoji}') await sys_channel.send(embed=corp_channel)
from discord import Colour, Embed from discord.ext.commands import Bot from discord.utils import get from bot.constants import Channels, Guild, RabbitMQ log = logging.getLogger(__name__) LEVEL_COLOURS = { "debug": Colour.blue(), "info": Colour.green(), "warning": Colour.gold(), "error": Colour.red() } DEFAULT_LEVEL_COLOUR = Colour.greyple() EMBED_PARAMS = ("colour", "title", "url", "description", "timestamp") CONSUME_TIMEOUT = datetime.timedelta(seconds=10) class RMQ: """ RabbitMQ event handling """ rmq = None # type: aio_pika.Connection channel = None # type: aio_pika.Channel queue = None # type: aio_pika.Queue def __init__(self, bot: Bot):
from random import seed, randint from datetime import datetime seed(datetime.now()) colours = [ Colour.teal(), Colour.dark_teal(), Colour.green(), Colour.dark_green(), Colour.blue(), Colour.dark_blue(), Colour.purple(), Colour.dark_purple(), Colour.magenta(), Colour.dark_magenta(), Colour.gold(), Colour.dark_gold(), Colour.orange(), Colour.dark_orange(), Colour.red(), Colour.dark_red(), Colour.lighter_grey(), Colour.light_grey(), Colour.dark_grey(), Colour.darker_grey(), Colour.blurple(), Colour.greyple(), Colour.from_rgb(randint(0, 255), randint(0, 255), randint(0, 255)) ]