<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mattis</title>
    <description>The latest articles on DEV Community by Mattis (@bytewave1).</description>
    <link>https://dev.to/bytewave1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4198246%2F9fa8f28b-2be7-40c3-81a5-668135929c72.png</url>
      <title>DEV Community: Mattis</title>
      <link>https://dev.to/bytewave1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bytewave1"/>
    <language>en</language>
    <item>
      <title>I got tired of decoding Discord permission numbers, so I built an offline CLI for it</title>
      <dc:creator>Mattis</dc:creator>
      <pubDate>Wed, 21 Oct 2026 11:35:43 +0000</pubDate>
      <link>https://dev.to/bytewave1/i-got-tired-of-decoding-discord-permission-numbers-so-i-built-an-offline-cli-for-it-2fhc</link>
      <guid>https://dev.to/bytewave1/i-got-tired-of-decoding-discord-permission-numbers-so-i-built-an-offline-cli-for-it-2fhc</guid>
      <description>&lt;p&gt;If you build Discord bots, you keep hitting the same small questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When was this account or server created?&lt;/li&gt;
&lt;li&gt;What permissions are hiding in &lt;code&gt;274878286912&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Which integer do I pass for these three intents?&lt;/li&gt;
&lt;li&gt;Why does the gateway close my connection with &lt;code&gt;4014&lt;/code&gt;?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The usual answers are a random web calculator, a REPL with a bitshift you half remember, or a scroll through the docs. I wanted one command for each of them, so I built &lt;strong&gt;dkit&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;dkit snowflake 175928847299117063
&lt;span class="go"&gt;175928847299117063
  Created      2016-04-30T11:18:25.796Z
  Unix ms      1462015105796
  Discord ms   41944705796
  Worker ID    1
  Process ID   0
  Increment    7
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Permissions work in both directions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;dkit perms &lt;span class="nt"&gt;--names&lt;/span&gt; SEND_MESSAGES,MANAGE_ROLES
&lt;span class="go"&gt;Permissions 268437504
  hex 0x0000000010000800

  SEND_MESSAGES                        0x0000000000000800  [T/V/S]
  MANAGE_ROLES                         0x0000000010000000  [2FA, T/V/S]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Intents come with a warning about privileged ones, which is the classic reason a bot suddenly sees empty message content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;dkit intents GUILDS,GUILD_MESSAGES,MESSAGE_CONTENT
&lt;span class="go"&gt;Intents 33281
  hex 0x8201  (3 of 21 known intents)

  GUILDS                           1 &amp;lt;&amp;lt; 0    21 events
  GUILD_MESSAGES                   1 &amp;lt;&amp;lt; 9    4 events
  MESSAGE_CONTENT                  1 &amp;lt;&amp;lt; 15   no events  [privileged]

Privileged intents in this value:
  - MESSAGE_CONTENT
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is also &lt;code&gt;dkit invite&lt;/code&gt;, which builds a correctly encoded OAuth2 invite URL, and &lt;code&gt;--json&lt;/code&gt; on every command if you want to script it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design decisions I care about
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Offline, always.&lt;/strong&gt; dkit never makes a network request and never asks for a bot token. That means it is safe to run on a shared machine, and you can paste its output into a bug report without thinking twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No dependencies.&lt;/strong&gt; Standard library only, so installing it pulls in nothing else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Honest data.&lt;/strong&gt; None of the Discord constants are hard-coded in the logic. They live in JSON files that record the official source URL and the date they were last checked against the docs. If a value is ever wrong, there is exactly one place to fix it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Big numbers done right.&lt;/strong&gt; Permission values already go beyond 32 bits. dkit uses Python's arbitrary-precision integers, and in JSON mode it emits permission values as strings, the same way the Discord API does.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned shipping my first PyPI package
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The first upload of a name is the moment it becomes yours. I found out the hard way that PyPI can refuse a name even when &lt;code&gt;pip index versions&lt;/code&gt; says it is free, so check early and have a second name ready.&lt;/li&gt;
&lt;li&gt;Test on TestPyPI first, but expect the name there to be taken more often than on the real index.&lt;/li&gt;
&lt;li&gt;Read the long description of your own package page before you upload. It is frozen for that version.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it, break it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;pip install dkit-cli
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command is &lt;code&gt;dkit&lt;/code&gt;. The source is on GitHub: &lt;a href="https://github.com/Bytewave1/dkit" rel="noopener noreferrer"&gt;https://github.com/Bytewave1/dkit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd really like feedback, bug reports and wrong values. There are also a few issues marked "good first issue" (channel types, timestamp formatting, shell completion) if you want to contribute your first PR.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;dkit is an unofficial tool and is not affiliated with or endorsed by Discord.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>discord</category>
      <category>python</category>
      <category>cli</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
