Sha256: 75610cc55639c166cb7551eb61a580d3a42ddd3b0c021cd69082e4181c5c9161
Contents?: true
Size: 903 Bytes
Versions: 2
Compression:
Stored size: 903 Bytes
Contents
# frozen_string_literal: true require "discorb" client = Discorb::Client.new localizations = { localized: { text: { en: "Hello, %s!", ja: "%sさん、こんにちは!", }, }, } client.once :standby do puts "Logged in as #{client.user}" end client.slash({ default: "greet", ja: "挨拶", }, { default: "Bot greets. Cute OwO", ja: "Botが挨拶します。かわいいね", }, { "name" => { name_localizations: { ja: "名前", }, description: { default: "The name to greet.", ja: "挨拶する人の名前。", }, type: :string, optional: true, }, }) do |interaction, name| interaction.post( format((localizations[:localized][:text][interaction.locale] || localizations[:localized][:text][:en]), name || interaction.target.to_s_user), ephemeral: true, ) end client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil))
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discorb-0.17.1 | examples/commands/slash.rb |
discorb-0.17.0 | examples/commands/slash.rb |