This is a Python package to create a snowflake identifier similar to Discord's or Twitter's.

Overview

snowflake2

Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord.

Installation instructions

Installation is easy. Just read the docs below then run this command:

pip install snowflake2==0.1.1

Docs

make_snowflake

This is a function to generate a snowflake.

This function does not return an integer snowflake - it returns a string.

Paramters are listed below.

Here's an example if you want to look at it after reading the below docs:

make_snowflake(time.time(), 0, 0, 0)

timestamp_ms

This is an epoch time paramter. You can get one by running time.time().

Basically, an oversimplified description of the way a snowflake works is by looking at a "twepoch", then subtracting a normal epoch from it (but there are other factors in it, as detailed in the rest of this documentation). That is why you need a timestamp_ms.

Note that the default twepoch is 1639853814 here, but Twitter's is 1288834974657

Discord has some information on this as well. image

worker_id

This can be used internally to keep track of the worker for each snowflake, inspired by Discord's snowflake system.

process_id

This can be used internally to keep track of the process for each snowflake, inspired by Discord's snowflake system.

Discord's documentation shown in worker_id also applies here.

increment_id

This can be used to keep track of 12-bit increments for every generated ID on the aforementioned process.

snowflakeToTime

Converts a snowflake to a Python datetime.

Takes a snowflake ID argument only and converts it to a datetime.

Example:

snowflakeToTime(make_snowflake(time.time(), 0, 0, 0))
You might also like...
Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

A small Python app to create Notion pages from Jira issues
A small Python app to create Notion pages from Jira issues

Jira to Notion This little program will capture a Jira issue and create a corresponding Notion subpage. Mac users can fetch the current issue from the

A Python script to create customised Spotify playlists using the JSON, Spotipy Library and Spotify Web API, based on seed tracks in your history.

A Python script to create customised Spotify playlists using the JSON, Spotipy Library and Spotify Web API, based on seed tracks in your history.

Create Basic ERC20 token with Solidity, Brownie and Python
Create Basic ERC20 token with Solidity, Brownie and Python

Create Basic ERC20 token with Solidity, Brownie and Python Demo Check out Cornell Token on Rinnkeby network with Etherscan. Installation Install brown

QR-Code-Grabber - A python script that allows a person to create a qr code token grabber
QR-Code-Grabber - A python script that allows a person to create a qr code token grabber

Qr Code Grabber Description Un script python qui permet a une personne de creer

Use GitHub Actions to create a serverless service.

ActionServerless - Use GitHub Actions to create a serverless service ActionServerless is an action to do some computing and then generate a string/JSO

Attempting to create a framework for Discord Slash commands... yes

discord_slash.py Attempting to create a framework for Discord Slash commands... yes Installation pip install slashpy Documentation Coming soon™ Why is

Releases(0.1.1)
Owner
Learnloot
Learnloot is developing a 1st-8th grade math-teaching game. This organization contains some open-source packages we use.
Learnloot
Uses discords api to see if a token has a valid payment method.

Discord Payment Checker Uses discords api to see if a token has a valid payment method. Report Bug · Request Feature Features Checks tokens Checks all

dropout 10 Dec 1, 2022
This script will detect changes in your session using Discords built in Gateway.

Detect Session Gateway This script will detect changes in your session using Discords built in Gateway. What does this log? Discord build version Oper

Omega 5 Dec 18, 2021
Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord.

python-snowflake-2 Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord. Docs make_snowflake This

null 2 Mar 19, 2022
A Fork of Gitlab's Permifrost tool for managing Snowflake Permissions

permifrost-fork This is a fork of the GitLab permifrost project. As the GitLab team is not currently maintaining the project, we've taken on maintenac

Hightouch 7 Oct 13, 2021
One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them.

AwesomeVersion One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind

Joakim Sørensen 39 Dec 31, 2022
A discord bot with a leveling system (similar to mee6).

Discord.py A discord bot with a leveling system (like mee6) Pre-requisites Knowing how to get create an app/bot via discord's developer portal. Websit

null 26 Dec 11, 2022
Python Package For MTN Zambia Momo API. This package can also be used by MTN momo in other countries.

MTN MoMo API Lite Python Client Power your apps with Lite-Python MTN MoMo API Usage Installation Add the latest version of the library to your project

Mathews Musukuma 7 Jan 1, 2023
troposphere - Python library to create AWS CloudFormation descriptions

troposphere - Python library to create AWS CloudFormation descriptions

null 4.8k Jan 6, 2023
A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create custom messages by telling the bot with Commands.

A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create custom messages by telling the bot with Commands.

Aran 1 Oct 13, 2021
Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run First add src to PYTHONPATH: export PYTHONPATH=${PWD} Then run: pyt

Ali Hejazizo 12 Dec 24, 2022