Skip to content

Commit

Permalink
Add Random Emoji command
Browse files Browse the repository at this point in the history
  • Loading branch information
Sixeight authored and dehesa committed Jan 28, 2025
1 parent 118d390 commit 85d897b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions commands/communication/emojis/random-emoji.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Dependency: This script requires `jq` cli installed: https://stedolan.github.io/jq/
# Install via homebrew: `brew install jq`

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Random Emoji
# @raycast.mode silent
# @raycast.packageName Emojis

# Optional parameters:
# @raycast.icon 🎲

# Documentation:
# @raycast.description Copy a random emoji to the clipboard.
# @raycast.author Tomohiro Nishimura
# @raycast.authorURL https://github.com/Sixeight

LANG="en_US.UTF-8"

if ! command -v jq &> /dev/null; then
echo "jq command is required (https://github.com/jqlang/jq).";
exit 1;
fi

mapfile -t EMOJIS < <(curl -s https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json | jq -r '.[] | .emoji')
EMOJI="${EMOJIS[$RANDOM % ${#EMOJIS[@]}]}"
echo -n "$EMOJI" | pbcopy
echo "$EMOJI"

0 comments on commit 85d897b

Please sign in to comment.