cronokirby / alchemy

A discord library for Elixir
MIT License
152 stars 34 forks source link

Getting caller's voice channel id #128

Closed InverMN closed 2 years ago

InverMN commented 2 years ago

As in title, it there an easy way to get command caller's current voice channel id if any?

joathanmf commented 2 years ago
Cogs.def ping do
    {:ok, guild_id} = Cogs.guild_id()
    {:ok, %GuildMember{user: %User{id: user_id}}} = Cogs.member()
    {:ok, %VoiceState{channel_id: channel_id}} = Cache.voice_state(guild_id, user_id)

    Cogs.say("Channel ID: " <> channel_id)
end