-- | Discord tokens
module Calamity.Types.Token
    ( Token(..)
    , formatToken
    , rawToken ) where

import           Data.Text

import           GHC.Generics

import           TextShow
import qualified TextShow.Generic as TSG

data Token
  = BotToken Text
  | UserToken Text
  deriving ( (forall x. Token -> Rep Token x)
-> (forall x. Rep Token x -> Token) -> Generic Token
forall x. Rep Token x -> Token
forall x. Token -> Rep Token x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Token x -> Token
$cfrom :: forall x. Token -> Rep Token x
Generic, Int -> Token -> ShowS
[Token] -> ShowS
Token -> String
(Int -> Token -> ShowS)
-> (Token -> String) -> ([Token] -> ShowS) -> Show Token
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Token] -> ShowS
$cshowList :: [Token] -> ShowS
show :: Token -> String
$cshow :: Token -> String
showsPrec :: Int -> Token -> ShowS
$cshowsPrec :: Int -> Token -> ShowS
Show )
  deriving ( Int -> Token -> Builder
Int -> Token -> Text
Int -> Token -> Text
[Token] -> Builder
[Token] -> Text
[Token] -> Text
Token -> Builder
Token -> Text
Token -> Text
(Int -> Token -> Builder)
-> (Token -> Builder)
-> ([Token] -> Builder)
-> (Int -> Token -> Text)
-> (Token -> Text)
-> ([Token] -> Text)
-> (Int -> Token -> Text)
-> (Token -> Text)
-> ([Token] -> Text)
-> TextShow Token
forall a.
(Int -> a -> Builder)
-> (a -> Builder)
-> ([a] -> Builder)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> TextShow a
showtlList :: [Token] -> Text
$cshowtlList :: [Token] -> Text
showtl :: Token -> Text
$cshowtl :: Token -> Text
showtlPrec :: Int -> Token -> Text
$cshowtlPrec :: Int -> Token -> Text
showtList :: [Token] -> Text
$cshowtList :: [Token] -> Text
showt :: Token -> Text
$cshowt :: Token -> Text
showtPrec :: Int -> Token -> Text
$cshowtPrec :: Int -> Token -> Text
showbList :: [Token] -> Builder
$cshowbList :: [Token] -> Builder
showb :: Token -> Builder
$cshowb :: Token -> Builder
showbPrec :: Int -> Token -> Builder
$cshowbPrec :: Int -> Token -> Builder
TextShow ) via TSG.FromGeneric Token

formatToken :: Token -> Text
formatToken :: Token -> Text
formatToken (BotToken Text
t) = Text
"Bot " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t
formatToken (UserToken Text
t) = Text
t

rawToken :: Token -> Text
rawToken :: Token -> Text
rawToken (BotToken Text
t) = Text
t
rawToken (UserToken Text
t) = Text
t