Compare commits

...

14 Commits

Author SHA1 Message Date
WTMike24
0aaffbf5f0 Added quick and dirty escape to asterisks. 2022-03-02 22:03:27 -05:00
bobloy
771d1457e5 Bump to latest version of Chatterbot 2021-09-22 13:26:12 -04:00
bobloy
d191abf6bd Only update if it's enabled (not all keys) 2021-09-03 15:37:08 -04:00
bobloy
aba9840bcb Less verbose debug 2021-09-03 15:28:28 -04:00
bobloy
0064e6e9b5 More verbose debug mode 2021-09-03 15:15:56 -04:00
bobloy
955624ad1a Use greedy converter, no more commas 2021-08-24 16:38:10 -04:00
bobloy
a6e0646b85
Merge pull request #186 from ScaredDonut/master
Booster counter
2021-08-09 15:51:29 -04:00
bobloy
269266ce04
Merge pull request #189 from aleclol/master
[LoveCalculator] Move .get_text() to after None check
2021-08-09 15:48:33 -04:00
bobloy
db3ce30122 Add back embed description, now required by discord 2021-08-09 10:29:27 -04:00
aleclol
a7ce815e14
Merge branch 'bobloy:master' into master 2021-07-11 19:42:12 -04:00
aleclol
b331238c1c
Move .get_text() to after None check 2021-07-03 22:11:42 -04:00
Alexander Soloviev
1ffac638ed Update infochannel.py
more formatting fix, too much indentation on github for whatever reason but not on notepad
2021-05-26 04:46:12 -05:00
Alexander Soloviev
5b75002c88 Update infochannel.py
fixed formatting I think? too many spaces/indents on github for some reason
2021-05-26 04:44:22 -05:00
Alexander Soloviev
7c08a5de0c Update infochannel.py
added booster counter as requested on https://github.com/bobloy/Fox-V3/issues/185
2021-05-26 04:39:24 -05:00
6 changed files with 58 additions and 22 deletions

View File

@ -3,6 +3,7 @@ import logging
import re import re
import discord import discord
from discord.ext.commands import RoleConverter, Greedy, CommandError, ArgumentParsingError
from discord.ext.commands.view import StringView from discord.ext.commands.view import StringView
from redbot.core import Config, checks, commands from redbot.core import Config, checks, commands
from redbot.core.bot import Red from redbot.core.bot import Red
@ -13,15 +14,38 @@ log = logging.getLogger("red.fox_v3.ccrole")
async def _get_roles_from_content(ctx, content): async def _get_roles_from_content(ctx, content):
content_list = content.split(",") # greedy = Greedy[RoleConverter]
view = StringView(content)
rc = RoleConverter()
# "Borrowed" from discord.ext.commands.Command._transform_greedy_pos
result = []
while not view.eof:
# for use with a manual undo
previous = view.index
view.skip_ws()
try: try:
role_list = [ argument = view.get_quoted_word()
discord.utils.get(ctx.guild.roles, name=role.strip(" ")).id for role in content_list value = await rc.convert(ctx, argument)
] except (CommandError, ArgumentParsingError):
except (discord.HTTPException, AttributeError): # None.id is attribute error view.index = previous
return None break
else: else:
return role_list result.append(value)
return [r.id for r in result]
# Old method
# content_list = content.split(",")
# try:
# role_list = [
# discord.utils.get(ctx.guild.roles, name=role.strip(" ")).id for role in content_list
# ]
# except (discord.HTTPException, AttributeError): # None.id is attribute error
# return None
# else:
# return role_list
class CCRole(commands.Cog): class CCRole(commands.Cog):
@ -84,7 +108,7 @@ class CCRole(commands.Cog):
# Roles to add # Roles to add
await ctx.send( await ctx.send(
"What roles should it add? (Must be **comma separated**)\n" "What roles should it add?\n"
"Say `None` to skip adding roles" "Say `None` to skip adding roles"
) )
@ -106,7 +130,7 @@ class CCRole(commands.Cog):
# Roles to remove # Roles to remove
await ctx.send( await ctx.send(
"What roles should it remove? (Must be comma separated)\n" "What roles should it remove?\n"
"Say `None` to skip removing roles" "Say `None` to skip removing roles"
) )
try: try:
@ -124,7 +148,7 @@ class CCRole(commands.Cog):
# Roles to use # Roles to use
await ctx.send( await ctx.send(
"What roles are allowed to use this command? (Must be comma separated)\n" "What roles are allowed to use this command?\n"
"Say `None` to allow all roles" "Say `None` to allow all roles"
) )

View File

@ -7,7 +7,7 @@
"hidden": false, "hidden": false,
"install_msg": "Thank you for installing Chatter! Please make sure you check the install instructions at https://github.com/bobloy/Fox-V3/blob/master/chatter/README.md\nAfter that, get started ith `[p]load chatter` and `[p]help Chatter`", "install_msg": "Thank you for installing Chatter! Please make sure you check the install instructions at https://github.com/bobloy/Fox-V3/blob/master/chatter/README.md\nAfter that, get started ith `[p]load chatter` and `[p]help Chatter`",
"requirements": [ "requirements": [
"git+git://github.com/bobloy/ChatterBot@fox#egg=ChatterBot", "git+git://github.com/bobloy/ChatterBot@fox#egg=ChatterBot>=1.1.0.dev4",
"kaggle", "kaggle",
"https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.1.0/en_core_web_sm-3.1.0.tar.gz#egg=en_core_web_sm", "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.1.0/en_core_web_sm-3.1.0.tar.gz#egg=en_core_web_sm",
"https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.1.0/en_core_web_md-3.1.0.tar.gz#egg=en_core_web_md" "https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.1.0/en_core_web_md-3.1.0.tar.gz#egg=en_core_web_md"

View File

@ -441,6 +441,7 @@ class FIFO(commands.Cog):
self.scheduler.print_jobs(out=cp) self.scheduler.print_jobs(out=cp)
out = cp.string out = cp.string
out=out.replace("*","\*")
if out: if out:
if len(out) > 2000: if len(out) > 2000:

View File

@ -28,9 +28,12 @@ async def get_channel_counts(category, guild):
online_num = members - offline_num online_num = members - offline_num
# Gets count of actual users # Gets count of actual users
human_num = members - bot_num human_num = members - bot_num
# count amount of premium subs/nitro subs.
boosters = guild.premium_subscription_count
return { return {
"members": members, "members": members,
"humans": human_num, "humans": human_num,
"boosters": boosters,
"bots": bot_num, "bots": bot_num,
"roles": roles_num, "roles": roles_num,
"channels": channels_num, "channels": channels_num,
@ -58,6 +61,7 @@ class InfoChannel(Cog):
self.default_channel_names = { self.default_channel_names = {
"members": "Members: {count}", "members": "Members: {count}",
"humans": "Humans: {count}", "humans": "Humans: {count}",
"boosters": "Boosters: {count}",
"bots": "Bots: {count}", "bots": "Bots: {count}",
"roles": "Roles: {count}", "roles": "Roles: {count}",
"channels": "Channels: {count}", "channels": "Channels: {count}",
@ -170,6 +174,7 @@ class InfoChannel(Cog):
Valid Types are: Valid Types are:
- `members`: Total members on the server - `members`: Total members on the server
- `humans`: Total members that aren't bots - `humans`: Total members that aren't bots
- `boosters`: Total amount of boosters
- `bots`: Total bots - `bots`: Total bots
- `roles`: Total number of roles - `roles`: Total number of roles
- `channels`: Total number of channels excluding infochannels, - `channels`: Total number of channels excluding infochannels,
@ -224,6 +229,7 @@ class InfoChannel(Cog):
Valid Types are: Valid Types are:
- `members`: Total members on the server - `members`: Total members on the server
- `humans`: Total members that aren't bots - `humans`: Total members that aren't bots
- `boosters`: Total amount of boosters
- `bots`: Total bots - `bots`: Total bots
- `roles`: Total number of roles - `roles`: Total number of roles
- `channels`: Total number of channels excluding infochannels - `channels`: Total number of channels excluding infochannels
@ -441,6 +447,7 @@ class InfoChannel(Cog):
guild, guild,
members=True, members=True,
humans=True, humans=True,
boosters=True,
bots=True, bots=True,
roles=True, roles=True,
channels=True, channels=True,
@ -497,14 +504,16 @@ class InfoChannel(Cog):
guild_data = await self.config.guild(guild).all() guild_data = await self.config.guild(guild).all()
to_update = ( to_update = (
kwargs.keys() & guild_data["enabled_channels"].keys() kwargs.keys() & [key for key, value in guild_data["enabled_channels"].items() if value]
) # Value in kwargs doesn't matter ) # Value in kwargs doesn't matter
log.debug(f"{to_update=}")
if to_update or extra_roles: if to_update or extra_roles:
log.debug(f"{to_update=}\n"
f"{extra_roles=}")
category = guild.get_channel(guild_data["category_id"]) category = guild.get_channel(guild_data["category_id"])
if category is None: if category is None:
log.debug('Channel category is missing, updating must be off')
return # Nothing to update, must be off return # Nothing to update, must be off
channel_data = await get_channel_counts(category, guild) channel_data = await get_channel_counts(category, guild)

View File

@ -40,12 +40,12 @@ class LoveCalculator(Cog):
log.debug(f"{resp=}") log.debug(f"{resp=}")
soup_object = BeautifulSoup(resp, "html.parser") soup_object = BeautifulSoup(resp, "html.parser")
description = soup_object.find("div", class_="result__score").get_text() description = soup_object.find("div", class_="result__score")
if description is None: if description is None:
description = "Dr. Love is busy right now" description = "Dr. Love is busy right now"
else: else:
description = description.strip() description = description.get_text().strip()
result_image = soup_object.find("img", class_="result__image").get("src") result_image = soup_object.find("img", class_="result__image").get("src")

View File

@ -77,11 +77,13 @@ class LastSeen(Cog):
return return
last_seen = self.get_date_time(last_seen) last_seen = self.get_date_time(last_seen)
# embed = discord.Embed( embed = discord.Embed(
# description="{} was last seen at this date and time".format(member.display_name), description="{} was last seen at this date and time".format(member.display_name),
# timestamp=last_seen) timestamp=last_seen,
color=await self.bot.get_embed_color(ctx),
)
embed = discord.Embed(timestamp=last_seen, color=await self.bot.get_embed_color(ctx)) # embed = discord.Embed(timestamp=last_seen, color=await self.bot.get_embed_color(ctx))
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.Cog.listener() @commands.Cog.listener()