async def marketing(self, ctx, *, message: str): try: await ctx.message.delete() except Exception: pass if self.length_checker(message=message): ticket_no = str(uuid4()) time_of_request = datetime.utcnow() if support_sys_mng.check_if_support_activated( community_id=ctx.guild.id): if await self.send_ticket_message_channel( ctx=ctx, message=message, department='Marketing', color_code=Colour.magenta(), ticket_id=ticket_no, time_of_request=time_of_request): if await self.send_ticket_message_author( ctx=ctx, time_of_request=time_of_request, department='Marketing', ticket_id=ticket_no, support_msg=message, colour=Colour.magenta()): return else: title = '__Support System Internal Error__' message = f'System could deliver a copy of the ticket to your DM however ' \ f'support has recieved it and will be in touch as soon as possible. We apologize for inconvinience!' await custom_message.system_message( ctx, message=message, color_code=1, destination=1, sys_msg_title=title) else: title = '__Support System Internal Error__' message = f'System could not process you request at this moment. Please try again later. ' \ f'We apologize for inconvinience!' await custom_message.system_message(ctx, message=message, color_code=1, destination=1, sys_msg_title=title) else: message = f'{ctx.guild} does not have activate support ticket service. Please contact' \ f' administrators directly' await custom_message.system_message(ctx, message=message, color_code=1, destination=1) else: message = f'Message needs to be between 20 and 200 characters in length!' await custom_message.system_message(ctx, message=message, color_code=1, destination=1)
async def wallet(self, ctx): if has_wallet(ctx.author): embed = Embed( title="ERROR", description="You already have a crypto wallet!", colour=Colour.red() ) await ctx.send(embed=embed) return query = """ UPDATE crypto SET crypto_wallet=? WHERE uid=? """ Connection.SQL_Cursor.execute(query, (1, user.get_uid(ctx.author))) Connection.SQL_Handle.commit() await ctx.channel.trigger_typing() await asyncio.sleep(2) embed = Embed( title="Downloading Crypto Wallet", description="**Progress:**\n" + ":white_large_square:" * 10, colour=Colour.magenta() ) time = datetime.datetime.now() embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p")) progress = await ctx.send(embed=embed) ii = 10 for i in range(1, 10): ii -= 1 await asyncio.sleep(1) embed = Embed( title="Downloading Crypto Wallet", description=("**Progress:**\n" + ":green_square:" * i) + ":white_large_square:" * ii, colour=Colour.magenta() ) time = datetime.datetime.now() embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p")) await progress.edit(embed=embed) await asyncio.sleep(1) embed = Embed( title="Success!", description="Crypto Wallet has been downloaded to your rig.\n\n**Progress:**\n" + "" + ":green_square:" * 10, colour=Colour.magenta() ) time = datetime.datetime.now() embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p")) await progress.edit(embed=embed)
async def sub_game_stat(self, ctx: Context, stat: str, diff: int) -> None: """ Set a stat on the game state :param ctx: Game context :param stat: Stat name :param diff: Stat change """ state = GameState.get_or_create(ctx) stat_l = stat.lower() if stat_l == "momentum": changed = state.sub_momentum(diff) elif stat_l == "threat": changed = state.sub_threat(diff) else: await ctx.send(f"Unknown stat: {stat}") return if not changed: await ctx.send(f"Not enough {stat} (Needed {diff})") db.Session().commit() await self.show_game(ctx, state, color=Colour.magenta())
async def damage(self, ctx: Context, dice_pool: int) -> None: """ Roll a damage check :param ctx: Command context :param dice_pool: Number of dice to roll """ rolls = [] dmg = 0 effects = 0 for _ in range(0, dice_pool): rolls.append(random.randint(1, 6)) for roll in rolls: if roll == 1: dmg += 1 elif roll == 2: dmg += 2 elif roll == 5: dmg += 1 effects += 1 elif roll == 6: dmg += 1 effects += 1 embed = discord.Embed(title="Damage Result", colour=Colour.magenta()) embed.add_field(name="Damage: ", value=str(dmg)) embed.add_field(name="Effects: ", value=str(effects)) embed.add_field(name="Rolls: ", value=str(rolls), inline=False) await ctx.send(embed=embed)
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 user_role_purchase_msg(ctx, role: Role, role_details: dict): # Send notification to user role_embed = Embed( name= ':shopping_cart: __Membership purchase successful__ :shopping_cart: ', title='Congratulations on ' 'obtaining the role', description='Details on obtained role', colour=Colour.magenta()) role_embed.set_thumbnail(url=ctx.message.guild.icon_url) role_embed.add_field( name=':convenience_store: Community :convenience_store:', value=f'{ctx.message.guild} \n' f'ID:{ctx.message.guild.id}', inline=False) role_embed.add_field(name=':japanese_ogre: Role: :japanese_ogre: ', value=f'{role.name} ID:{role.id}', inline=False) role_embed.add_field(name=f':calendar: Role Purchase Date :calendar: ', value=f'{role_details["roleStart"]}') role_embed.add_field( name=':timer: Role Expiration :timer: ', value=f'{role_details["roleEnd"]} (in: {role_details["roleLeft"]})', inline=False) role_embed.add_field( name=':money_with_wings: Role Value :money_with_wings: ', value=f'{role_details["dollarValue"]} $ \n' f'{role_details["roleRounded"]} {CONST_STELLAR_EMOJI}\n' f'{role_details["usdRate"]} / 1{CONST_STELLAR_EMOJI}', inline=False) try: await ctx.author.send(embed=role_embed) except Exception as e: print(e) await ctx.channel.send(embed=role_embed, delete_after=10)
async def guild_owner_role_purchase_msg(ctx, role: Role, role_details: dict): incoming_funds = Embed( name= ':convenience_store: __Merchant system funds credited__ :convenience_store: ', title='__Incoming funds to corporate ' 'wallet___', description=f'Role has been purchased on your community ' f'at {role_details["roleStart"]}.', colour=Colour.magenta()) incoming_funds.add_field( name=':japanese_ogre: Role Purchased :japanese_ogre: ', value=f"Name: {role.name}\n" f"Id: {role.id}", inline=False) incoming_funds.set_thumbnail(url=f'{ctx.message.author.avatar_url}') incoming_funds.add_field( name=':money_with_wings: Role Value :money_with_wings: ', value=f'${role_details["dollarValue"]}\n' f'{role_details["roleRounded"]} {CONST_STELLAR_EMOJI}\n' f'{role_details["usdRate"]} / 1{CONST_STELLAR_EMOJI}', inline=False) incoming_funds.add_field(name=':cowboy: User Details :cowboy: ', value=f"User: {ctx.message.author}\n" f"Id: {ctx.message.author.id}", inline=False) incoming_funds.add_field( name=':clipboard: Role Duration Details :clipboard: ', value=f'{role_details["roleDetails"]}', inline=False) await ctx.message.guild.owner.send(embed=incoming_funds)
async def membership(self, ctx): """ Entry point for membership connected with wmerchant system """ if ctx.invoked_subcommand is None: title = ':joystick: __Membership available commands__ :joystick:' description = 'Representation of all available commands under ***membership*** category ' list_of_commands = [{ "name": f':circus_tent: Available Roles on {ctx.message.guild} :circus_tent:', "value": f'```{self.command_string}membership roles```' }, { "name": f':person_juggling: Subscribe for role on community :person_juggling: ', "value": f'```{self.command_string}membership subscribe <@discord Role>```' }, { "name": f':man_mage: List active roles on community:man_mage:', "value": f'```{self.command_string}membership current```' }] await custom_messages.embed_builder(ctx=ctx, title=title, data=list_of_commands, description=description, destination=1, c=Colour.magenta())
async def send_ticket_message_channel(self, ctx, message, department: str, color_code: Colour, ticket_id: str, time_of_request): try: channel_id = int( support_sys_mng.get_channel(community_id=int(ctx.guild.id))) print(channel_id) dest = self.bot.get_channel(id=int(channel_id)) print(f'{dest}') time_of_request = datetime.utcnow() supp_msg = Embed(title='__Support requested__', colour=Colour.magenta(), timestamp=time_of_request) supp_msg.set_thumbnail(url=ctx.message.author.avatar_url) supp_msg.add_field(name="Department", value=f'{department}', inline=False) supp_msg.add_field( name="from", value=f'{ctx.message.author} id: {ctx.message.author.id}', inline=False) supp_msg.add_field(name="Ticket ID", value=ticket_id, inline=False) supp_msg.add_field(name="Message Content", value=f'{message}', inline=False) await dest.send(content=f"TICKET: {ticket_id}") support_msg = await dest.send(embed=supp_msg) await support_msg.add_reaction(emoji="⛔") return True except Exception as e: print(e) return False
async def action(self, msg, args, client): self.msg = msg from main import client latency_ms = int(client.latency * 1000) description = ":ping_pong: **{0}** ms".format(latency_ms) embed = Embed(description=description, colour=Colour.magenta()) await msg.channel.send(embed=embed) self.done()
async def lewd(ctx, *, term=None): lewd = await get_lewd(term, bot) embed = Embed() embed.type = "rich" embed.colour = Colour.magenta() embed.set_image(url=lewd["post"]) embed.set_footer(text=POST_URL.format(lewd["id"])) await bot.say(None, embed=embed)
async def neko(ctx, *, term=None): neko = await get_neko(term, bot) embed = Embed() embed.type = "rich" embed.color = Colour.magenta() embed.set_image(url=neko) await bot.say(None, embed=embed)
def embed_templ(title, description=None, field1=None, field2=None, author=None, image_author=None): embed = Embed( title=title, description=description, colour=Colour.magenta() ) embed.add_field(name=field1, value=field2, inline=True) embed.set_author(name=author, icon_url=image_author) return embed
async def current(self, ctx): """ Returns information on current membership details user currently has active """ author = ctx.message.author.id community = ctx.message.guild.id roles = self.backoffice.merchant_manager.check_user_roles( user_id=author, discord_id=community) if roles: for role in roles: value_in_stellar = round( int(role['atomicValue']) / 10000000, 7) starting_time = datetime.fromtimestamp(int(role['start'])) ending_time = datetime.fromtimestamp(int(role['end'])) count_left = ending_time - datetime.utcnow() dollar_worth = round(int(role['pennies']) / 100, 4) role_name = role['roleName'] role_id = int(role['roleId']) role_embed = discord.Embed( title= f':person_juggling: Active role information :person_juggling:', colour=Colour.magenta()) role_embed.add_field( name=":circus_tent: Active Role :circus_tent:", value=f'***{role_name}*** (id:{role_id})', inline=False) role_embed.add_field( name=":calendar: Role Obtained :calendar: ", value=f"{starting_time} UTC", inline=False) role_embed.add_field( name=":money_with_wings: Role Value :money_with_wings: ", value= f"{value_in_stellar} {CONST_STELLAR_EMOJI} (${dollar_worth})", inline=False) role_embed.add_field( name=":stopwatch: Role Expires :stopwatch: ", value=f'{ending_time} UTC', inline=False) role_embed.add_field(name=":timer: Time Remaining :timer: ", value=f'{count_left}', inline=False) await ctx.author.send(embed=role_embed) else: message = f"You have no active roles on {ctx.message.guild}, or all of them have expired." await custom_messages.system_message( ctx=ctx, color_code=1, message=message, destination=1, sys_msg_title=CONST_MERCHANT_ROLE_ERROR)
async def lewd(ctx, *, term=None): lewd = await get_lewd(term, bot) embed = Embed() embed.type = "rich" embed.colour = Colour.magenta() embed.set_image( url=lewd ) await bot.say(None, embed=embed)
async def support(self, ctx, *, support_msg: str): support_channel = self.bot.get_channel(id=int(self.support_channel_id)) if 20 <= len(support_msg) <= 200: if isinstance(ctx.message.channel, TextChannel): ticket_no = str(uuid4()) time_of_request = datetime.utcnow() supp_msg = Embed(title='__Support requested__', colour=Colour.magenta(), timestamp=time_of_request) supp_msg.set_thumbnail(url=ctx.message.author.avatar_url) supp_msg.set_author(name=f'{ctx.message.author} id: {ctx.message.author.id}') supp_msg.add_field(name="From Guild", value=f'{ctx.message.guild} (ID: {ctx.message.guild.id}', inline=False) supp_msg.add_field(name="Ticket ID", value=ticket_no, inline=False) supp_msg.add_field(name="Message Content", value=f'{support_msg}', inline=False) await support_channel.send(content=f"TICKET: {ticket_no}") support_msg = await support_channel.send(embed=supp_msg) await support_msg.add_reaction(emoji="⛔") user_msg = Embed(title='__Support ticket issues successfully__', description='Automatic System Message', timestamp=time_of_request, colour=Colour.green()) user_msg.set_thumbnail(url=self.bot.user.avatar_url) user_msg.add_field(name='Sys message', value=f'We would like to inform you that your support ticket has been' f' recieved successfully. One of the ' f'support staff wiill be in contact with you in next 24 hours! ' f'Thank your for {self.bot.user}', inline=False) user_msg.add_field(name="Reference Support Ticker Number", value=ticket_no, inline=False) user_msg.add_field(name="Reques message", value=f'{support_msg}', inline=False) user_msg.set_footer(text='Service provided by Launch Pad Investments') await ctx.author.send(embed=user_msg) else: message = "In order to issue support ticket you need to execute command on public channel " \ "of the community where the bot is present." await custom_message.system_message(ctx=ctx, color_code=1, message=message, destination=0) else: message = 'Message is to short or to long!' await custom_message.system_message(ctx=ctx, color_code=1, message=message, destination=0)
async def roles(self, ctx): """ Gets all available monetized roles on the community :return: """ roles = self.backoffice.merchant_manager.get_all_roles_community( community_id=ctx.message.guild.id) title = f':circus_tent: __Available Roles on Community {ctx.message.guild}__ :circus_tent:' dollar_xlm = gecko.get_price(ids='stellar', vs_currencies='usd') if roles: for role in roles: value = float(role["pennyValues"] / 100) value_in_stellar = value / dollar_xlm['stellar']['usd'] values = [{ "name": ':person_juggling: Role :person_juggling: ', "value": f'{role["roleName"]} ID({role["roleId"]})' }, { "name": ':vertical_traffic_light: Status :vertical_traffic_light:', "value": role["status"] }, { "name": ':dollar: Fiat value :dollar: ', "value": f"{value} $" }, { "name": ':currency_exchange: Conversion to crypto :currency_exchange: ', "value": f"{value_in_stellar:.7} {CONST_STELLAR_EMOJI}" }, { "name": ':timer: Role Length:timer: ', "value": f"{role['weeks']} week/s {role['days']} day/s {role['hours']} " f"hour/s {role['minutes']} minute/s" }] description = "Role details" await custom_messages.embed_builder(ctx=ctx, title=title, description=description, destination=1, data=values, c=Colour.magenta()) else: message = f"{ctx.message.guild} does not have any available roles for purchase at this moment." await custom_messages.system_message( ctx=ctx, color_code=1, message=message, destination=1, sys_msg_title=CONST_MERCHANT_ROLE_ERROR)
def get_random_color() -> Colour: """ TODO: Add more colors that look good :return: """ colors = [ Colour.blurple(), Colour.dark_blue(), Colour.dark_orange(), Colour.dark_magenta(), Colour.teal(), Colour.magenta(), Colour.dark_gold(), Colour.blurple() ] return random.choice(colors)
async def send_xdr_info(ctx, request_data: dict, envelope: str, command_type: str): # Inform user xdr_info = Embed( title=f'Transaction as XDR', description= 'Bellow is the XDR envelope of payment with provided details', colour=Colour.magenta()) xdr_info.add_field(name="From Address", value=f'```{request_data["fromAddr"]}```', inline=False) xdr_info.add_field(name="Address", value=f'```{request_data["toAddr"]}```', inline=False) if command_type == 'public': xdr_info.add_field( name="Token and Amount", value=f'{request_data["amount"]} {request_data["token"]}', inline=False) elif command_type == "discord": xdr_info.add_field( name="Transaction Net Value", value=f'{request_data["txTotal"]} {request_data["token"]}', inline=False) xdr_info.add_field(name=":hammer_pick: Dev Fee :hammer_pick: ", value=f'`{request_data["devFee"]} XLM`', inline=False) elif command_type == "activate": xdr_info.add_field(name="Total Amount to be sent", value=f'`{request_data["amount"]} XLM`', inline=False) xdr_info.add_field(name="XDR Envelope", value=f'```{envelope}```', inline=False) xdr_info.add_field( name=":warning: Note :warning:", value= f'Copy the XDR envelope to application which allows __importing of ' f' a transaction envelope in XDR format and follow procedures there.' f'If you do not have access to such application than you can use as well\n' f'[Stellar Laboratory Transaction Signer]' f'(https://laboratory.stellar.org/#txsigner?network=test)', inline=False) await ctx.author.send(embed=xdr_info)
async def marketing(self, ctx, *, message: str): if self.length_checker(message=message): ticket_no = str(uuid4()) time_of_request = datetime.utcnow() if await self.send_ticket_message_channel(ctx=ctx, message=message, department='Marketing', ticket_id=ticket_no): if await self.send_ticket_message_author( ctx=ctx, time_of_request=time_of_request, department='Feature', ticket_id=ticket_no, support_msg=message, colour=Colour.magenta()): return else: title = '__Support System Internal Error__' message = f'System could deliver a copy of the ticket to your DM however ' \ f'support has recieved it and will be in touch as soon as possible. We apologize ' \ f'for inconvinience!' await custom_message.system_message(ctx, message=message, color_code=1, destination=1, sys_msg_title=title) else: title = '__Support System Internal Error__' message = f'System could not process you request at this moment. Please try again later. ' \ f'We apologize for inconvinience!' await custom_message.system_message(ctx, message=message, color_code=1, destination=1, sys_msg_title=title) else: message = f'Message needs to be between 20 and 200 characters in length!' await custom_message.system_message(ctx, message=message, color_code=1, destination=1)
async def bug_messages(self, ctx, error, destination): animus_embed = Embed(title='Bug notifcationa', description=':bug: was found, below are details', Colour=Colour.magenta()) animus_embed.add_field(name='Error details', value=f'{error}', inline=False) animus_embed.add_field( name='Community', value=f'{ctx.message.guild} id: {ctx.message.guild.id}', inline=False) animus_embed.add_field( name='Author of command', value=f'{ctx.message.author} id: {ctx.message.author.id}', inline=False) animus_embed.add_field(name='Command written', value=f'{ctx.message.content}', inline=False) await destination.send(embed=animus_embed)
async def send_ticket_message_channel(self, ctx, message, department: str, ticket_id: str): mention_str = '' for u in self.user_tags_list: user = await self.bot.fetch_user(id=int(u)) mention = user.mention mention_str += mention try: dest = self.bot.get_channel(id=int(self.channel_id)) time_of_request = datetime.utcnow() supp_msg = Embed(title='__Support requested__', colour=Colour.magenta(), timestamp=time_of_request) supp_msg.set_thumbnail(url=ctx.message.author.avatar_url) supp_msg.add_field(name='From Guild', value=f'{ctx.message.guild}') supp_msg.add_field(name="Subject", value=f'{department}', inline=False) supp_msg.add_field( name="From guild owner", value=f'{ctx.message.author} id: {ctx.message.author.id}', inline=False) supp_msg.add_field(name="Ticket ID", value=ticket_id, inline=False) supp_msg.add_field(name="Message Content", value=f'{message}', inline=False) await dest.send(content=f"{mention_str} TICKET: {ticket_id}") support_msg = await dest.send(embed=supp_msg) await support_msg.add_reaction(emoji="⛔") return True except Exception as e: print(e) return False
async def danbooru_search(self, ctx, *args): if ctx.channel.is_nsfw(): danbooru_api = "http://danbooru.donmai.us/posts.json?limit=1&random=true&tags={}" login = config['danbooru_login'] token = config['danbooru_token'] tags = " ".join(args) response = requests.get(danbooru_api.format(tags), auth=(login, token)).json() lewd = None try: if args: post = response[0]['file_url'] if (post == None): post = response[0]['source'] lewd = { 'post': post, 'id': response[0]['id'], 'artist': response[0]['tag_string_artist'] } except: await ctx.send( "No images found, or incorrect query structure. Tags are limited to 2 and space delimited. Example: !lewd huge_breasts muscular_female" ) post_url = "http://danbooru.donmai.us/posts/{}" embed = Embed( title=f"http://danbooru.donmai.us/posts/{lewd['id']}", type="rich", colour=Colour.magenta()) embed.set_image(url=lewd['post']) embed.set_footer( text=f"Artist: {lewd['artist'].replace('_', ' ').title()}") await ctx.send(None, embed=embed) else: await ctx.send("Try again in a NSFW channel, retard.")
import random from discord import Colour from discord import Embed from discord.ext import commands from commands.Amount_converter import Amount from commands.Coin_converter import CoinType from economy.Economy import amountValid from economy.Economy import amountToString flowers = { "purple": ["https://cdn.discordapp.com/attachments/628820715013013546/629639422316380160/purple.png", Colour.magenta(), "cold"], "blue": ["https://cdn.discordapp.com/attachments/628820715013013546/629639401768484864/blue.png", Colour.blue(), "cold"], "pastel": ["https://cdn.discordapp.com/attachments/628820715013013546/629639424195428352/pastel.png", Colour.green(), "cold"], "yellow": ["https://cdn.discordapp.com/attachments/628820715013013546/629639427508928543/yelow.png", Colour.from_rgb(255, 255, 0), "hot"], "red": ["https://images-ext-1.discordapp.net/external/jtOX9o1yvoetSwsOiZ8G4cUlnU3LzcE_8gnNPN32fHY/" "https/cdn.discordapp.com/emojis/567247590102663180.png", Colour.red(), "hot"], "orange": ["https://cdn.discordapp.com/attachments/628820715013013546/629639412376010752/Orange.png", Colour.orange(), "hot"], "rainbow": ["https://cdn.discordapp.com/attachments/628820715013013546/629639426653421569/rainbow.png", Colour.from_rgb(0, 255, 255), "Host Wins"] } class Plant(commands.Cog): def __init__(self, bot): self.bot = bot self.Usage = "The roll commands" @commands.command(name="plant") async def plant_command(self, ctx, hot, type: CoinType, amount: Amount): amountValid(self.bot, ctx.author.id, amount, type)
from discord import Colour 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)) ]
async def stats(self, ctx): if not miner(ctx.author): await send_notminer_msg(ctx) return if not has_wallet(ctx.author): embed = Embed( title="ERROR", description="You don't have a crypto wallet!\n**TIP:** `!crypto download wallet`", colour=Colour.red() ) await ctx.send(embed=embed) return embed = Embed( title=f"{ctx.author}'s Crypto Statistics", description="", colour=Colour.magenta(), ) embed.set_thumbnail(url="https://cdn.pixabay.com/photo/2015/08/27/11/20/bitcoin-910307_960_720.png") bitcoin = utils.get(self.bot.emojis, name="bitcoin") embed.add_field( name="Wallet", value=f"{bitcoin} `{bitcoins(ctx.author):,.14f}`", inline=True, ) embed.add_field( name="Rig", value=f":desktop: `Personal Computer`", inline=True, ) empty_field(embed) gpu = utils.get(self.bot.emojis, name="videocard") embed.add_field( name="Components", value=f"{gpu} `GeForce GTX 1060 x1`", inline=True, ) time = datetime.datetime.now() xpoints = [] ypoints = [] with open(f"cache/{ctx.author.id}_bitcoin.history") as file: line = file.readlines() for line in file: pass lines = list(map(str.strip, line)) for i in line: xpoints.append(float(i)) for i in range(len(lines)): ypoints.append(i) plt.bar(ypoints, xpoints) plt.grid() plt.title("[ Bitcoin Earnings ]") plt.legend(["Bitcoins Earned"]) plt.xlabel("Block") plt.ylabel("Bitcoin") plt.savefig(f"cache/{ctx.author.id}.png") plt.close() image = File(f"cache/{ctx.author.id}.png") embed.set_footer(text=time.strftime(f"Date: %B %d, %Y | %I:%M %p")) embed.set_image(url=f"attachment://{ctx.author.id}.png") await ctx.send(embed=embed, file=image) os.remove(f"cache/{ctx.author.id}.png")
async def check_role_status(self, ctx, role_name): role = discord.utils.get(ctx.guild.roles, name=role_name) if not role: try: if role_name == 'Jailed': # Creates the role for Jailed system perms = Permissions(send_messages=False, read_messages=True, view_channel=True, read_message_history=True) await ctx.guild.create_role(name='Jailed', permissions=perms, hoist=True, colour=Colour.red(), mentionable=True) elif role_name == 'Visitor': # Creates the role for verified users perms = Permissions(send_messages=False, read_messages=True, view_channel=True, read_message_history=True) await ctx.guild.create_role(name='Visitor', permissions=perms, colour=Colour.green(), mentionable=True) elif role_name == 'Unverified': # Creates role for un-verified users perms = Permissions(send_messages=False, read_messages=True, view_channel=True, add_reactions=True) await ctx.guild.create_role(name='Unverified', permissions=perms, colour=Colour.magenta(), mentionable=True) return True except discord.errors.Forbidden: await ctx.channel.send(content='Bot does not have permission to create roles') return False else: return True