Compare commits

...

56 commits

Author SHA1 Message Date
a14bd192d3 add pfp command 2022-03-10 17:45:33 -05:00
d5aa241ba0 remove message deletions in gib hug 2022-03-09 20:45:10 +00:00
f6a54c5cca Fix bot invite link 2022-03-09 20:44:09 +00:00
f86208020d Update 'bot.py' 2022-03-06 15:08:18 +00:00
69c083c396 Removed contributors (I was lazy to make it always update (blame shitass coder)) 2022-03-06 15:06:57 +00:00
6a7e2675fa Update 'bot.py' 2022-01-15 12:33:16 +00:00
7a7d1aaae9 add 2 new commands, blurple and jail 2022-01-03 13:47:49 +00:00
cd02848012 Fix Issue #10 2021-12-29 12:16:57 +00:00
3bd38c42d3 Massive command overhaul, all commands now delete the original message and some commands now DM the author instead of messaging the entire discord. Cred: remi, Helixu 2021-12-28 17:57:27 +00:00
94976fb929 im really good at breaking things 2021-12-18 11:37:01 +00:00
22347815cb more broken things lmao 2021-12-18 11:36:03 +00:00
1fac729e83 oops i broke thingies 2021-12-18 11:35:29 +00:00
739cc1afb1 Fix URL's and meme 2021-12-18 11:34:28 +00:00
fae97f40ca Update README to make sense now that the master branch has been deleted 2021-12-17 22:18:05 +00:00
d860f2ce6a Fix gib hug 2021-12-17 20:49:20 +00:00
76d49a4597 Fix gib hug (Issue #3) 2021-12-17 20:48:07 +00:00
610be72b7a Merge branch 'unstable' of https://code.cat.casa/Helixu/Foxtrot into unstable 2021-12-16 18:04:31 +01:00
1f54938ec4 Disable gib hug until an issue is fixed 2021-12-16 18:04:25 +01:00
5c6a48537a disabled gib hug until an issue is fixed 2021-12-16 16:56:49 +00:00
58528f657a Fixed the source code URL 2021-12-16 16:21:16 +00:00
f48a9e0bf2 added support server that gives invite to our discord (cred: remi) 2021-12-10 22:18:50 +00:00
b8d76b7440 make gib gay work with url images, will no longer work with avatars until i become not lazy. 2021-12-03 22:19:36 +00:00
027dc4c07c vote command 2021-12-03 20:30:12 +00:00
fb4880a411 fix 2021-11-28 16:26:38 +00:00
8c24ad8818 more fox msgs 2021-11-28 16:19:20 +00:00
f9e1d89c11 Discord invite link 2021-11-28 16:18:17 +00:00
d81226b80a funny perm changes 2021-11-27 18:57:12 +00:00
743be56057 Update 'README.md' 2021-11-27 08:43:38 +00:00
b92fa8f7a6 Update 'README.md' 2021-11-27 08:42:03 +00:00
b5539d5326 minor change
Added the 413 error code to gib fox
2021-11-26 16:56:59 +00:00
30370500b3 funnier descriptions 2021-11-26 14:15:01 +00:00
b752e87129 fixed activity 2021-11-25 20:42:50 +00:00
3ee887744e Her på Memos! 2021-11-24 21:11:14 +00:00
3e8e197eed Added fail message to fox command when it 413's 2021-11-24 17:30:00 +00:00
2288581903 hugs for days 2021-11-23 22:51:11 +00:00
3b11c6e4f2 Revert gib meme as per request by API holder 2021-11-23 17:48:49 +00:00
90370ea280 Merge pull request 'upload meme as an attachment' (#2) from xfnw/Foxtrot:unstable into unstable
Reviewed-on: Helixu/Foxtrot#2
2021-11-22 22:08:46 +00:00
49a4c10d0d upload meme as an attachment
ive not tested this
2021-11-22 16:59:36 -05:00
ae31406805 misc fixes 2021-11-22 21:31:57 +00:00
8ce21fad0e Merge branch 'master' into unstable 2021-11-22 21:10:51 +00:00
cd9b99fe1d restart command + start script 2021-11-22 21:01:35 +00:00
0515773f68 Added minor changes to gib activity 2021-11-21 12:00:21 +00:00
e438fd6d9b Tempoarily add a solution to gib mc exceeding the embed.add_field limit of 25, if anyone has any suggestions for how I can actually fix this issue, DM Helixu#1111 2021-11-20 18:19:42 +00:00
4f4d83bae4 a line broke fox, gg! 2021-11-20 17:17:33 +00:00
88875887c2 Fixed 1 command being completely bugged 2021-11-20 16:56:01 +00:00
5290d8c28a throws errors at the user instead of crashes, apart from 2 commands. 2021-11-20 16:53:11 +00:00
f7068305bb Merge branch 'unstable' of https://code.cat.casa/Helixu/Foxtrot into unstable 2021-11-20 16:01:50 +00:00
620eff1782 yes 2021-11-20 16:01:47 +00:00
ce174cefa1 Added rich presence changes 2021-11-20 15:59:54 +00:00
e79a2b3d0f added gay, currently only gays your profile picture, until i find out how to do it with images the author sends. 2021-11-20 15:14:14 +00:00
93fcf25d67 minor typo that bugged me 2021-11-20 14:43:49 +00:00
65b316926f Removed username field as it was set as the embed author. 2021-11-20 14:38:16 +00:00
3648e3c6ca Unhide gib mc 2021-11-20 14:35:51 +00:00
45d0a2406e Fixed name history with gib mc, currently does not show all names though, thank you discord. 2021-11-20 14:34:04 +00:00
c652d76d89 fixed cat 2021-11-20 11:22:41 +00:00
1290e21e35 removed namehistory from mc because it was bugged 2021-11-20 10:57:57 +00:00
2 changed files with 162 additions and 31 deletions

View file

@ -0,0 +1,5 @@
Foxtrot is a multipurpose bot intended to give images and facts about animals, memes, and more!
Foxtrot is open-sourced so people could help fix issues, and to stop people thinking we are doing malicious things with the bot.
Foxtrot also is not made to be self-hosted, but can be self-hosted if done correctly and changed a few things in the code and added your own bot's token in a token.json. Foxtrot is only really meant to be used for the official bot and test bots (to help with bugfixing and stability checking)

188
bot.py
View file

@ -1,9 +1,9 @@
import discord
from discord import File, Streaming, Game, Activity, ActivityType, Status
from discord.ext import commands, tasks
import io, aiohttp, asyncio, json, random, logging, requests
import io, aiohttp, asyncio, json, random, logging, requests, re
foxmsgs = [
@ -11,6 +11,8 @@ foxmsgs = [
'here fops',
'owo',
'uwu',
'fox hugz u',
'fox fox fox',
'heres ur fox',
]
@ -24,7 +26,7 @@ async def is_ginlang(ctx):
"""
are you ginlang or the other dudes?
"""
if ctx.author.id in [287885666941927424, 894034804503351366, 296736767158255616, 831598877320413244]:
if ctx.author.id in [287885666941927424, 160091312081731584, 894034804503351366, 296736767158255616, 831598877320413244]:
return True
else:
logchannel = await bot.fetch_channel(910622485916037150)
@ -33,17 +35,42 @@ async def is_ginlang(ctx):
logging.basicConfig(level=logging.INFO)
bot = commands.Bot(command_prefix='gib ')
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='gib ', intents = intents)
@bot.command(brief="gives you a fluffy fox")
async def fox(ctx):
async with aiohttp.ClientSession() as session:
async with session.get('https://foxrudor.de/') as resp:
file = File(io.BytesIO(await resp.read()),filename='fox.jpg')
await ctx.send(random.choice(foxmsgs),file=file)
await ctx.message.delete()
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
try:
await ctx.send(random.choice(foxmsgs),file=file)
except:
embed = discord.Embed(
title = "Command 'fox' failed",
description = "Received unexpected error, foxes occupied by ginlang, who is currently hugging them! 413 Payload too Large"
)
return await ctx.send(embed = embed)
@bot.command(brief="give someone a cuddle")
async def hug(ctx, *, name=None):
if not name:
return await ctx.send("Foxtrot hugs "+ctx.author.name.replace("@", "")+"! :3")
nameFixed = name.replace("@everyone", "everyone").replace("@here", "everyone here")
await ctx.send(ctx.author.name+f" hugs {nameFixed}! :3")
@bot.command(brief="gives the top.gg vote link")
async def vote(ctx):
await ctx.message.delete()
await ctx.author.send("Vote for Foxtrot on top.gg! <https://top.gg/bot/909103805264724038/vote>")
@bot.command(brief="cattttttttt")
async def cat(ctx):
await ctx.send (f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.message.delete()
async with aiohttp.ClientSession() as session:
async with session.get('https://some-random-api.ml/animal/cat') as resp:
json = await resp.json()
@ -55,6 +82,8 @@ async def cat(ctx):
@bot.command(brief="gives you a fluffy panda")
async def panda(ctx):
await ctx.send (f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.message.delete()
async with aiohttp.ClientSession() as session:
async with session.get('https://some-random-api.ml/animal/panda') as resp:
json = await resp.json()
@ -67,6 +96,8 @@ async def panda(ctx):
@bot.command(brief="omg koala")
async def koala(ctx):
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.message.delete()
async with aiohttp.ClientSession() as session:
async with session.get('https://some-random-api.ml/animal/koala') as resp:
json = await resp.json()
@ -76,9 +107,16 @@ async def koala(ctx):
await ctx.send(json["fact"])
await ctx.send(json["image"])
@bot.command(hidden=True)
@commands.check(is_ginlang)
async def restart(ctx):
await ctx.send("shutting down. beep boop.")
await exit()
@bot.command(brief="bin eaters")
async def raccoon(ctx):
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.message.delete()
async with aiohttp.ClientSession() as session:
async with session.get('https://some-random-api.ml/animal/raccoon') as resp:
json = await resp.json()
@ -88,11 +126,6 @@ async def raccoon(ctx):
await ctx.send(json["fact"])
await ctx.send(json["image"])
@bot.command(hidden=True)
@commands.check(is_ginlang)
async def restart(ctx):
await ctx.send("shutting down, beep boop.")
exit()
@bot.command(hidden=True)
@ -103,16 +136,23 @@ async def activity(ctx, atype, *, aname):
if atype not in atypes:
await ctx.send("invalid activity type. the valid types are "+' '.join(atypes.keys()))
return
await bot.change_presence(activity=Activity(name=(aname + f" ¦ {str(getAllUsers())} users"), type=atypes[atype], url="https://twitch.tv/xginlang"))
await bot.change_presence(activity=Activity(name=(aname + f" ¦ {str(getAllUsers())} users"), type=atypes[atype], url="https://www.youtube.com/watch?v=1xBO4pUAs4M"))
await ctx.send('Success!')
@bot.command(brief="gives bot invite link")
async def invite(ctx):
await ctx.send("Add this bot to your server: https://discord.com/oauth2/authorize?client_id=909103805264724038&permissions=274878203904&scope=bot")
await ctx.message.delete()
try:
await ctx.author.send("""Add this bot to your server: <https://discord.com/api/oauth2/authorize?client_id=909103805264724038&permissions=274878032896&scope=bot%20applications.commands>
You can also join our official Discord server at <https://discord.gg/VrnJFVfSJR>!""")
except:
await ctx.send(f"<@{ctx.author.id}>. I could not DM you!")
@bot.command(brief="gives information about a minecraft user")
async def mc(ctx, *, name = None):
await ctx.message.delete()
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
if not name:
embed = discord.Embed(
title = "No Minecraft user given!",
@ -139,37 +179,44 @@ async def mc(ctx, *, name = None):
@bot.command(brief="gives credits")
async def credits(ctx):
await ctx.send("""API endpoints used in this bot are taken from:
await ctx.message.delete()
try:
await ctx.author.send("""API endpoints used in this bot are taken from:
https://foxrudor.de/
https://some-random-api.ml
https://shitfest.net
""")
except:
await ctx.send(f"<@{ctx.author.id}>. I could not DM you!")
@bot.command(brief="shows contributors to Foxtrot")
async def contributors(ctx):
await ctx.send("""Contributors to the Foxtrot bot are:
Helixu#1111
xfnw#1113
<https://cat.casa/~julia/> (shitfest memes API)
TFTWPhoenix#9240 (I dont know, hes cool I guess.)
remi#9948 (also pretty cool ig)
Foxtrot is open source! Find the code at <https://code.cat.casa/Helixu/Foxtrot>
""")
@bot.command(brief="random meme")
async def meme(ctx):
await ctx.message.delete()
async with aiohttp.ClientSession() as session:
async with session.get('https://shitfest.net/api/random.php') as resp:
async with session.get('https://api.shitfest.net/v2/random.php') as resp:
json = await resp.json()
await ctx.send(json["url"])
await ctx.send(f"""*Command executed by {ctx.author.name}#{ctx.author.discriminator}*
""""https://shitfest.net/"""+json["name"])
@bot.command(brief='Kitsune Discord server invite', aliases=["support"])
async def server(ctx):
await ctx.message.delete()
try:
await ctx.author.send("""The official discord server for Foxtrot is discord.gg/mDBfnysAqd
Our server contains everything we do and work on.""")
except:
await ctx.send(f"<@{ctx.author.id}>. I could not DM you!")
@bot.command(brief='makes things gay')
async def gay(ctx, member: discord.Member=None):
member = member or ctx.author
async def gay(ctx, url = None):
await ctx.message.delete()
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.trigger_typing()
async with aiohttp.ClientSession() as session:
async with session.get(
f'https://some-random-api.ml/canvas/gay?avatar={member.avatar_url_as(format="png")}'
f'https://some-random-api.ml/canvas/gay?avatar={url}'
) as af:
if 300 > af.status >= 200 :
fp = io.BytesIO(await af.read())
@ -181,14 +228,93 @@ async def gay(ctx, member: discord.Member=None):
embed.set_image(url="attachment://gay.png")
await ctx.send(embed=embed, file=file)
else:
await ctx.send("An unexpected error happened, Steve.. I told you this already!")
await ctx.send("""An unexpected error happened, Steve.. I told you this already!
Are you sure that the image URL you sent is correct? Image attachments currently do not work!""")
@bot.command(brief='where the wetters go')
async def jail(ctx, url = None):
await ctx.message.delete()
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.trigger_typing()
async with aiohttp.ClientSession() as session:
async with session.get(
f'https://some-random-api.ml/canvas/jail?avatar={url}'
) as af:
if 300 > af.status >= 200 :
fp = io.BytesIO(await af.read())
file = discord.File(fp, "amongus.png")
embed = discord.Embed(
title="dont drop the soap!",
color=0xf1f1f1,
)
embed.set_image(url="attachment://amongus.png")
await ctx.send(embed=embed, file=file)
else:
await ctx.send("""An unexpected error happened, Steve.. I told you this already!
Are you sure that the image URL you sent is correct? Image attachments currently do not work!""")
@bot.command(brief='similar to esmBot blurple, but with 104% more fox')
async def blurple(ctx, url = None):
await ctx.message.delete()
await ctx.send(f"*Command executed by {ctx.author.name}#{ctx.author.discriminator}*")
await ctx.trigger_typing()
async with aiohttp.ClientSession() as session:
async with session.get(
f'https://some-random-api.ml/canvas/blurple?avatar={url}'
) as af:
if 300 > af.status >= 200 :
fp = io.BytesIO(await af.read())
file = discord.File(fp, "amongus.png")
embed = discord.Embed(
title="amogus?",
color=0xf1f1f1,
)
embed.set_image(url="attachment://amongus.png")
await ctx.send(embed=embed, file=file)
else:
await ctx.send("""An unexpected error happened, Steve.. I told you this already!
Are you sure that the image URL you sent is correct? Image attachments currently do not work!""")
@bot.command(brief="get a user's profile picture")
async def pfp(ctx, *, person=None):
if person is None:
person = ctx.message.author
else:
try:
person = await ctx.guild.fetch_member(
re.sub(
r"[<>!@]",
"",
person,
)
)
except (discord.NotFound, discord.HTTPException):
found = None
for member in ctx.guild.members:
if (
person.lower() in member.name.lower()
or person.lower() in member.display_name.lower()
):
if found is None:
found = member
else:
await ctx.send(
"oh nOwO, that was not specific enough, try `@mention`ing them."
)
return
if found is None:
await ctx.send(
"sowwy i could not find that user, try `@mention`ing them."
)
return
person = found
await ctx.send(f"**{person.display_name}**'s pfp: {person.avatar_url}")
@bot.event
async def on_ready():
await asyncio.sleep(1) # someone on stackoverflow said discord does not like if you are speedy
await bot.change_presence(activity=Streaming(name=f"Dev Mode ¦ {str(getAllUsers())} users", url="https://twitch.tv/xginlang"))
await bot.change_presence(activity=Streaming(name=f"Dev Mode ¦ {str(getAllUsers())} users", url="https://www.youtube.com/watch?v=1xBO4pUAs4M"))
with open('token.json', 'r') as file:
# this breaks if you are on windows