Sha256: ecc63e842ae887ba6ff0cde9df64f3f51dc445ae7aa86b66bcc9093c8b34868c
Contents?: true
Size: 1.09 KB
Versions: 28
Compression:
Stored size: 1.09 KB
Contents
require "discorb" client = Discorb::Client.new client.once :standby do puts "Logged in as #{client.user}" end client.on :message do |message| next if message.author.bot? next unless message.content.start_with?("eval ") unless message.author.bot_owner?.wait message.reply("You don't have permission to use this command.") next end code = message.content.delete_prefix("eval ").delete_prefix("```rb").delete_suffix("```") message.add_reaction(Discorb::UnicodeEmoji["clock3"]) res = eval("Async { |task| #{code} }.wait", binding, __FILE__, __LINE__) # rubocop:disable Security/Eval message.remove_reaction(Discorb::UnicodeEmoji["clock3"]) message.add_reaction(Discorb::UnicodeEmoji["white_check_mark"]) unless res.nil? res = res.wait if res.is_a? Async::Task message.channel.post("```rb\n#{res.inspect[...1990]}\n```") end rescue Exception => error message.reply embed: Discorb::Embed.new("Error!", "```rb\n#{error.full_message(highlight: false)[...1990]}\n```", color: Discorb::Color[:red]) end client.run(ENV["discord_bot_token"])
Version data entries
28 entries across 28 versions & 1 rubygems