23 lines (16 sloc) 739 Bytes
# frozen_string_literal: true
# Eval bots are useful for developers because they give you a way to execute code directly from your Discord channel,
# e.g. to quickly check something, demonstrate something to other, or something else entirely. Special care must be
# taken since anyone with access to the command can execute arbitrary code on your system which may potentially be
# malicious.
require 'discordrb'
bot = token: '', prefix: '!'
bot.command(:eval, help_available: false) do |event, *code|
break unless == 66237334693085184 # Replace number with your ID
eval code.join(' ')
rescue StandardError
'An error occurred 😞'