Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbyperson committed Sep 6, 2024
0 parents commit 9705709
Show file tree
Hide file tree
Showing 37 changed files with 9,062 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/annotator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Annotator
on: [push, pull_request]


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff check --output-format=github .
10 changes: 10 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Format check
on: [push, pull_request]


jobs:
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jpetrucciani/black-check@master
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
__pycache__
andy
bougegram
data
victory.mp3
madibanocaro.mp3
config.py
secret.py
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
}
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# [Nocaro](https://discord.com/api/oauth2/authorize?client_id=746934062446542925&permissions=277632642112&scope=bot%20applications.commands)

## About

Nocaro is a multi-purpose discord bot. It's main appeal is it's wide selection of economy commands. Users are able to earn and gamble Bouge Bucks, a fake currency.

Nocaro was essentially my introducion to programming, and therefore contains a LOT of really dumb code. You should be careful if you decide to use this project as example code for anything.

## Issues

This is not the version of Nocaro currently running on the public bot. This is because the current version is held together with gum and chicken wire. I'm currently working on cleaning a lot of the code to make easier to work on Nocaro in the future. If you decide to run this bot locally you will likely run into a LOT of issues.

## Contributing

Feel free to make a PR for __anything you like__. All bug fixes, refactors, and features are more than welcome.

Additionally, if you find any bugs or would like to request a feature, please open an issue.
Binary file added audio/done.mp3
Binary file not shown.
Binary file added audio/end.mp3
Binary file not shown.
Binary file added audio/faster.mp3
Binary file not shown.
Binary file added audio/hugefuckingwin.mp3
Binary file not shown.
Binary file added audio/hugewin.mp3
Binary file not shown.
Binary file added audio/singleplayer.WAV
Binary file not shown.
Binary file added audio/skip.WAV
Binary file not shown.
Binary file added audio/start.mp3
Binary file not shown.
Binary file added audio/test.mp3
Binary file not shown.
84 changes: 84 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import discord
import random
import os
import asyncio
from discord.ext import commands
from discord.ext import tasks
from pretty_help import PrettyHelp
import config


async def main():
# start the client
async with client:
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
await client.load_extension(f"cogs.{filename[:-3]}")
await client.start(config.token)


intents = discord.Intents().all()
client = commands.Bot(command_prefix=",", intents=intents, help_command=PrettyHelp())


@tasks.loop(seconds=30)
async def change_status(statuses):
await client.change_presence(activity=discord.Game(random.choice(statuses)))


@client.command(hidden=True)
async def load(ctx, extension):
if ctx.author.id == config.owner_id:
await client.load_extension(f"cogs.{extension}")
await ctx.send(f"{extension} loaded.")
if ctx.author.id != config.owner_id:
await ctx.send("no")


@client.command(hidden=True)
async def unload(ctx, extension):
if ctx.author.id == config.owner_id:
await client.unload_extension(f"cogs.{extension}")
await ctx.send(f"{extension} unloaded.")

if ctx.author.id != config.owner_id:
await ctx.send("no")


@client.command(hidden=True)
async def reload(ctx, extension):
if ctx.author.id == config.owner_id:
await client.unload_extension(f"cogs.{extension}")
await ctx.send(f"{extension} unloaded.")
await client.load_extension(f"cogs.{extension}")
await ctx.send(f"{extension} loaded.")
else:
await ctx.send("no")


async def guilds():
return client.guilds


async def users():
return client.users


@client.event
async def on_ready():
print("I am ready.")
statuses = [
",help | ,invite",
f"Currently in {str(len(await guilds()))} guilds",
f"I can see {str(len(await users()))} users",
]
change_status.start(statuses)
try:
synced = await client.tree.sync()
print(f"Sycned {len(synced)} commands!")
except Exception as e:
print(e)


discord.utils.setup_logging()
asyncio.run(main())
89 changes: 89 additions & 0 deletions cogs/autoresponse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import discord
from discord.ext import commands
import random as rd
import aiosqlite

bank = "./data/database.sqlite"


class Autoresponse(commands.Cog):
def __init__(self, client):
self.client = client

# events
@commands.Cog.listener()
async def on_ready(self):
print("autoresponse ready")

async def check_ignored(self, channel):
async with aiosqlite.connect(bank) as db:
cursor = await db.cursor()
await cursor.execute(
"SELECT * FROM ignore WHERE channelID = ?", (channel.id,)
)
result = await cursor.fetchone()
if result is not None:
return True
else:
return False

@commands.Cog.listener()
async def on_message(self, message):
reactto = str.lower(message.content)
andy = rd.randint(1, 57)
if message.author == self.client.user:
return
elif message.author.bot:
return
elif await self.check_ignored(message.channel):
return
elif self.client.user.mentioned_in(message):
await message.channel.send(message.author.mention)
elif "the dark knight" in reactto:
await message.channel.send(
'Did you know in the batman movie "The Dark Knight Rises" there is a split second scene where you can see a cameraman?',
file=discord.File("camera.jpg", "camera.jpg"),
)
elif "etterna" in reactto:
await message.channel.send("OSU!!!")
elif "touhou" in reactto:
await message.channel.send("toe hoe")
elif "owo" == reactto:
await message.channel.send("uwu")
elif "uwu" == reactto:
await message.channel.send("owo")
elif "pandavert" in reactto:
await message.channel.send(":panda_face:")
elif "sponsor" in reactto:
await message.channel.send(
"today's annoying auto response message is sponsored by RAID: Shadow Legends."
)
elif "min min" in reactto:
await message.channel.send("i fucking hate min min")
elif "hate these autoresponses" in reactto:
await message.channel.send("oh yeah? i don't like you either buster")
elif "quack" in reactto:
await message.channel.send("quack")
elif "ryan gosling" in reactto:
await message.channel.send("he's literally me")
elif "jackbox" in reactto:
jackbox = "<:GO:893517923472277536>"
await message.add_reaction(jackbox)
elif andy <= 55:
if "send andy pics" in reactto:
await message.channel.send(
"Andy image get!",
file=discord.File("./andy/" + f"{andy}" + ".jpg", "Andy.jpg"),
)
elif andy >= 55:
if "send andy pics" in reactto:
await message.channel.send(
"Andy video get!",
file=discord.File("./andy/" + f"{andy}" + ".mp4", "Andy.mp4"),
)
elif "pick it up" in reactto:
await message.channel.send("SKAAAAAAAAAA!")


async def setup(client):
await client.add_cog(Autoresponse(client))
Loading

0 comments on commit 9705709

Please sign in to comment.