Exemple #1
0
async def ListenThisChannel(message):
    db.custom_insert(f"""UPDATE ServerConfigs SET 
    listen_channels = '{{"{message.channel.id}"}}' WHERE id={message.guild.id}"""
                     )

    await message.channel.send(
        "A partir de agora receberei comandos exclusivamente neste canal")
Exemple #2
0
async def ListenChannel(message):
    db.custom_insert(f"""UPDATE ServerConfigs SET 
    listen_channels = array_cat(listen_channels,'{{ {message.channel.id} }}')
    WHERE id={message.guild.id}""")

    await message.channel.send(
        "A partir de agora receberei comandos neste canal")
Exemple #3
0
async def IgnoreChannel(message):
    db.custom_insert(f"""UPDATE ServerConfigs SET 
    listen_channels = array_remove(listen_channels,'{message.channel.id}')
    WHERE id={message.guild.id}""")

    await message.channel.send(
        "A partir de agora ignorarei comandos neste canal")
Exemple #4
0
async def UnsetAutorole(message):
    db.custom_insert(f"""UPDATE ServerConfigs SET
            role = Null
            WHERE id = {message.guild.id}
            """)

    await message.channel.send(
        "O sistema de autorole foi desativado com sucesso")
Exemple #5
0
async def UnsetWelcome(message):

    db.custom_insert(f"""UPDATE ServerConfigs SET
    welcome_channel= NULL ,
    welcome_message= NULL
    WHERE id = {message.guild.id}
     """)

    await message.channel.send(
        "O sistema de recepção de membros foi desativado com sucesso")
Exemple #6
0
def countPoints(server_id: int, user_id: int, chars: int):

    date = datetime.now().date()
    date -= timedelta(days=date.weekday())

    #Limits the amount of points from one message to 100
    chars = min(chars, 100)

    db.custom_insert(f"""INSERT INTO Rank 
    VALUES ({user_id},{server_id},'{date}',1,{chars}) 
    ON CONFLICT(user_id,server_id,date) DO UPDATE SET 
    messages = Rank.messages+1,chars = Rank.chars+{chars} """)
Exemple #7
0
async def SetWelcome(message):

    args = comms.ParseArguments(message.content)

    text = args["t"].split('"')[1]
    text = text.replace("¬", "-")

    db.custom_insert(f"""UPDATE ServerConfigs SET
    welcome_channel={message.channel.id},
    welcome_message='{text}'
    WHERE id = {message.guild.id}
     """)

    await message.channel.send(
        f"""A partir de agora este é o canal de recepção,com a seguinte mensagem: `{text}`"""
    )
Exemple #8
0
async def SetAutorole(message):

    args = comms.ParseArguments(message.content)

    role_id = int(args["r"])
    role = message.guild.get_role(role_id)

    if (role == None):
        await message.channel.send("ID inválido")
        return

    role_id = int(args["r"])

    db.custom_insert(f"""UPDATE ServerConfigs SET
            role = {role_id}
            WHERE id = {message.guild.id}
            """)

    await message.channel.send(
        f"A partir de agora todos os novos membros receberão o cargo {role.name}"
    )
Exemple #9
0
def CountMessage(server_id: int):
    db.custom_insert(f"""INSERT INTO Messages 
    VALUES ({server_id},'{datetime.now().date()}',1) ON CONFLICT(Date,Server) 
    DO UPDATE SET Num = Messages.Num+1""")
from core.CRUD import db
from psycopg2.errors import DuplicateTable

try:
    server.CreateServerTable()
    rank.CreateRankTable()
    messages.CreateMessagesTable()

except DuplicateTable:
    print("Tables already exists")
    print(
        "TYPE 'reset' IN ORDER TO DELETE THE OLD TABLES AND CREATE NEW ONES. BE CAREFULL, THIS WILL ERASE ALL DATA"
    )

    if (input().lower() == 'reset'):
        db.custom_insert("DROP TABLE ServerConfigs")
        db.custom_insert("DROP TABLE Rank")
        db.custom_insert("DROP TABLE Messages")

        server.CreateServerTable()
        rank.CreateRankTable()
        messages.CreateMessagesTable()

f = open("localToken.txt", "w")
f.write("Remove this and paste your bot token here")
f.close()
f = open("immoral_chars.json", "w")
f.write("""{
    "𝓘" : "I",
    "𝓪" : "a",
    "𝓶": "m",