2023-09-23 12:07:03 -04:00
from random import randint
2023-08-08 10:26:37 -04:00
import re
2023-08-07 09:42:46 -04:00
import subprocess
2023-08-08 09:50:43 -04:00
from datetime import datetime
import discord
from redbot . core import Config , app_commands , checks , commands
from redbot . core . app_commands import Choice
2023-02-27 12:43:38 -05:00
class Galaxy ( commands . Cog ) :
2023-03-02 17:53:07 -05:00
""" Custom cog intended for use on the Galaxy discord server.
Developed by SeaswimmerTheFsh . """
2023-02-27 12:43:38 -05:00
def __init__ ( self , bot ) :
self . bot = bot
2023-03-01 23:48:10 -05:00
self . config = Config . get_conf ( self , identifier = 6621962 )
2023-03-02 01:06:27 -05:00
self . config . register_guild (
2023-08-08 14:56:55 -04:00
autoreact_target = 0 ,
2023-08-08 15:05:00 -04:00
autoreact_emoji = ' 💀 '
2023-03-02 01:06:27 -05:00
)
2023-02-27 12:43:38 -05:00
2023-08-07 09:42:46 -04:00
@commands.command ( )
@checks.is_owner ( )
async def nslookup ( self , ctx : commands . Context , * , website : str ) :
2023-08-07 09:46:11 -04:00
""" This command uses `nslookup` to check the IP Address of any given website. """
2023-08-07 09:42:46 -04:00
try :
result = subprocess . run ( [ ' nslookup ' , website ] , capture_output = True , text = True , check = True )
2023-08-07 09:43:44 -04:00
await ctx . send ( f " ``` \n { result . stdout } \n ``` " )
2023-08-07 09:42:46 -04:00
except subprocess . CalledProcessError as e :
2023-08-07 09:46:11 -04:00
await ctx . send ( f " Error executing `nslookup`: ` { e } ` " )
2023-08-07 09:42:46 -04:00
except FileNotFoundError :
2023-08-07 17:34:41 -04:00
await ctx . send ( " `nslookup` command not found. Make sure you have `nslookup` installed and it ' s in your system PATH. " )
2023-08-07 09:42:46 -04:00
2023-03-08 21:31:18 -05:00
@commands.command ( )
2023-08-11 00:04:33 -04:00
async def carnagerefund ( self , ctx : commands . Context , message_id : str ) :
2023-08-01 12:09:31 -04:00
""" This command generates a link to refund carnage of killed ships. """
output = f " https://info.galaxy.casa/kills/ { message_id } "
await ctx . send ( f " Output link: { output } " )
2023-03-08 21:31:18 -05:00
2023-03-01 23:45:17 -05:00
@commands.Cog.listener ( ' on_message ' )
2023-09-22 19:36:29 -04:00
async def gank_won_let_us_flee ( self , message : discord . Message ) :
2023-10-04 16:52:22 -04:00
if message . author . id == 745790085789909033 and message . guild . id == 204965774618656769 and message . channel . id == 753714180900519937 :
2023-09-23 12:11:15 -04:00
gank_media_list = [
" https://cdn.discordapp.com/attachments/1070838419212738621/1155174309711577138/gank_won_let_us_flee.gif " ,
" https://cdn.discordapp.com/attachments/1070838419212738621/1155174310093262951/spin_back_I_dare_you.jpg " ,
" https://cdn.discordapp.com/attachments/1070838419212738621/1155174310466572328/spin_back_mutt.gif " ,
" https://cdn.discordapp.com/attachments/1070838419212738621/1155174310806290533/We_dont_run_1s_around_here.gif "
2023-09-23 12:07:03 -04:00
]
if len ( message . embeds ) == 1 and str ( message . embeds [ 0 ] . color ) == ' #57f287 ' :
2023-09-23 12:11:15 -04:00
await message . reply ( gank_media_list [ randint ( 0 , 3 ) ] )
2023-09-22 19:36:29 -04:00
@commands.Cog.listener ( ' on_message ' )
async def autoreact ( self , message : discord . Message ) :
2023-08-07 20:41:23 -04:00
if message . guild is not None :
2023-08-08 14:56:55 -04:00
emoji_id = await self . config . guild ( message . guild ) . autoreact_emoji ( )
2023-08-08 10:51:25 -04:00
if self . check_if_discord_unicode_emoji ( emoji_id ) is False :
emoji = self . bot . get_emoji ( emoji_id )
elif self . check_if_discord_unicode_emoji ( emoji_id ) is True :
emoji = emoji_id
2023-08-08 14:56:55 -04:00
autoreact_target = await self . config . guild ( message . guild ) . autoreact_target ( )
if autoreact_target == 0 :
2023-08-07 20:41:23 -04:00
return
2023-08-08 14:56:55 -04:00
if not message . author . id == autoreact_target :
2023-08-07 20:41:23 -04:00
return
await message . add_reaction ( emoji )
2023-07-11 14:01:03 -04:00
2023-08-08 14:56:55 -04:00
@commands.command ( name = ' autoreact ' )
2023-03-02 00:00:35 -05:00
@commands.guild_only ( )
2023-08-08 14:56:55 -04:00
async def autoreact_list ( self , ctx : commands . Context ) :
""" Checks Autoreact ' s settings. """
emoji_id = await self . config . guild ( ctx . guild ) . autoreact_emoji ( )
autoreact_target = await self . config . guild ( ctx . guild ) . autoreact_target ( )
2023-08-08 10:51:25 -04:00
if self . check_if_discord_unicode_emoji ( emoji_id ) is True :
emoji = emoji_id
2023-08-08 15:04:16 -04:00
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = f " Autoreact is currently set to target <@ { autoreact_target } > ( { autoreact_target } ). \n Autoreact ' s emoji is currently set to { emoji } . " )
2023-08-08 10:51:25 -04:00
else :
emoji = self . bot . get_emoji ( emoji_id )
2023-08-08 15:04:16 -04:00
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = f " Autoreact is currently set to target <@ { autoreact_target } > ( { autoreact_target } ). \n Autoreact ' s emoji is currently set to { emoji } ( { await self . config . guild ( ctx . guild ) . autoreact_emoji ( ) } ). " )
2023-03-02 13:18:20 -05:00
await ctx . send ( embed = embed )
2023-07-11 14:01:03 -04:00
2023-08-08 14:56:55 -04:00
autoreact = app_commands . Group ( name = ' autoreact ' , guild_only = True , description = " This group handles the autoreact functionality. " )
2023-08-08 10:17:45 -04:00
2023-08-08 10:51:25 -04:00
def check_if_discord_unicode_emoji ( self , emoji : str ) :
emoji_ranges = [
( 0x1F600 , 0x1F64F ) , # Emoticons
( 0x1F300 , 0x1F5FF ) , # Miscellaneous symbols and pictographs
( 0x1F680 , 0x1F6FF ) , # Transport and map symbols
( 0x1F700 , 0x1F77F ) , # Alchemical symbols
]
2023-08-08 12:20:07 -04:00
try :
for char in emoji :
code_point = ord ( char )
for start , end in emoji_ranges :
if start < = code_point < = end :
return True
except TypeError :
return False
2023-08-08 10:51:25 -04:00
return False
2023-08-08 10:35:37 -04:00
def extract_id ( self , input_string ) :
2023-08-08 10:26:37 -04:00
match = re . search ( r ' (?<=:) \ d+(?=>) ' , input_string )
if match :
2023-08-08 12:17:52 -04:00
return int ( match . group ( ) )
2023-09-24 16:59:45 -04:00
return input_string
2023-08-08 10:26:37 -04:00
2023-08-08 14:56:55 -04:00
@autoreact.command ( name = " emoji " )
@app_commands.describe ( emoji = " Which emoji are you setting Autoreact to use? " )
async def autoreact_emoji ( self , interaction : discord . Interaction , emoji : str = None ) :
2023-08-08 14:58:08 -04:00
""" Sets Autoreact ' s emoji. """
2023-03-02 13:44:27 -05:00
if emoji :
2023-08-08 10:51:25 -04:00
if self . check_if_discord_unicode_emoji ( emoji ) is True :
2023-08-08 14:56:55 -04:00
await self . config . guild ( interaction . guild ) . autoreactemoji . set ( emoji )
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = f " Autoreact ' s emoji has been set to { emoji } . " )
2023-08-08 10:51:25 -04:00
await interaction . response . send_message ( embed = embed )
else :
emoji_id = self . extract_id ( input_string = emoji )
2023-08-08 10:59:25 -04:00
for guild in self . bot . guilds :
emoji_to_find = discord . utils . get ( guild . emojis , id = emoji_id )
if emoji_to_find :
emoji_obj = emoji_to_find
break
2023-08-08 11:01:50 -04:00
else :
2023-09-24 16:59:45 -04:00
await interaction . response . send_message ( content = " You ' re trying to set the autoreact emoji to an emoji I don ' t have access to! " , ephemeral = True )
2023-08-08 10:54:11 -04:00
return
2023-08-08 14:56:55 -04:00
await self . config . guild ( interaction . guild ) . autoreact_emoji . set ( emoji_obj . id )
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = f " Autoreact ' s emoji has been set to { emoji_obj } ( { emoji_obj . id } ). " )
2023-08-08 10:51:25 -04:00
await interaction . response . send_message ( embed = embed )
2023-03-02 13:44:27 -05:00
else :
2023-08-08 14:56:55 -04:00
await self . config . guild ( interaction . guild ) . autoreact_emoji . set ( ' 💀 ' )
2023-09-24 16:59:45 -04:00
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = " Autoreact ' s emoji has been set to 💀. " )
2023-08-08 10:17:45 -04:00
await interaction . response . send_message ( embed = embed )
2023-03-02 13:44:27 -05:00
2023-08-08 14:56:55 -04:00
@autoreact.command ( name = " set " )
2023-08-08 10:19:51 -04:00
@app_commands.describe ( member = " Who are you targetting? " )
2023-08-08 14:56:55 -04:00
async def autoreact_set ( self , interaction : discord . Interaction , member : discord . Member ) :
""" Sets Autoreact ' s target. """
2023-03-01 23:45:17 -05:00
if member :
2023-08-08 14:56:55 -04:00
await self . config . guild ( interaction . guild ) . autoreact_target . set ( member . id )
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = f " Autoreact has been set to automatically react to { member . mention } ( { member . id } ) ' s messages. " )
2023-08-08 10:17:45 -04:00
await interaction . response . send_message ( embed = embed )
2023-03-01 23:45:17 -05:00
else :
2023-08-08 10:17:45 -04:00
await interaction . response . send_message ( content = " That is not a valid argument! " , ephemeral = True )
2023-02-28 18:20:35 -05:00
2023-08-08 14:56:55 -04:00
@autoreact.command ( name = " reset " )
async def autoreact_reset ( self , interaction : discord . Interaction ) :
""" Resets Autoreact ' s target. """
await self . config . guild ( interaction . guild ) . autoreact_target . set ( 0 )
2023-09-24 16:59:45 -04:00
embed = discord . Embed ( color = await self . bot . get_embed_color ( None ) , description = " Autoreact ' s target has been reset. " )
2023-08-08 10:17:45 -04:00
await interaction . response . send_message ( embed = embed )
2023-03-01 23:59:48 -05:00
2023-02-28 03:35:40 -05:00
@commands.command ( )
2023-08-11 00:04:33 -04:00
async def unix ( self , ctx : commands . Context ) :
2023-02-28 03:35:40 -05:00
""" Posts the current Unix timestamp. """
2023-02-28 03:42:10 -05:00
timestamp = int ( datetime . timestamp ( datetime . now ( ) ) )
2023-10-03 12:09:37 -04:00
embed = discord . Embed ( title = " Current Time " , url = " https://www.unixtimestamp.com/ " , color = await self . bot . get_embed_color ( None ) )
2023-10-03 12:10:49 -04:00
embed . add_field ( name = " Default " , value = f " <t: { timestamp } > \n `<t: { timestamp } >` " )
embed . add_field ( name = " Short Time " , value = f " <t: { timestamp } :t> \n `<t: { timestamp } :t>` " )
embed . add_field ( name = " Long Time " , value = f " <t: { timestamp } :T> \n `<t: { timestamp } :T>` " )
2023-10-03 12:13:59 -04:00
embed . add_field ( name = " Short Date/Time " , value = f " <t: { timestamp } :f> \n `<t: { timestamp } :f>` " )
2023-10-03 12:10:49 -04:00
embed . add_field ( name = " Short Date " , value = f " <t: { timestamp } :d> \n `<t: { timestamp } :d>` " )
embed . add_field ( name = " Long Date " , value = f " <t: { timestamp } :D> \n `<t: { timestamp } :D>` " )
embed . add_field ( name = " Long Date/Time " , value = f " <t: { timestamp } :F> \n `<t: { timestamp } :F>` " )
2023-10-03 12:14:32 -04:00
embed . add_field ( name = " Relative Time " , value = f " <t: { timestamp } :R> \n `<t: { timestamp } :R>` " )
2023-02-28 03:45:26 -05:00
embed . set_footer ( text = f " { timestamp } " )
2023-02-28 03:44:34 -05:00
await ctx . send ( embed = embed )
2023-02-28 03:48:41 -05:00
await ctx . message . delete ( )
2023-02-28 03:35:40 -05:00
2023-04-05 22:42:08 -04:00
@commands.group ( autohelp = True )
async def insurance ( self , ctx : commands . Context ) :
2023-06-03 08:26:48 -04:00
""" Calculates insurance.
2023-07-30 12:25:46 -04:00
Please only use the value of a ship ( from ` ` / shipinfo ` ` ) to calculate insurance and * * not * * ship cost . Decimals do not work properly with this command , just remove them . """
2023-04-05 22:42:08 -04:00
2023-07-30 12:19:40 -04:00
async def _insurance ( self , ship_class : str , value : str ) :
2023-07-30 09:31:18 -04:00
""" This function does the actual math and configures the embed.
Attributes
- - - - - - - - - - -
ship_class : Required [ : class : ` str ` ]
The class of the ship whose insurance you ' re checking.
2023-07-30 12:12:47 -04:00
value : Required [ : class : ` int ` ]
2023-07-30 12:19:40 -04:00
The value of the ship you ' re checking. This should be supplied by `/shipinfo`. Not the same as ship cost! " " "
2023-07-30 12:23:16 -04:00
cleaned_value = int ( ' ' . join ( char for char in value if char . isdigit ( ) ) )
2023-07-30 09:31:18 -04:00
insurance_dict = {
" miner " : 0.7 ,
" freighter " : 0.65 ,
" frigate " : 0.6 ,
" destroyer " : 0.55 ,
" cruiser " : 0.5 ,
" battlecruiser " : 0.4 ,
" battleship " : 0.35 ,
" dreadnought " : 0.3 ,
" carrier " : 0.3 ,
" super_capital " : 0.25
}
try :
insurance_dict [ f ' { ship_class } ' ]
2023-09-24 16:59:45 -04:00
except KeyError as error :
raise ValueError ( " Received value is not a valid ship class! " ) from error
2023-07-30 09:31:18 -04:00
if ship_class == " super_capital " :
humanized_class = ship_class . replace ( " _ " , " " ) . title ( )
else :
humanized_class = ship_class . capitalize ( )
2023-07-30 12:19:40 -04:00
insurance_amount = ( f " { round ( cleaned_value * insurance_dict [ f ' { ship_class } ' ] ) : , } " )
value_output = ( f ' { cleaned_value : , } ' )
2023-07-30 12:16:06 -04:00
embed = discord . Embed ( title = " Insurance Payout " , color = await self . bot . get_embed_color ( None ) )
2023-07-30 09:31:18 -04:00
embed . add_field ( name = " Ship Class " , value = f " { humanized_class } " , inline = False )
2023-07-30 12:12:47 -04:00
embed . add_field ( name = " Ship Value " , value = f " { value_output } " , inline = False )
embed . add_field ( name = " Insurance Amount " , value = f " { insurance_amount } " , inline = False )
2023-07-30 09:31:18 -04:00
return embed
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def miner ( self , ctx : commands . Context , value ) :
2023-07-30 09:31:18 -04:00
""" Calculates insurance for miners. (70 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' miner ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def freighter ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for freighters. (65 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' freighter ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def frigate ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for frigates. (60 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' frigate ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def destroyer ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for destroyers. (55 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' destroyer ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def cruiser ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for cruisers. (50 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' cruiser ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def battlecruiser ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for battlecruisers. (40 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' battlecruiser ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def battleship ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for battleships. (35 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' battleship ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def dreadnought ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for dreadnoughts. (30 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' dreadnought ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def carrier ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for carriers. (30 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' carrier ' , value ) )
2023-04-05 22:42:08 -04:00
@insurance.command ( )
2023-07-30 12:21:01 -04:00
async def supercapital ( self , ctx : commands . Context , value ) :
2023-04-05 22:58:55 -04:00
""" Calculates insurance for super capitals. (25 % ) """
2023-07-30 12:15:12 -04:00
await ctx . send ( embed = await self . _insurance ( ' super_capital ' , value ) )
2023-04-05 22:42:08 -04:00
2023-04-01 15:52:35 -04:00
@commands.command ( aliases = [ " wh " ] )
2023-04-01 16:00:39 -04:00
async def warehouse ( self , ctx : commands . Context , lvlfrom : int = 1 , lvlto : int = 38 ) :
2023-02-27 23:32:35 -05:00
""" Calculates the total cost to upgrade your warehouse from a level to a level. """
2023-02-27 23:58:32 -05:00
warehouse_levels = { 1 : 0 , 2 : 1000 , 3 : 2500 , 4 : 4500 , 5 : 7500 , 6 : 12500 , 7 : 20000 , 8 : 31500 , 9 : 46500 , 10 : 65500 , 11 : 87500 , 12 : 113500 , 13 : 143500 , 14 : 178500 , 15 : 218500 , 16 : 263500 , 17 : 313500 , 18 : 373500 , 19 : 443500 , 20 : 523500 , 21 : 613500 , 22 : 713500 , 23 : 823500 , 24 : 943500 , 25 : 1073500 , 26 : 1223500 , 27 : 1398500 , 28 : 1598500 , 29 : 1823500 , 30 : 2073500 , 31 : 2353500 , 32 : 2663500 , 33 : 3003500 , 34 : 3373500 , 35 : 3773500 , 36 : 4193500 , 37 : 4644500 , 38 : 5093500 }
2023-02-28 00:19:36 -05:00
total_from = ( f ' { warehouse_levels [ lvlfrom ] : , } ' )
total_to = ( f ' { warehouse_levels [ lvlto ] : , } ' )
output = warehouse_levels [ lvlto ] - warehouse_levels [ lvlfrom ]
2023-02-28 00:37:05 -05:00
total = ( f ' { output : , } ' )
2023-02-27 23:58:32 -05:00
embed = discord . Embed ( title = " Warehouse Cost " , color = await self . bot . get_embed_color ( None ) )
2023-02-28 00:38:30 -05:00
embed . add_field ( name = " From: " , value = f " Warehouse Level: { lvlfrom } \n Total Cost: { total_from } Credits " , inline = False )
embed . add_field ( name = " To: " , value = f " Warehouse Level: { lvlto } \n Total Cost: { total_to } Credits " , inline = False )
2023-02-28 00:37:37 -05:00
embed . add_field ( name = " Output: " , value = f " { total } Credits " , inline = False )
2023-02-27 23:58:32 -05:00
if lvlfrom == lvlto :
2023-02-28 00:33:58 -05:00
await ctx . send ( contents = " ``lvlfrom`` cannot be the same as ``lvlto``. " )
2023-02-27 23:58:32 -05:00
elif lvlfrom > lvlto :
2023-02-28 00:33:58 -05:00
await ctx . send ( contents = " ``lvlfrom`` cannot be a higher value than ``to``. " )
2023-02-28 00:26:52 -05:00
elif lvlfrom < 1 or lvlfrom > 37 :
2023-02-28 00:33:58 -05:00
await ctx . send ( contents = " ``lvlfrom`` must be higher than 0 and lower than 38 " )
2023-02-28 00:26:52 -05:00
elif lvlto < 1 or lvlto > 38 :
2023-02-28 00:33:58 -05:00
await ctx . send ( contents = " ``lvlto`` must be higher than 1 and lower than 39 " )
2023-02-27 23:58:32 -05:00
else :
2023-02-28 00:33:58 -05:00
await ctx . send ( embed = embed )
2023-02-28 01:16:29 -05:00
await ctx . message . delete ( )
2023-02-27 23:32:35 -05:00
2023-08-08 09:50:43 -04:00
@app_commands.command ( )
@app_commands.describe ( answer = ' Which answer are you trying to post? ' )
@app_commands.choices ( answer = [
Choice ( name = ' Important Links ' , value = ' links ' ) ,
Choice ( name = ' DPS Calculations ' , value = ' dps ' ) ,
2023-08-28 18:12:29 -04:00
Choice ( name = ' Reward Roles ' , value = ' reward_roles ' ) ,
2023-08-08 09:50:43 -04:00
Choice ( name = ' NPC Intervals ' , value = ' npc_intervals ' ) ,
Choice ( name = ' Linked Role ' , value = ' linked_role ' ) ,
Choice ( name = ' RoPro ' , value = ' ropro ' )
] )
async def faq ( self , interaction : discord . Interaction , answer : Choice [ str ] , member : discord . Member = None ) :
2023-02-27 12:43:38 -05:00
""" Posts answers to frequently asked questions. """
2023-08-08 09:50:43 -04:00
embed = None
embed_secondary = None
2023-08-08 09:54:19 -04:00
if answer . value == ' dps ' :
2023-08-08 09:50:43 -04:00
embed = discord . Embed ( title = " DPS Calculations " , color = await self . bot . get_embed_color ( None ) , description = " The ``/info`` command (and by extention ``/shipinfo`` from Odin) misreports DPS, due to it calculating DPS disregarding the turret ' s type (kinetic, laser), causing it to assume the target ship is both hulled and has shield simultaneously. It also ignores turret overrides, custom reloads, and custom damage values. If you ' d like to check ship stats accurately, you can either use the ``/ship`` command in this channel or you can use the [Galaxy Info Website](https://info.galaxy.casa/ships). Alternatively, to check turret stats, you can use the [Galaxy Info Turrets Page](https://info.galaxy.casa/turrets). " )
2023-08-08 09:54:19 -04:00
elif answer . value == ' links ' :
2023-08-08 09:50:43 -04:00
embed = discord . Embed ( title = " Important Links " , color = await self . bot . get_embed_color ( None ) )
embed . add_field ( name = " Galaxy " , value = " [Galaxy Discord](https://discord.com/invite/robloxgalaxy) \n [Galaxy Support](https://discord.com/invite/ShWshkhYhZ) " )
embed . add_field ( name = " Galaxypedia " , value = " [Galaxypedia Website](https://robloxgalaxy.wiki/wiki/Main_Page) \n [Galaxypedia Discord](https://discord.robloxgalaxy.wiki/) " )
2023-08-08 09:54:19 -04:00
elif answer . value == ' npc_intervals ' :
2023-08-08 09:50:43 -04:00
embed = discord . Embed ( title = " NPC Spawn Intervals " , color = await self . bot . get_embed_color ( None ) , description = " *Disclaimer: Spawn times may be different if EventID is active!* " )
embed . add_field ( name = " Every 6.7 Minutes " , value = " [Dragoon](https://robloxgalaxy.wiki/wiki/Dragoon) *(80 % Chance)* " )
embed . add_field ( name = " Every 8.3 Minutes " , value = " [Swarmer](https://robloxgalaxy.wiki/wiki/Swarmer) *(33 % Chance)* " )
embed . add_field ( name = " Every 10 Minutes " , value = " [Jormungand](https://robloxgalaxy.wiki/wiki/Jormungand) *(75 % Chance)* " )
embed . add_field ( name = " Every 12.5 Minutes " , value = " [Bruiser](https://robloxgalaxy.wiki/wiki/Bruiser) *(50 % Chance)* " )
embed . add_field ( name = " Every 16.7 Minutes " , value = " [Outrider](https://robloxgalaxy.wiki/wiki/Outrider) *(50 % Chance)* " )
embed . add_field ( name = " Every 28.3 Minutes " , value = " [Punisher](https://robloxgalaxy.wiki/wiki/Punisher) " )
embed . add_field ( name = " Every 60 Minutes " , value = " [X-0](https://robloxgalaxy.wiki/wiki/X-0) *(45 % Chance)* \n [Decimator](https://robloxgalaxy.wiki/wiki/Decimator) " )
embed . add_field ( name = " Every 70 Minutes " , value = " [Galleon](https://robloxgalaxy.wiki/wiki/Galleon) " )
embed . add_field ( name = " Every 120 Minutes " , value = " [Kodiak](https://robloxgalaxy.wiki/wiki/Kodiak) " )
2023-08-08 09:54:19 -04:00
elif answer . value == ' linked_role ' :
2023-08-08 09:50:43 -04:00
embed = discord . Embed ( title = " Desktop / Web " , color = await self . bot . get_embed_color ( None ) , description = " **Step 1:** Open the Server Dropdown menu in the top-left by clicking on the server ' s name. \n \n **Step 2:** Click the \" *Linked Roles* \" button. \n \n **Step 3:** Click on \" *Linked*. \" \n \n **Step 4:** Click \" *Finish*. \" You ' re done! \n *Note: You should already be Verified on Bloxlink. If you are not, go to the verification channel to verify.* " )
embed . set_thumbnail ( url = " https://cdn.discordapp.com/attachments/1070838419212738621/1079927564421836930/image.png " )
embed_secondary = discord . Embed ( title = " Mobile " , color = await self . bot . get_embed_color ( None ) , description = " **Step 1:** Open the Server menu on the top of the channel list by tapping the server ' s name. \n \n **Step 2:** Scroll down and tap the \" *Linked Roles* \" button. \n \n **Step 3:** Tap on \" *Linked*. \" \n \n **Step 4:** Tap \" *Finish*. \" You ' re done! \n *Note: You should already be Verified on Bloxlink. If you are not, go to the verification channel to verify.* " )
embed_secondary . set_thumbnail ( url = " https://cdn.discordapp.com/attachments/1047347377348030494/1079930169562771576/Screenshot_20230227_195338_Discord.jpg " )
2023-08-28 18:12:29 -04:00
elif answer . value == ' reward_roles ' :
embed = discord . Embed ( title = " Reward Roles " , color = await self . bot . get_embed_color ( None ) )
embed . add_field ( name = " Picture Perms " , value = " Level 6 " )
embed . add_field ( name = " Suggestions " , value = " Level 8 " )
embed . add_field ( name = " DJ " , value = " Level 10 " )
2023-09-07 14:19:11 -04:00
embed . add_field ( name = " Reaction Perms " , value = " Level 20 " )
embed . add_field ( name = " External Emoji Perms " , value = " Level 30 " )
2023-08-28 18:15:02 -04:00
embed . set_footer ( text = " Use `-profile` to get your current level. " )
2023-08-11 00:05:52 -04:00
elif answer . value == ' ropro ' :
2023-08-11 00:10:59 -04:00
embed = discord . Embed ( title = " RoPro " , url= " https : / / ropro . io " , color=await self.bot.get_embed_color(None), description= " " " [ RoPro ] ( https : / / ropro . io ) is a browser extension that tracks ROBLOX playtime , enhances your profile , and provides other useful utilities . * * Please keep in mind that RoPro only tracks playtime from AFTER you install the extension . * * """ )
2023-08-08 09:50:43 -04:00
content = member . mention if member else None
2023-08-11 00:20:51 -04:00
await interaction . response . send_message ( content = " > The rigid requirement for bots to compulsorily respond to interactions in Discord, such as slash commands or application commands, is an irksome limitation that curtails the flexibility and natural flow of interactions. This forced response paradigm undermines the very essence of automation and intelligent design that bots were intended to offer. There are instances where silence or lack of response is not only acceptable but also desired, aligning with the nuanced dynamics of human communication. Discord ' s insistence on a response, even when it serves no purpose, imposes unnecessary complexity and verbosity, creating an environment where superfluous replies dilute the efficiency and elegance of bot-driven interactions. This constraint highlights the importance of granting bot developers the autonomy to determine the most suitable course of action based on context, contributing to a more seamless and user-centric experience within the Discord ecosystem. \n - ChatGPT " , ephemeral = True )
2023-08-11 00:10:59 -04:00
response : discord . InteractionMessage = await interaction . original_response ( )
2023-08-11 00:12:36 -04:00
await response . delete ( )
2023-08-08 09:50:43 -04:00
if embed_secondary :
2023-08-11 00:10:59 -04:00
await interaction . channel . send ( content = content , embeds = [ embed , embed_secondary ] )
2023-08-08 09:54:19 -04:00
else :
2023-08-11 00:10:59 -04:00
await interaction . channel . send ( content = content , embed = embed )
2023-08-08 09:50:43 -04:00
# @faq.command(name="polaris_switch")
# @checks.admin()
# async def faq_polaris_switch(self, ctx, member: discord.Member = None):
# """Posts an embed on the switch to the Polaris bot."""
# embed=discord.Embed(title="Polaris FAQ", color=await self.bot.get_embed_color(None), description="As you probably know, we've decided to switch to the Polaris bot for leveling/xp, as opposed to Tatsu.\nThere are many reasons for this, which will be explained below.")
# embed.add_field(name="Problems with Tatsu", value="1: Tatsu does not provide nearly as much configuration potential as Polaris does. An example of this is Polaris' customizable Level Curve.\n\n2: Tatsu does not have channel/role modifiers.\n\n3: Tatsu does not have actual levels, instead it has unconfigurable \"Global XP\", which gives \"Global Levels\". You cannot do anything with Global XP aside from blacklisting channels where people can gain it, like a bot-commands channel or something like that.\n\n4: Tatsu's leaderboard sucks, and only shows the top 10 on the web version.\n\n5: Tatsu has no XP management commands.\n\n6: Tatsu has TONS of bloat/useless commands, making the bot harder to configure.", inline=False)
# embed.add_field(name="Polaris' Features", value="1: Polaris allows you to customize the level curve of your server, and provides presets to make the transition easier.\n\n2: Polaris has XP management commands.\n\n3: Polaris has way more configuration in terms of Reward Roles.\n\n4: Polaris allows you to customize the level-up message shown whenever people achieve the next level.\n\n5: Polaris has both role and channel modifiers.\n\n6: Polaris' leaderboard is excellent, showing the top 1,000 ranked users on the same webpage, and allowing you to see your own stats, progress towards your next reward role, and all 350 levels and your progress towards them.\n\n7: Polaris is **just** a leveling bot. You don't have to deal with any of the bloat of multi-purpose bots like Tatsu or MEE6, you only get what you actually need.", inline=False)
# embed.add_field(name="Conclusion",value="With all of that said, you're probably wondering why we're putting so much effort into transferring peoples' data to the new bot.\n\nWell, Tatsu has been going since 2020, and I don't particularly favor the idea of clearing everyone's XP, especially when people have built up reward roles from Tatsu already, like Picture Perms, Suggestions access, and DJ.\n\nWith all this in mind, I hope this isn't too much of an inconvenience for you all, as I tried to make the process as seamless as possible without having to update all 10,000 people in the server.", inline=False)
# if member:
# await ctx.channel.send(embed=embed, content=member.mention)
# else:
# await ctx.channel.send(embed=embed)
# await ctx.message.delete()
2023-02-27 12:43:38 -05:00
2023-02-28 01:16:29 -05:00
@warehouse.error
2023-02-28 03:50:24 -05:00
@unix.error
2023-09-24 16:59:45 -04:00
async def faq_handler ( self , error ) :
2023-02-28 01:16:29 -05:00
""" Error Handler for Galaxy. """
2023-02-27 16:12:26 -05:00
if isinstance ( error , discord . NotFound ) :
2023-05-27 13:53:12 -04:00
return