Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit e7c8a5a

Browse files
committed
userinfo
1 parent 47a774c commit e7c8a5a

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

config/initializers/string.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class String
2+
def to_id
3+
self.gsub(/\D/, '').to_i
4+
end
5+
end

cord/discord/commands/userinfo.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module Cord
2+
module Commands
3+
extend Discordrb::Commands::CommandContainer
4+
5+
# Meant to use locally only.
6+
command :userinfo, help_available: false do |event, *args|
7+
event.respond "Ah Ah Ah! you didn't say the magic word!\n (No eris admin sapo ql y la ctm teoiasacarlachucha)" and break unless "#{event.user.id}" == $owner_id
8+
9+
mention_id = args.first.to_id
10+
if event.server.members.include? mention_id
11+
member = event.server.members.select { |member| member.id == mention_id}.first
12+
else
13+
"Member not found!"
14+
return
15+
end
16+
17+
event.channel.send_embed do |embed|
18+
embed.title = "**#{member.display_name}**"
19+
embed.colour = 0xcc0000
20+
embed.timestamp = Time.now
21+
22+
embed.add_field(name: "Server ID", value: "#{member.id}")
23+
embed.add_field(name: "Discord ID", value: "#{member.username}##{member.discriminator}")
24+
embed.add_field(name: "Joined at", value: "#{member.joined_at.strftime('%D %H:%M:%S')}")
25+
embed.add_field(name: "Roles", value: "#{member.roles.collect(&:name).join(', ')}")
26+
embed.add_field(name: "Admin", value: "#{member.roles.collect{|role| role.permissions.administrator}.any?}")
27+
end
28+
end
29+
end
30+
end

cord/utils/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module DiscordBot
1+
module Cord
22
VERSION = "3.0.0"
33
end

0 commit comments

Comments
 (0)