-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package emoji | ||
|
||
import ( | ||
"math/rand" | ||
"strings" | ||
"time" | ||
|
||
"github.com/kamaln7/klein/alias" | ||
) | ||
|
||
// Provider implements an alias generator | ||
type Provider struct { | ||
Config *Config | ||
} | ||
|
||
// ensure that the storage.Provider interface is implemented | ||
var _ alias.Provider = new(Provider) | ||
|
||
// Config contains the configuration for the file storage | ||
type Config struct { | ||
Length int | ||
randSource *rand.Rand | ||
} | ||
|
||
var emojis = []string{"👍", "👎", "👽", "👼", "😠", "😧", "😲", "👟", "👶", "👙", "👱", "👱♀️", "😊", "👢", "🙇", "🙇", "👦", "👰", "💼", "👤", "👥", "🤙", "👏", "🌂", "🤡", "😰", "😖", "😕", "👷", "👷♀️", "👫", "👨❤️👨", "💑", "👩❤️👩", "👨❤️💋👨", "💏", "👩❤️💋👩", "🤠", "🤞", "👑", "😢", "😿", "💃", "👯♂️", "👯", "🕶", "😞", "😥", "😵", "👗", "🤤", "👂", "😑", "👁", "👓", "👀", "🤕", "🤒", "👊", "👨👦", "👨👦👦", "👨👧", "👨👧👦", "👨👧👧", "👨👨👦", "👨👨👦👦", "👨👨👧", "👨👨👧👦", "👨👨👧👧", "👪", "👨👩👦👦", "👨👩👧", "👨👩👧👦", "👨👩👧👧", "👩👦", "👩👦👦", "👩👧", "👩👧👦", "👩👧👧", "👩👩👦", "👩👩👦👦", "👩👩👧", "👩👩👧👦", "👩👩👧👧", "😨", "🕵️♀️", "✊", "🤛", "🤜", "😳", "👣", "😦", "☹", "🙍♂️", "🙍", "🖕", "👻", "👧", "😬", "😁", "😀", "💂", "💂♀️", "💇♂️", "💇", "👜", "🤝", "😍", "😻", "👠", "🤗", "😯", "👿", "😇", "👺", "👹", "👖", "😂", "😹", "👘", "💋", "😗", "😽", "😚", "😘", "😙", "😆", "👄", "💄", "🤥", "🕵", "👨", "👨🎨", "👨🚀", "👨🍳", "🕺", "🤦", "👨🏭", "👨🌾", "👨🚒", "👨⚕️", "🤵", "👨⚖️", "👨🔧", "👨💼", "👨✈️", "👨🔬", "🤷♂️", "👨🎤", "👨🎓", "👨🏫", "👨💻", "👲", "👳", "👞", "😷", "💆♂️", "💆", "🤘", "🤑", "🎓", "🤶", "💪", "💅", "🤢", "👔", "🤓", "😐", "🙅♂️", "🙅", "😶", "👃", "👌", "🙆♂️", "🙆", "👴", "👵", "👐", "😮", "😔", "😣", "👇", "👈", "👉", "☝", "👆", "👮", "👮♀️", "💩", "👝", "😾", "🙎♂️", "🙎", "🙏", "🤰", "🤴", "👸", "👛", "😡", "🤚", "✋", "🖐", "🙌", "🙋♂️", "🙋", "☺️", "😌", "⛑", "💍", "🤖", "🤣", "🙄", "🏃", "🏃♀️", "👡", "🎅", "🎒", "😱", "🙀", "🤳", "💀", "😴", "😪", "🙁", "🙂", "😄", "😸", "😃", "😺", "😈", "😏", "😼", "🤧", "😭", "🗣", "😛", "😝", "😜", "😎", "😓", "😅", "🤔", "💁♂️", "💁", "😫", "👅", "🎩", "😤", "👕", "👬", "👭", "😒", "🙃", "✌", "🖖", "🚶", "🚶♀️", "👋", "😩", "😉", "👩", "👩🎨", "👩🚀", "👩🍳", "🤦♀️", "👩🏭", "👩🌾", "👩🚒", "👩⚕️", "👩⚖️", "👩🔧", "👩💼", "👩✈️", "👩🔬", "🤷", "👩🎤", "👩🎓", "👩🏫", "👩💻", "👳♀️", "👚", "👒", "😟", "✍", "😋", "🤐", "💤", "🐜", "🐤", "🎍", "🦇", "🐻", "🐞", "🐦", "🌼", "🐡", "🐗", "💥", "💐", "🐛", "🦋", "🌵", "🐫", "🐱", "🐈", "🌸", "🌰", "🐔", "🐿", "🎄", "☁️", "🌩", "⛈", "🌧", "🌨", "☄", "🐮", "🐄", "🦀", "🌙", "🐊", "💨", "🌳", "🦌", "💫", "🐶", "🐕", "🐬", "🕊", "🐉", "🐲", "🐪", "💧", "🦆", "🦅", "🌾", "🌍", "🌎", "🌏", "🐘", "🌲", "🍂", "🔥", "🌓", "🌛", "🐟", "🌫", "🍀", "🦊", "🐸", "🌕", "🌝", "🐐", "🦍", "🐹", "🐥", "🐣", "🙉", "🌿", "🌺", "🐝", "🐴", "🎃", "🐨", "🌗", "🌜", "🍃", "🐆", "🦁", "🦎", "🍁", "🐒", "🐵", "🐭", "🐁", "🍄", "🌑", "🌚", "🌊", "🐙", "☂", "🦉", "🐂", "🌴", "🐼", "⛅", "🐾", "🐧", "🐷", "🐖", "🐽", "🐩", "🐰", "🐇", "🐎", "🐏", "🐀", "🦏", "🐓", "🌹", "🦂", "🙈", "🌱", "☘", "🦈", "🐑", "🐚", "🦐", "🐌", "🐍", "❄️", "⛄", "☃", "✨", "🙊", "🕷", "🕸", "🦑", "⭐", "🌟", "🌥", "🌦", "🌤", "🌞", "🌻", "☀️", "💦", "🎋", "🐯", "🐅", "🌪", "🐠", "🌷", "🦃", "🐢", "☔", "🦄", "🌘", "🌖", "🐃", "🌒", "🌔", "🐳", "🐋", "🥀", "🌬", "🐺", "⚡", "🍎", "🥑", "🍼", "🥓", "🥖", "🍌", "🍺", "🍻", "🍱", "🎂", "🍞", "🌯", "🍰", "🍬", "🥕", "🍾", "🧀", "🍒", "🍫", "🥂", "🍸", "☕", "🍪", "🌽", "🥐", "🥒", "🍛", "🍮", "🍡", "🍩", "🥚", "🍆", "🍥", "🍴", "🍳", "🍤", "🍟", "🍇", "🍏", "🥗", "🍔", "🍯", "🌶", "🌭", "🍨", "🍦", "🥝", "🍋", "🍭", "🍖", "🍈", "🥛", "🍢", "🥞", "🍑", "🥜", "🍐", "🍍", "🍕", "🍽", "🍿", "🥔", "🍗", "🍜", "🍚", "🍙", "🍘", "🍶", "🥘", "🍧", "🍝", "🥄", "🍲", "🍓", "🥙", "🍣", "🍠", "🌮", "🍊", "🍵", "🍅", "🍹", "🥃", "🍉", "🍷", "🥇", "🥈", "🥉", "🎱", "🎨", "🏸", "⚾", "🏀", "⛹", "⛹️♀️", "🛀", "🚴", "🚴♀️", "🏹", "🎳", "🥊", "🕴", "🎪", "🎬", "🏏", "🎯", "🥁", "🏑", "🎣", "🏈", "🎲", "🥅", "⛳", "🏌", "🏌️♀️", "🎸", "🎧", "🏇", "🏒", "⛸", "🤸♂️", "🤹♂️", "🤾♂️", "🤽♂️", "🥋", "🎖", "🏅", "🤼♂️", "🎤", "🚵", "🚵♀️", "🎹", "🎼", "🎭", "🤺", "🏓", "🎗", "🏵", "🚣", "🚣♀️", "🏉", "🎽", "🎷", "🎿", "⛷", "🎰", "🏂", "⚽", "👾", "🏄", "🏄♀️", "🏊", "🏊♀️", "🎾", "🎫", "🎟", "🏆", "🎺", "🎮", "🎻", "🏐", "🏋", "🏋️♀️", "🤸♀️", "🤹♀️", "🤾♀️", "🤽♀️", "🤼♀️", "🚡", "✈️", "🚑", "⚓", "🚛", "🛰", "🏦", "🏖", "🚲", "🚙", "🌉", "🏗", "🚅", "🚄", "🚌", "🚏", "🏕", "🛶", "🎠", "🏁", "⛪", "🌇", "🌆", "🏙", "🏛", "🚧", "🏪", "🏬", "🏚", "🏜", "🏝", "🏰", "🏤", "🏭", "🎡", "⛴", "🚒", "🎆", "🛬", "🛫", "🌁", "⛲", "⛽", "🚁", "🏥", "🏨", "🏠", "🏡", "🏘", "🗾", "🏯", "🕋", "🛴", "🚈", "🏩", "🚇", "🌌", "🚐", "🚝", "🕌", "🛥", "🛵", "🏍", "🛣", "🗻", "⛰", "🚠", "🚞", "🏔", "🏞", "🌃", "🏢", "🚘", "🚍", "🚔", "🚖", "🛳", "🚓", "🏣", "🏎", "🚃", "🛤", "🌈", "🚗", "🎑", "🚀", "🎢", "🚨", "⛵", "🏫", "💺", "⛩", "🚢", "🛩", "🎇", "🚤", "🏟", "🌠", "🚉", "🗽", "🚂", "🌅", "🌄", "🚟", "🕍", "🚕", "⛺", "🗼", "🚜", "🚥", "🚋", "🚆", "🚊", "🚎", "🚚", "🚦", "🌋", "💒", "⏰", "⚗", "🏺", "⚖", "🎈", "🗳", "📊", "💈", "🛁", "🔋", "🛏", "🛎", "🏴", "✒️", "📘", "💣", "🔖", "📑", "📚", "💡", "📆", "📲", "📷", "📸", "🕯", "🗃", "📇", "🗂", "💿", "⛓", "📉", "📈", "🗜", "📋", "📕", "🔐", "⚰", "💻", "🖱", "🎊", "🎛", "🛋", "🖍", "💳", "🎌", "⚔", "🔮", "🗡", "📅", "🖥", "💵", "🎎", "🚪", "📀", "📧", "🔌", "✉️", "📩", "💶", "📠", "🗄", "📁", "📽", "🎞", "🎏", "🔦", "💾", "🖋", "🖼", "⚱", "⚙", "💎", "🎁", "📗", "🔫", "🔨", "⚒", "🛠", "🔪", "🕳", "⌛", "⏳", "📥", "📨", "📱", "🏮", "🕹", "🔑", "⌨", "🏷", "📒", "🎚", "🔗", "🔒", "🔏", "💌", "🔍", "🔎", "📫", "📪", "📬", "📭", "🕰", "📝", "🔬", "💽", "💸", "💰", "🎥", "🗿", "📰", "🗞", "📓", "📔", "🔩", "🛢", "🗝", "📖", "📂", "📙", "📤", "📦", "📄", "📃", "📟", "🖌", "📎", "🖇", "⛱", "🖊", "✏️", "☎️", "⛏", "💊", "📯", "📮", "💷", "📿", "🖨", "📌", "📻", "🏳️🌈", "🎀", "📍", "📡", "✂️", "📜", "🛡", "🛍", "🛒", "🚿", "☠", "🛌", "🚬", "🗓", "🗒", "⏱", "📏", "🎙", "💉", "🎉", "📞", "🔭", "🌡", "⏲", "🚽", "🖲", "🚩", "📐", "📺", "🔓", "📼", "📹", "🗑", "⌚", "🏳", "🎐", "🗺", "🔧", "💴", "💯", "🔢", "🅰️", "🆎", "🔤", "🔡", "🉑", "💢", "♒", "♈", "◀️", "⏬", "⏫", "⬇️", "🔽", "▶️", "⤵️", "⤴️", "⬅️", "↙️", "↘️", "➡️", "↪️", "⬆️", "↕️", "🔼", "↖️", "↗️", "🔃", "🔄", "*⃣", "🏧", "⚛", "🅱️", "🚼", "🔙", "🛄", "☑️", "‼️", "🔰", "🔔", "☣", "⚫", "🖤", "🃏", "⬛", "◾", "◼️", "▪️", "🔲", "💙", "💔", "♋", "🔠", "♑", "💹", "🚸", "🎦", "🆑", "🕐", "🕙", "🕥", "🕚", "🕦", "🕛", "🕧", "🕜", "🕑", "🕝", "🕒", "🕞", "🕓", "🕟", "🕔", "🕠", "🕕", "🕡", "🕖", "🕢", "🕗", "🕣", "🕘", "🕤", "♣️", "㊗️", "🆒", "©️", "💘", "➰", "💱", "🛃", "🌀", "💠", "♦️", "🚯", "8️⃣", "✴️", "✳️", "🔚", "❗", "⏩", "5️⃣", "⚜", "🎴", "4️⃣", "🆓", "♊", "💝", "🌐", "💚", "❕", "❔", "#️⃣", "❤️", "💟", "💓", "💗", "♥️", "✔️", "➗", "💲", "❣", "➖", "✖️", "➕", "🔆", "♨️", "🆔", "🉐", "ℹ️", "⁉️", "🔟", "🈁", "🔵", "🔷", "🔶", "✝", "🛅", "↔️", "↩️", "♌", "♎", "➿", "🔊", "📢", "🔅", "Ⓜ️", "🀄", "📣", "🕎", "🚹", "📴", "🎵", "🔇", "📛", "❎", "🆕", "⏭", "🆖", "9️⃣", "🔕", "🚳", "⛔", "🚫", "📵", "🚷", "🚭", "🚱", "🎶", "⭕", "🅾️", "🆗", "🕉", "🔛", "1️⃣", "⛎", "☦", "🅿️", "〽️", "🛂", "⏸", "☮", "♓", "🛐", "⏯", "🚰", "⏮", "💜", "🚮", "❓", "🔘", "☢", "⏺", "♻️", "🔴", "®️", "🔁", "🔂", "🚻", "💞", "⏪", "🗯", "🈂️", "♐", "♏", "㊙️", "7️⃣", "📶", "6️⃣", "🔯", "🔹", "🔸", "🔺", "🔻", "🔜", "🆘", "🔉", "♠️", "❇️", "💖", "🔈", "💬", "☪", "✡", "⏹", "🛑", "🔣", "♉", "💭", "3️⃣", "™️", "🔝", "🔱", "🔀", "2️⃣", "💕", "🈹", "🈴", "🈺", "🈯", "🈷️", "🈶", "🈵", "🈚", "🈸", "🈲", "🈳", "🔞", "🆙", "📳", "♍", "🆚", "⚠️", "〰️", "🚾", "☸", "♿", "✅", "⚪", "💮", "⬜", "◽", "◻️", "▫️", "🔳", "🚺", "❌", "💛", "☯", "0️⃣", "🇦🇫", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦🇴", "🇦🇮", "🇦🇶", "🇦🇬", "🇦🇷", "🇦🇲", "🇦🇼", "🇦🇺", "🇦🇹", "🇦🇿", "🇧🇸", "🇧🇭", "🇧🇩", "🇧🇧", "🇧🇾", "🇧🇪", "🇧🇿", "🇧🇯", "🇧🇲", "🇧🇹", "🇧🇴", "🇧🇦", "🇧🇼", "🇧🇷", "🇮🇴", "🇻🇬", "🇧🇳", "🇧🇬", "🇧🇫", "🇧🇮", "🇰🇭", "🇨🇲", "🇨🇦", "🇮🇨", "🇨🇻", "🇧🇶", "🇰🇾", "🇨🇫", "🇹🇩", "🇨🇱", "🇨🇽", "🇨🇳", "🇨🇨", "🇨🇴", "🇰🇲", "🇨🇬", "🇨🇩", "🇨🇰", "🇨🇷", "🇨🇮", "🇭🇷", "🇨🇺", "🇨🇼", "🇨🇾", "🇨🇿", "🇩🇪", "🇩🇰", "🇩🇯", "🇩🇲", "🇩🇴", "🇪🇨", "🇪🇬", "🇸🇻", "🇬🇶", "🇪🇷", "🇪🇸", "🇪🇪", "🇪🇹", "🇪🇺", "🇫🇰", "🇫🇴", "🇫🇯", "🇫🇮", "🇫🇷", "🇬🇫", "🇵🇫", "🇹🇫", "🇬🇦", "🇬🇲", "🇬🇪", "🇬🇭", "🇬🇮", "🇬🇷", "🇬🇱", "🇬🇩", "🇬🇵", "🇬🇺", "🇬🇹", "🇬🇬", "🇬🇳", "🇬🇼", "🇬🇾", "🇭🇹", "🇭🇳", "🇭🇰", "🇭🇺", "🇮🇸", "🇮🇳", "🇮🇩", "🇮🇷", "🇮🇶", "🇮🇪", "🇮🇲", "🇮🇱", "🇮🇹", "🇯🇲", "🇯🇪", "🇯🇴", "🇯🇵", "🇰🇿", "🇰🇪", "🇰🇮", "🇽🇰", "🇰🇷", "🇰🇼", "🇰🇬", "🇱🇦", "🇱🇻", "🇱🇧", "🇱🇸", "🇱🇷", "🇱🇾", "🇱🇮", "🇱🇹", "🇱🇺", "🇲🇴", "🇲🇰", "🇲🇬", "🇲🇼", "🇲🇾", "🇲🇻", "🇲🇱", "🇲🇹", "🇲🇭", "🇲🇶", "🇲🇷", "🇲🇺", "🇾🇹", "🇲🇽", "🇫🇲", "🇲🇩", "🇲🇨", "🇲🇳", "🇲🇪", "🇲🇸", "🇲🇦", "🇲🇿", "🇲🇲", "🇳🇦", "🇳🇷", "🇳🇵", "🇳🇱", "🇳🇨", "🇳🇿", "🇳🇮", "🇳🇪", "🇳🇬", "🇳🇺", "🇳🇫", "🇰🇵", "🇲🇵", "🇳🇴", "🇴🇲", "🇵🇰", "🇵🇼", "🇵🇸", "🇵🇦", "🇵🇬", "🇵🇾", "🇵🇪", "🇵🇭", "🇵🇳", "🇵🇱", "🇵🇹", "🇵🇷", "🇶🇦", "🇷🇪", "🇷🇴", "🇷🇺", "🇷🇼", "🇼🇸", "🇸🇲", "🇸🇹", "🇸🇦", "🇸🇳", "🇷🇸", "🇸🇨", "🇸🇱", "🇸🇬", "🇸🇽", "🇸🇰", "🇸🇮", "🇸🇧", "🇸🇴", "🇿🇦", "🇬🇸", "🇸🇸", "🇱🇰", "🇧🇱", "🇸🇭", "🇰🇳", "🇱🇨", "🇵🇲", "🇻🇨", "🇸🇩", "🇸🇷", "🇸🇿", "🇸🇪", "🇨🇭", "🇸🇾", "🇹🇼", "🇹🇯", "🇹🇿", "🇹🇭", "🇹🇱", "🇹🇬", "🇹🇰", "🇹🇴", "🇹🇷", "🇹🇹", "🇹🇳", "🇹🇲", "🇹🇨", "🇹🇻", "🇺🇬", "🇬🇧", "🇺🇦", "🇦🇪", "🇺🇾", "🇺🇸", "🇻🇮", "🇺🇿", "🇻🇺", "🇻🇦", "🇻🇪", "🇻🇳", "🇼🇫", "🇪🇭", "🇾🇪", "🇿🇲", "🇿🇼"} | ||
|
||
// New initializes the alias generator and returns a new instance | ||
func New(c *Config) *Provider { | ||
c.randSource = rand.New(rand.NewSource(time.Now().UnixNano())) | ||
|
||
provider := &Provider{ | ||
Config: c, | ||
} | ||
|
||
return provider | ||
} | ||
|
||
// Generate returns a random alias | ||
func (p *Provider) Generate() string { | ||
var ( | ||
b strings.Builder | ||
n = len(emojis) | ||
) | ||
|
||
for i := 0; i < p.Config.Length; i++ { | ||
b.WriteString(emojis[p.Config.randSource.Intn(n)]) | ||
} | ||
|
||
return b.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters