yesnt
This commit is contained in:
parent
da9224a9fa
commit
72bed0925c
0
py/bin/imagematcher.py
Normal file
0
py/bin/imagematcher.py
Normal file
@ -1,5 +1,3 @@
|
||||
import pymongo
|
||||
|
||||
class Storage:
|
||||
def __init__(self, serverid, db):
|
||||
self.serverdb = db[str(serverid)]
|
||||
@ -20,5 +18,4 @@ class Storage:
|
||||
existing_doc[key] = value
|
||||
self.serverdb.replace_one({"module": doc["module"]}, existing_doc)
|
||||
else:
|
||||
self.serverdb.insert_one(doc)
|
||||
|
||||
self.serverdb.insert_one(doc)
|
||||
30
py/bot.py
30
py/bot.py
@ -1,12 +1,30 @@
|
||||
import configparser
|
||||
import discord
|
||||
from discord.ext import bridge
|
||||
import discord
|
||||
import logging
|
||||
|
||||
bot = discord.Bot(
|
||||
help_command="help",
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read("config/bot.conf")
|
||||
|
||||
bot = bridge.Bot(
|
||||
help_command=None,
|
||||
command_prefix="!",
|
||||
intents=discord.Intents.all(),
|
||||
activity=discord.Activity(
|
||||
type=discord.ActivityType.playing,
|
||||
name="with deez nuts",
|
||||
)
|
||||
type=discord.ActivityType.watching,
|
||||
name="you")
|
||||
)
|
||||
bot.run("OTg2NDA4MjM3Njg5NjMwNzYx.GOWW5z.Engl7UzrUyQkmj0hwQi42U-Z-XQ8CZPuMQRFlU")
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
|
||||
bot.load_extension("cogs.reply")
|
||||
bot.load_extension("cogs.repost")
|
||||
# bot.load_extension("cogs.counting")
|
||||
# bot.load_extension("cogs.test")
|
||||
|
||||
|
||||
bot.run(config["MAIN"]["token"])
|
||||
7
py/cogs/counting.py
Normal file
7
py/cogs/counting.py
Normal file
@ -0,0 +1,7 @@
|
||||
from discord.ext import bridge
|
||||
|
||||
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Counting(bot))
|
||||
12
py/cogs/reply.py
Normal file
12
py/cogs/reply.py
Normal file
@ -0,0 +1,12 @@
|
||||
from discord.ext import bridge, commands
|
||||
|
||||
class Reply(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@bridge.bridge_command()
|
||||
async def reply(self, ctx, *args):
|
||||
await ctx.send(args)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Reply(bot))
|
||||
19
py/cogs/repost.py
Normal file
19
py/cogs/repost.py
Normal file
@ -0,0 +1,19 @@
|
||||
from discord.ext import bridge, commands
|
||||
import discord
|
||||
import opencv
|
||||
from bin.imagematcher import imagematcher
|
||||
|
||||
class Repost(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@bridge.bridge_command()
|
||||
async def repost(self, ctx):
|
||||
referenceimgurl = ctx.channel.fetch_message(ctx.message.reference.message_id).attachments[0].url
|
||||
msgs = await ctx.channel.history(limit=50).flatten()
|
||||
for msg in msgs:
|
||||
for attachment in msg.attachments:
|
||||
if imagematcher(attachment.url, referenceimgurl) < 90:
|
||||
await ctx.send(attachment.url)
|
||||
def setup(bot):
|
||||
bot.add_cog(Repost(bot))
|
||||
0
py/config/bot.conf.example
Normal file
0
py/config/bot.conf.example
Normal file
Loading…
Reference in New Issue
Block a user