better system for deployment
This commit is contained in:
@@ -0,0 +1,86 @@
|
|||||||
|
from aura import *
|
||||||
|
from config import *
|
||||||
|
import discord
|
||||||
|
from discord import app_commands
|
||||||
|
from discord.ext import commands
|
||||||
|
|
||||||
|
aura = Aura('aura.json')
|
||||||
|
client = discord.Client(intents=discord.Intents.all())
|
||||||
|
# bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
|
||||||
|
tree = app_commands.CommandTree(client)
|
||||||
|
|
||||||
|
@client.event
|
||||||
|
async def on_ready():
|
||||||
|
print(client.user)
|
||||||
|
for guild in client.guilds:
|
||||||
|
async for member in guild.fetch_members(limit=None):
|
||||||
|
user = aura.get(str(member.id))
|
||||||
|
if user==None:
|
||||||
|
aura.add(str(member.id))
|
||||||
|
aura.save()
|
||||||
|
print(await tree.sync())
|
||||||
|
|
||||||
|
@client.event
|
||||||
|
async def on_message(msg: discord.Message):
|
||||||
|
user = aura.get(str(msg.author.id))
|
||||||
|
user.balance += 3
|
||||||
|
aura.save()
|
||||||
|
|
||||||
|
@client.event
|
||||||
|
async def on_member_join(member: discord.Member):
|
||||||
|
user = aura.get(str(member.id))
|
||||||
|
if not user:
|
||||||
|
user = aura.add(str(member.id))
|
||||||
|
if USE_INVITE_SERVER:
|
||||||
|
member.send(embed=discord.Embed(color=member.color, title='✨ Welcome to ORUS! ✨', description=f'**Aura: {user.balance}\nInvite URL: {INVITE_SERVER_URL+member.id}\nShare this Invite URL to get 120+ aura per person**'))
|
||||||
|
|
||||||
|
@tree.command(name='aura', description='Check the amount of aura a member has')
|
||||||
|
async def get_aura(interaction: discord.Interaction, member: discord.Member = None):
|
||||||
|
aura.load()
|
||||||
|
if member == None:
|
||||||
|
member = interaction.user
|
||||||
|
user = aura.get(str(member.id))
|
||||||
|
embed = discord.Embed(color=member.color, title=f'{member.name}\'s Aura', description=user.to_md())
|
||||||
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
|
@tree.command(name='send', description='Send aura to a member')
|
||||||
|
async def send(interaction: discord.Interaction, to: discord.Member, amount: int, reason: str = ""):
|
||||||
|
aura.load()
|
||||||
|
user = aura.get(str(interaction.user.id))
|
||||||
|
user_to = aura.get(str(to.id))
|
||||||
|
if amount < 0:
|
||||||
|
amount = -amount
|
||||||
|
for r in interaction.user.roles:
|
||||||
|
if r.id in PUNISH_ROLES:
|
||||||
|
if user_to.balance >= amount:
|
||||||
|
user_to.balance -= amount
|
||||||
|
user.balance += 10
|
||||||
|
await to.send(embed=discord.Embed(
|
||||||
|
color=interaction.user.color,
|
||||||
|
title="Punished!",
|
||||||
|
description=f'**By: {interaction.user.name}\nAmount: {amount}\nReason: {reason}**'
|
||||||
|
))
|
||||||
|
await interaction.response.send_message(f'Punished! You gained 10+ aura!', ephemeral=True)
|
||||||
|
aura.save()
|
||||||
|
else:
|
||||||
|
await interaction.response.send_message(f'Cannot punish. {to.name} only has {user_to.balance} aura!', ephemeral=True)
|
||||||
|
return
|
||||||
|
if user.balance >= 10:
|
||||||
|
user.balance -= 10
|
||||||
|
await interaction.response.send_message(f'Cannot punish. You are not a developer.{" -10 aura!" if user.balance>=10 else""}', ephemeral=True)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if user.balance >= amount:
|
||||||
|
user.balance -= amount
|
||||||
|
user_to.balance += amount
|
||||||
|
await to.send(embed=discord.Embed(
|
||||||
|
color=interaction.user.color,
|
||||||
|
title="Aura received!",
|
||||||
|
description=f'**From: {interaction.user.name}\nAmount: {amount}**'
|
||||||
|
))
|
||||||
|
await interaction.response.send_message(f'Sent! You now have {user.balance} aura!', ephemeral=True)
|
||||||
|
aura.save()
|
||||||
|
else:
|
||||||
|
await interaction.response.send_message(f'Cannot send. You only have {user.balance} aura!', ephemeral=True)
|
||||||
|
|
||||||
|
client.run(BOT_TOKEN)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
BOT_TOKEN=os.environ['BOT_TOKEN']
|
||||||
|
USE_INVITE_SERVER=os.environ['USE_INVITE']=='true'
|
||||||
|
INVITE_SERVER_URL='127.0.0.1'
|
||||||
|
INVITE=os.environ['INVITE']
|
||||||
|
PUNISH_ROLES=(1279588925257683014,)
|
||||||
@@ -1,86 +1,18 @@
|
|||||||
from aura import *
|
|
||||||
from config import *
|
from config import *
|
||||||
import discord
|
from subprocess import run as run_start
|
||||||
from discord import app_commands
|
from threading import Thread
|
||||||
from discord.ext import commands
|
|
||||||
|
|
||||||
aura = Aura('aura.json')
|
env = os.environ.copy()
|
||||||
client = discord.Client(intents=discord.Intents.all())
|
|
||||||
# bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
|
|
||||||
tree = app_commands.CommandTree(client)
|
|
||||||
|
|
||||||
@client.event
|
run = lambda a: run_start(a, env=env)
|
||||||
async def on_ready():
|
|
||||||
print(client.user)
|
|
||||||
for guild in client.guilds:
|
|
||||||
async for member in guild.fetch_members(limit=None):
|
|
||||||
user = aura.get(str(member.id))
|
|
||||||
if user==None:
|
|
||||||
aura.add(str(member.id))
|
|
||||||
aura.save()
|
|
||||||
print(await tree.sync())
|
|
||||||
|
|
||||||
@client.event
|
t1 = Thread(target=run, args=(['./.venv/bin/python3', 'invite_sys.py'],))
|
||||||
async def on_message(msg: discord.Message):
|
t2 = Thread(target=run, args=(['./.venv/bin/python3', 'bot.py'],))
|
||||||
user = aura.get(str(msg.author.id))
|
t1.daemon = True
|
||||||
user.balance += 3
|
t2.daemon = True
|
||||||
aura.save()
|
if USE_INVITE_SERVER:t1.start()
|
||||||
|
t2.start()
|
||||||
@client.event
|
while 1:
|
||||||
async def on_member_join(member: discord.Member):
|
if input() == 'q':
|
||||||
user = aura.get(str(member.id))
|
if USE_INVITE_SERVER:t1.join(0)
|
||||||
if not user:
|
t2.join(0)
|
||||||
user = aura.add(str(member.id))
|
|
||||||
if USE_INVITE_SERVER:
|
|
||||||
member.send(embed=discord.Embed(color=member.color, title='✨ Welcome to ORUS! ✨', description=f'**Aura: {user.balance}\nInvite URL: {INVITE_SERVER_URL+member.id}\nShare this Invite URL to get 120+ aura per person**'))
|
|
||||||
|
|
||||||
@tree.command(name='aura', description='Check the amount of aura a member has')
|
|
||||||
async def get_aura(interaction: discord.Interaction, member: discord.Member = None):
|
|
||||||
aura.load()
|
|
||||||
if member == None:
|
|
||||||
member = interaction.user
|
|
||||||
user = aura.get(str(member.id))
|
|
||||||
embed = discord.Embed(color=member.color, title=f'{member.name}\'s Aura', description=user.to_md())
|
|
||||||
await interaction.response.send_message(embed=embed)
|
|
||||||
|
|
||||||
@tree.command(name='send', description='Send aura to a member')
|
|
||||||
async def send(interaction: discord.Interaction, to: discord.Member, amount: int, reason: str = ""):
|
|
||||||
aura.load()
|
|
||||||
user = aura.get(str(interaction.user.id))
|
|
||||||
user_to = aura.get(str(to.id))
|
|
||||||
if amount < 0:
|
|
||||||
amount = -amount
|
|
||||||
for r in interaction.user.roles:
|
|
||||||
if r.id in PUNISH_ROLES:
|
|
||||||
if user_to.balance >= amount:
|
|
||||||
user_to.balance -= amount
|
|
||||||
user.balance += 10
|
|
||||||
await to.send(embed=discord.Embed(
|
|
||||||
color=interaction.user.color,
|
|
||||||
title="Punished!",
|
|
||||||
description=f'**By: {interaction.user.name}\nAmount: {amount}\nReason: {reason}**'
|
|
||||||
))
|
|
||||||
await interaction.response.send_message(f'Punished! You gained 10+ aura!', ephemeral=True)
|
|
||||||
aura.save()
|
|
||||||
else:
|
|
||||||
await interaction.response.send_message(f'Cannot punish. {to.name} only has {user_to.balance} aura!', ephemeral=True)
|
|
||||||
return
|
|
||||||
if user.balance >= 10:
|
|
||||||
user.balance -= 10
|
|
||||||
await interaction.response.send_message(f'Cannot punish. You are not a developer.{" -10 aura!" if user.balance>=10 else""}', ephemeral=True)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
if user.balance >= amount:
|
|
||||||
user.balance -= amount
|
|
||||||
user_to.balance += amount
|
|
||||||
await to.send(embed=discord.Embed(
|
|
||||||
color=interaction.user.color,
|
|
||||||
title="Aura received!",
|
|
||||||
description=f'**From: {interaction.user.name}\nAmount: {amount}**'
|
|
||||||
))
|
|
||||||
await interaction.response.send_message(f'Sent! You now have {user.balance} aura!', ephemeral=True)
|
|
||||||
aura.save()
|
|
||||||
else:
|
|
||||||
await interaction.response.send_message(f'Cannot send. You only have {user.balance} aura!', ephemeral=True)
|
|
||||||
|
|
||||||
client.run(BOT_TOKEN)
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Flask
|
||||||
|
discord.py
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
from config import *
|
|
||||||
from subprocess import run
|
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
t1 = Thread(target=run, args=(['./.venv/bin/python3', 'invite_sys.py'],))
|
|
||||||
t2 = Thread(target=run, args=(['./.venv/bin/python3', 'main.py'],))
|
|
||||||
t1.daemon = True
|
|
||||||
t2.daemon = True
|
|
||||||
if USE_INVITE_SERVER:t1.start()
|
|
||||||
t2.start()
|
|
||||||
while 1:
|
|
||||||
if input() == 'q':
|
|
||||||
if USE_INVITE_SERVER:t1.join(0)
|
|
||||||
t2.join(0)
|
|
||||||
Reference in New Issue
Block a user