Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beansy's Rewrite #43

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
4787f3c
Merge pull request #4 from FireEmblemUniverse/everythingassembler
boviex Jun 22, 2017
d4e1c7f
Merge pull request #5 from FireEmblemUniverse/search_better
boviex Jun 23, 2017
e1ad898
Merge pull request #7 from FireEmblemUniverse/ree
boviex Jul 28, 2017
d26b4c4
Delete memes.py
Beansy2000 Nov 27, 2020
9c8f1c4
Delete helpful.py
Beansy2000 Nov 27, 2020
978f05f
Delete reactions.py
Beansy2000 Nov 27, 2020
9c1dc8b
Delete feubot_local.py
Beansy2000 Nov 27, 2020
6687773
Add files via upload
Beansy2000 Nov 28, 2020
e1e1910
Add files via upload
Beansy2000 Nov 30, 2020
662c905
Add files via upload
Beansy2000 Dec 1, 2020
4160c66
Add files via upload
Beansy2000 Dec 1, 2020
3ffdb2f
Add files via upload
Beansy2000 Dec 2, 2020
1497552
Delete __pycache__ directory
Beansy2000 Jan 25, 2021
fac3d40
Delete casual directory
Beansy2000 Jan 25, 2021
c7780b9
Delete disgusting directory
Beansy2000 Jan 25, 2021
9f4d68f
Delete goofs directory
Beansy2000 Jan 25, 2021
1c1d5c2
Delete .gitattributes
Beansy2000 Jan 25, 2021
4c5b4ad
Delete feubotFormatter.py
Beansy2000 Jan 25, 2021
ee21678
Delete feubot.py
Beansy2000 Jan 25, 2021
434b25e
Delete helpful.py
Beansy2000 Jan 25, 2021
c02b43a
Delete memes.py
Beansy2000 Jan 25, 2021
175d555
Delete reactions.py
Beansy2000 Jan 25, 2021
811c1f2
Delete test.py
Beansy2000 Jan 25, 2021
e642719
Add files via upload
Beansy2000 Jan 25, 2021
9643777
Add files via upload
Beansy2000 Jan 25, 2021
16f373a
Add files via upload
Beansy2000 Jan 25, 2021
c587ef1
Add files via upload
Beansy2000 Jan 25, 2021
833e571
Add files via upload
Beansy2000 Jan 25, 2021
8870e50
Add files via upload
Beansy2000 Jan 25, 2021
02bfc85
Delete a22.jpg
Beansy2000 Jan 25, 2021
14bef41
Delete a23.jpg
Beansy2000 Jan 25, 2021
4f49bb7
Delete a19.png
Beansy2000 Jan 25, 2021
da5c2bd
Renamed create_embed
Beansy2000 Jan 25, 2021
ce2296b
Delete New Text Document.txt
Beansy2000 Jan 25, 2021
c53c159
Add files via upload
Beansy2000 Jan 25, 2021
5aaf30f
Delete Reactions.py
Beansy2000 Jan 25, 2021
9da37e3
Delete Memes.py
Beansy2000 Jan 25, 2021
d8e2f6c
Delete Local.py
Beansy2000 Jan 25, 2021
51c0134
Delete cogs/__pycache__ directory
Beansy2000 Jan 25, 2021
a4ce73a
Delete cogs/New folder directory
Beansy2000 Jan 25, 2021
043ae37
Delete Helpful.py
Beansy2000 Jan 25, 2021
bba0d44
Delete Animals.py
Beansy2000 Jan 25, 2021
e5ff16a
Add files via upload
Beansy2000 Jan 25, 2021
4036ab7
Update helpful.py
Beansy2000 Jan 25, 2021
0f5e619
Rename FEUBot.py to NewFEUBot.py
Beansy2000 Jan 25, 2021
949781c
Add files via upload
Beansy2000 Jan 25, 2021
8eefc89
Delete feubot.py
Beansy2000 Jan 25, 2021
80f1d9c
Delete helpful.py
Beansy2000 Jan 25, 2021
c91d57c
Delete memes.py
Beansy2000 Jan 25, 2021
1a3ea5a
Delete reactions.py
Beansy2000 Jan 25, 2021
d809081
Add files via upload
Beansy2000 Jan 25, 2021
24fb667
Update NewFEUBot.py
Beansy2000 Jan 25, 2021
8cc2304
Update NewFEUBot.py
Beansy2000 Jan 25, 2021
9759cf5
Delete NewFEUBot.py
Beansy2000 Jan 25, 2021
8c17ebc
Add files via upload
Beansy2000 Jan 25, 2021
d121a71
Merge branch 'master' into master
Beansy2000 Jan 25, 2021
104a4c7
Delete helpful.py
Beansy2000 Jan 25, 2021
519a5c2
Delete memes.py
Beansy2000 Jan 25, 2021
8f94acd
Delete reactions.py
Beansy2000 Jan 25, 2021
e04e49c
Add files via upload
Beansy2000 Feb 1, 2021
cf35b6f
Add files via upload
Beansy2000 Feb 1, 2021
c6afa28
Add files via upload
Beansy2000 Feb 25, 2021
3275e80
Add files via upload
Beansy2000 Feb 25, 2021
3530139
Add files via upload
Beansy2000 Feb 25, 2021
751d58e
Add files via upload
Beansy2000 Feb 25, 2021
4d4b7f2
Delete README.md
Beansy2000 Feb 25, 2021
7dc9761
Delete .gitignore
Beansy2000 Feb 25, 2021
048ef74
Add files via upload
Beansy2000 Feb 25, 2021
9acacc9
Update memes.py
Beansy2000 Feb 25, 2021
e388b09
Update feubot.py
Beansy2000 Feb 25, 2021
0bc365f
Update feubot.py
Beansy2000 Feb 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .gitattributes

This file was deleted.

Binary file added BMis.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Cheers.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FEU_Seal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Letha_Seal_of_Approval.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions NewFEUBot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import discord
Beansy2000 marked this conversation as resolved.
Show resolved Hide resolved
import os
from discord.ext import commands
import sys, traceback
from sys import argv
from dotenv import load_dotenv
import re
import random
import urllib
import urllib.request
import urllib.error
import json
from feubotFormatter import FeubotFormatter

bot = commands.Bot(command_prefix = "!")

def trunc_to(ln, s):
if len(s) >= ln: return s
else: return s[:ln-3] + "..."


def feuSearchEmbed(posts, threads, term):
Beansy2000 marked this conversation as resolved.
Show resolved Hide resolved
feu_search_base = "http://feuniverse.us/search?q=%s"
feu_post_base = "http://feuniverse.us/t/{}/{}"

result = discord.Embed(
title="Search results",
url=feu_search_base % term,
description="Found %d results" % len(posts),
color=0xde272c)
for i,post in enumerate(posts[:5]):
result.add_field(
name='Post in "%s" by %s' % (threads[i]["title"], post["name"]),
value="[%s](%s)" %
(trunc_to(50, post["blurb"]),
feu_post_base.format(post["topic_id"], post["post_number"])),
inline=False)
if len(posts) > 5:
result.set_footer(text="Truncated %d result(s)." % (len(posts)-5))
return result

@bot.command()
async def load(ctx, extension):
bot.load_extension(f"cogs.{extension}")

@bot.command()
async def unload(ctx, extension):
bot.unload_extension(f"cogs.{extension}")

for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")

@bot.command()
async def search(ctx, *, term):
"""search feu"""
root = "http://feuniverse.us/search.json?q=%s"
payload = urllib.parse.quote(term)
with urllib.request.urlopen(root % payload) as query:
try:
data = json.loads(query.read().decode())
posts = data["posts"]
threads = data["topics"]
await ctx.send(embed=feuSearchEmbed(posts, threads, payload))
except urllib.error.URLError:
await ctx.send("Error accessing FEU server, please try again later.")


@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
await bot.change_presence(activity=discord.Game(name="Eating some beans."))



bot.run("discordbotkey")
Binary file added Sain.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Thunksplosion.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tikis_in_orbit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed __pycache__/feubotFormatter.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/helpful.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/memes.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/mycog.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/reactions.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/useful.cpython-35.pyc
Binary file not shown.
Binary file added animals/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a13.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a15.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a16.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a20.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a21.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a24.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a25.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a27.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added animals/a28.jpg
Binary file added animals/a29.jpg
Binary file added animals/a30.png
Binary file added animals/a31.png
Binary file added animals/a32.jpg
Binary file added animals/a4.png
Binary file added animals/a5.gif
Binary file added animals/a6.png
Binary file added animals/a7.png
Binary file added animals/a8.jpeg
Binary file added animals/a9.jpg
Binary file added approved.png
Binary file added awful.jpg
Binary file added bunnies/bun1.jpeg
Binary file added bunnies/bun10.jpg
Binary file added bunnies/bun11.jpg
Binary file added bunnies/bun12.jpg
Binary file added bunnies/bun13.jpg
Binary file added bunnies/bun14.jpg
Binary file added bunnies/bun15.jpg
Binary file added bunnies/bun16.jpg
Binary file added bunnies/bun17.jpg
Binary file added bunnies/bun18.jpg
Binary file added bunnies/bun19.jpg
Binary file added bunnies/bun2.jpg
Binary file added bunnies/bun20.jpg
Binary file added bunnies/bun21.jpg
Binary file added bunnies/bun22.jpg
Binary file added bunnies/bun23.jpg
Binary file added bunnies/bun24.jpg
Binary file added bunnies/bun25.jpg
Binary file added bunnies/bun26.jpg
Binary file added bunnies/bun27.jpg
Binary file added bunnies/bun3.jpg
Binary file added bunnies/bun4.jpg
Binary file added bunnies/bun5.jpg
Binary file added bunnies/bun6.jpg
Binary file added bunnies/bun7.jpg
Binary file added bunnies/bun8.jpg
Binary file added bunnies/bun9.jpg
Binary file added cats/cat1.jpg
Binary file added cats/cat10.jpg
Binary file added cats/cat11.jpg
Binary file added cats/cat12.jpg
Binary file added cats/cat13.jpg
Binary file added cats/cat14.jpg
Binary file added cats/cat15.jpg
Binary file added cats/cat16.jpg
Binary file added cats/cat17.jpg
Binary file added cats/cat18.jpg
Binary file added cats/cat19.jpg
Binary file added cats/cat2.jpg
Binary file added cats/cat20.jpg
Binary file added cats/cat21.jpg
Binary file added cats/cat22.jpg
Binary file added cats/cat23.jpg
Binary file added cats/cat24.jpg
Binary file added cats/cat25.jpg
Binary file added cats/cat26.jpg
Binary file added cats/cat27.jpg
Binary file added cats/cat28.jpg
Binary file added cats/cat29.jpg
Binary file added cats/cat3.jpg
Binary file added cats/cat30.jpg
Binary file added cats/cat4.jpg
Binary file added cats/cat5.jpg
Binary file added cats/cat6.jpg
Binary file added cats/cat7.jpg
Binary file added cats/cat8.jpg
Binary file added cats/cat9.jpg
36 changes: 36 additions & 0 deletions cogs/animals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import discord
import os
import random
from discord.ext import commands

class Animals(commands.Cog):

def __init__(self, bot):
self.bot = bot

@commands.Cog.listener()
async def on_ready(self):
print('Animals Cog is online')

@commands.command()
async def cat(self, ctx, *args):
catlist = os.listdir("./cats")
await ctx.send(file=discord.File("./cats/"+random.choice(catlist)))

@commands.command()
async def dog(self, ctx, *args):
doglist = os.listdir("./dogs")
await ctx.send(file=discord.File("./dogs/"+random.choice(doglist)))

@commands.command()
async def bunny(self, ctx, *args):
bunlist = os.listdir("./bunnies")
await ctx.send(file=discord.File("./bunnies/"+random.choice(bunlist)))

@commands.command()
async def animal(self, ctx, *args):
anilist = os.listdir("./animals")
await ctx.send(file=discord.File("./animals/"+random.choice(anilist)))

def setup(bot):
bot.add_cog(Animals(bot))
104 changes: 104 additions & 0 deletions cogs/helpful.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import discord
from discord.ext import commands
import os
import random


class Helpful(commands.Cog):

def __init__(self, bot):
self.bot = bot

@commands.Cog.listener()
async def on_ready(self):
print('Helpful Cog is online')

@commands.command()
async def report7z(self, ctx):
"""Report7z reminder"""
await ctx.send("Please send report7z.")
await ctx.send("https://dw.ngmansion.xyz/doku.php?id=en:guide:febuildergba:report7z")

@commands.command()
async def howtomod(self, ctx):
"""Gives information on how to use the !mod command."""
await ctx.send("First, have Developer Mode enabled (Settings -> Appearance -> Developer Mode).")
await ctx.send("Then, click the `...` by the offending message, and click \"Copy Link\".")
await ctx.send("Then simple say !mod <n> <link>, where <n> is the rule it violates, and <link> is the pasted link to the message.")
await ctx.send("If you do not have Developer Mode, you may instead of a link, write a short description of where the infraction took place, and by who.")
await ctx.send("Note that after requesting moderation, the message requesting moderation will be removed.")


