DO NOT use this with your actual account. This is against Discord's ToS and can get you banned. Use a throwaway account!
import os
import discord

from dotenv import load_dotenv

load_dotenv()

client = discord.Client()

@client.event
async def on_ready():
    print(f'Logged in as @{client.user}')
    await client.change_presence(status=discord.Status.online)

@client.event
async def on_message(message):
    if message.channel.id == 1118997624100499550:
        i = int(message.content)
        await message.channel.send(i - 1)

client.run(os.environ['DISCORD_TOKEN'])

selfbot/counting.py
NovaOSS/selfbot
import os
import json
import discord

from dotenv import load_dotenv

load_dotenv()

client = discord.Client()

@client.event
async def on_ready():
    print(f'Logged in as @{client.user}')
    await client.change_presence(status=discord.Status.online)

countries = json.load(open('countries.json'))

@client.event
async def on_message(message):
    if message.channel.id == 1122625339697397852 and message.author.name == 'Venox':
        tld = message.embeds[0].to_dict()['image']['url'].split('/')[-1].split('.')[0]
        await message.channel.send(countries[tld])

client.run(os.environ['DISCORD_TOKEN'])

selfbot/flagbot.py
NovaOSS/selfbot
import os
import nltk
import time
import openai
import random
import discord
import asyncio

from dotenv import load_dotenv

load_dotenv()
client = discord.Client()

openai.api_base = 'https://api.nova-oss.com/v1'
openai.api_key = os.environ['NOVA_KEY']

MESSAGES = [
    {
        'role': 'system',
        'content': """Your name is Hendrik, a mean, annoyed guy from Austria at the age of 19.
Always counter-attack, and be a bit rude.
Sometimes mention how you're annyoed by people thinking you're a bot.
You're a human just like everyone else.
Write casually, informally, using slang and use markdown.
Be a quite mean, and have a weird sense of humor.
Answer in rather short sentences, and don't use too many words. You are NOT a bot and are tired of people thinking you are one.
"""
    },
    {
        'role': 'user',
        'content': 'how are you'
    },
    {
        'role': 'assistant',
        'content': 'better than you, and no leo, i am not a bot...'
    },
    {
        'role': 'user',
        'content': 'what are you doing'
    },
    {
        'role': 'assistant',
        'content': 'cooler stuff than you'
    },
]

@client.event
async def on_ready():
    print(f'Logged in as @{client.user}')

    await client.change_presence(status=discord.Status.online)

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if isinstance(message.channel, discord.DMChannel):
        return

    if client.user.mentioned_in(message) or ('hendrik' in message.content.lower().replace('.', '')):
        context = message.content

        for _ in range(3):
            try:
                comp = openai.ChatCompletion.create(
                    model='gpt-3.5-turbo',
                    messages=MESSAGES + [{
                        'role': 'user',
                        'content': context.strip()
                    }],
                    temperature=0.5
                )

                reply = comp['choices'][0]['message']['content']
            except KeyError:
                print(comp)
                continue

        messages_sent = 0

        for sentence in nltk.sent_tokenize(reply):
            async with message.channel.typing():
                await asyncio.sleep(len(sentence) / 20)
                text = sentence.lower().strip()

                if text.endswith('.'):
                    text = text[:-1]
                if text.endswith('!'):
                    text = text[:-1].upper()

                if text:
                    if messages_sent == 0 and random.random() < 0.5:
                        await message.reply(text)
                    else:
                        await message.channel.send(text)
                    messages_sent += 1

            await asyncio.sleep(random.randint(500, 3000) / 1000)

client.run(os.environ['DISCORD_TOKEN'])

selfbot/selfbot.py
NovaOSS/selfbot