Skip to content

Commit

Permalink
COPYPASTAAAAAAAAA
Browse files Browse the repository at this point in the history
  • Loading branch information
CBCicada committed Mar 22, 2024
1 parent c9154a1 commit 53f29b3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cogs/copypasta/copypasta.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,copypasta
0,"emacs","Using eMacs actually has nothing to do with productivity. In fact, I’m not even trying to optimize it. I simply think it’s a good tool for keeping me organized. Why do some people live their life in a constant state of disarray, rushing from place to place, never knowing what they need to do besides their immediate task, constantly worrying about their deadlines when they can instead live in peace? Emacs is one of the many tools I use to organize my life, to take my mind off the things that don’t matter and let a machine remember for me. I live knowing that, at the end of the day, everything will be ok. There’s nothing urgent that needs to be on my mind because I have written it down for thought later. Emacs is not about productivity. Emacs is about organization, a system I can tune to my needs, so that I can live a stress-free, fulfilling life. - Richard"
1,"test","testtttttttttt"
56 changes: 56 additions & 0 deletions cogs/copypasta/copypasta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import interactions
from interactions import Extension, SlashContext

from lib.util import command, subcommand

import csv
import os
import random

filepath = os.path.dirname(os.path.abspath(__file__)) + "/copypasta.csv"

class copypasta(Extension):

def __init__(self,bot):
self.id_lst = []
self.name_lst = []
self.pasta_lst = []
with open(filepath) as csvfile:
reader = csv.reader(csvfile)
row = next(reader)
for row in reader:
self.id_lst.append(row[0])
self.name_lst.append(row[1])
self.pasta_lst.append(row[2])


@subcommand(id={'description': "copypasta id"})
async def byid(self, ctx: SlashContext, id: int) -> None:
"""copypasta by id"""
for exist_id in self.id_lst:
if int(exist_id) == id:
await ctx.send(self.pasta_lst[self.id_lst.index(str(id))])
return
await ctx.send("Not Found")




@subcommand(name={'description': "copypasta name"})
async def byname(self, ctx: SlashContext, name: str) -> None:
"""copypasta by name"""
for exist_name in self.name_lst:
if exist_name == name:
await ctx.send(self.pasta_lst[self.name_lst.index(name)])
return
await ctx.send("Not Found")

@byname.autocomplete("name")
async def find_name(self, ctx: interactions.AutocompleteContext):
'''Autocomplete that provides challenge categories for chal create'''
await ctx.send(self.name_lst)

@subcommand()
async def random(self, ctx: SlashContext) -> None:
"""random copypasta"""
await ctx.send(random.choice(self.pasta_lst))

0 comments on commit 53f29b3

Please sign in to comment.