@commands.command()
async def goldmine(self, ctx):
"""everything you ever wanted"""
embed=discord.Embed(title="Unified FE Hacking Dropbox", url='https://www.dropbox.com/sh/xl73trcck2la799/AAAMdpNSGQWEzYkLEQEiEhGFa?dl=0', description="All the hacking resources you could ever need, in one place", color=0xefba01)
await ctx.send(embed=embed)


@commands.command(aliases=["repo"])
async def repository(self, ctx):
"""graphics for you"""
embed=discord.Embed(title="Emblem Anims", url='https://emblem-anims.herokuapp.com/', description="Get your animations here (credits missing on some, check just in case!)", color=0x4286f4)
await ctx.send(embed=embed)

@commands.command()
async def mugs(self, ctx):
"""Link to image of all GBAFE mugs."""
await ctx.send("http://doc.feuniverse.us/static/resources/mugs.png")

@commands.command()
async def hit(self, ctx, number, type="2RN"):
"""Convert 2RN/fates hit to actual chance"""
try:
num = int(number)
except ValueError:
await ctx.send("Specify an integer 0-100")
return
if (num < 0) or (num > 100):
await ctx.send("Specify an integer 0-100")
return
if type.upper()=="2RN":
table = [0.00, 0.03, 0.10, 0.21, 0.36, 0.55, 0.78, 1.05, 1.36, 1.71, 2.10, 2.53, 3.00, 3.51, 4.06, 4.65, 5.28, 5.95, 6.66, 7.41, 8.20, 9.03, 9.90, 10.81, 11.76, 12.75, 13.78, 14.85, 15.96, 17.11, 18.30, 19.53, 20.80, 22.11, 23.46, 24.85, 26.28, 27.75, 29.26, 30.81, 32.40, 34.03, 35.70, 37.41, 39.16, 40.95, 42.78, 44.65, 46.56, 48.51, 50.50, 52.47, 54.40, 56.29, 58.14, 59.95, 61.72, 63.45, 65.14, 66.79, 68.40, 69.97, 71.50, 72.99, 74.44, 75.85, 77.22, 78.55, 79.84, 81.09, 82.30, 83.47, 84.60, 85.69, 86.74, 87.75, 88.72, 89.65, 90.54, 91.39, 92.20, 92.97, 93.70, 94.39, 95.04, 95.65, 96.22, 96.75, 97.24, 97.69, 98.10, 98.47, 98.80, 99.09, 99.34, 99.55, 99.72, 99.85, 99.94, 99.99, 100.00]
elif type.upper()=="FATES":
table = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50.5,51.83,53.17,54.5,55.83,57.17,58.5,59.83,61.17,62.5,63.83,65.17,66.5,67.83,69.17,70.5,71.83,73.17,74.5,75.83,77.17,78.5,79.83,81.17,82.5,83.83,85.12,86.35,87.53,88.66,89.73,90.75,91.72,92.63,93.49,94.3,95.05,95.75,96.4,96.99,97.53,98.02,98.45,98.83,99.16,99.43,99.65,99.82,99.93,99.99,100]
else:
await ctx.send("Valid types are 2RN, Fates")
return
await ctx.send(str(table[num]))

@commands.command()
async def roll(self, ctx, number, type="2RN"):
"""rolls hit or miss (e.g. >>hit 50 1rn/2rn[default]/fates)"""
try:
num = int(number)
except ValueError:
await ctx.send("Specify an integer 0-100")
return
if (num < 0) or (num > 100):
await ctx.send("Specify an integer 0-100")
return
if type.upper()=="1RN":
rolled = random.randint(1,100)
elif type.upper()=="2RN":
rolled = (random.randint(1,100) + random.randint(1,100))>>1
elif type.upper()=="FATES":
rolled = random.randint(1,100)
if rolled > 50:
rolled = ((rolled*3) + random.randint(1,100))>>2
else:
await ctx.send("Valid types are 1RN, 2RN, Fates")
return
if rolled <= num: await ctx.send("HIT (%d)" % rolled)
else: await ctx.send("MISS (%d)" % rolled)

@commands.command(name="diceroll")
async def rollDie(self, ctx, n : int):
if n <= 0:
await ctx.send("Specify a positive integer.")
return
res = random.randrange(n) + 1
await ctx.send(str(res))

def setup(bot):
bot.add_cog(Helpful(bot))
Loading