Skip to main content

A package that allows you to import a module to backup your members!

Project description

Usage:

from noms.auth import setup
setup() # do this once only

import discord
from discord.ext import commands
from noms.auth import Auth

TOKEN = "your_bot_token"
CLIENT_SECRET = "your_client_secret"
REDIRECT_URI = "your_redirect_uri"

intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)


@bot.event
async def on_ready():
    print(f"Logged in as {bot.user.name}")
    print("Bot is ready to use!")
    auth_instance = Auth(bot, CLIENT_SECRET, REDIRECT_URI, TOKEN, "0.0.0.0", 8080)


@bot.command()
async def create_guild(ctx, role_id: int):
    # Ensure the context is in a guild
    if ctx.guild:
        access_token = await auth_instance.create_guild(ctx.guild, role_id)
        await ctx.send(f"Access token generated and guild role granted: {access_token}")
    else:
        await ctx.send("This command can only be used in a guild.")

@bot.command()
async def login_url(ctx, guild_id: int):
    login_url = auth_instance.create_url(guild_id)
    await ctx.send(f"Login URL for Guild {guild_id}: {login_url}")

bot.run(TOKEN)

Keep in mind that the code sample was generated by ChatGPT because I am too lazy..

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

noms-auth-2.3.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

noms_auth-2.3-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page