Compare commits

...

14 Commits

Author SHA1 Message Date
WTMike24 0aaffbf5f0 Added quick and dirty escape to asterisks.
3 years ago
bobloy 771d1457e5 Bump to latest version of Chatterbot
3 years ago
bobloy d191abf6bd Only update if it's enabled (not all keys)
3 years ago
bobloy aba9840bcb Less verbose debug
3 years ago
bobloy 0064e6e9b5 More verbose debug mode
3 years ago
bobloy 955624ad1a Use greedy converter, no more commas
3 years ago
bobloy a6e0646b85
Merge pull request #186 from ScaredDonut/master
4 years ago
bobloy 269266ce04
Merge pull request #189 from aleclol/master
4 years ago
bobloy db3ce30122 Add back embed description, now required by discord
4 years ago
aleclol a7ce815e14
Merge branch 'bobloy:master' into master
4 years ago
aleclol b331238c1c
Move .get_text() to after None check
4 years ago
Alexander Soloviev 1ffac638ed Update infochannel.py
4 years ago
Alexander Soloviev 5b75002c88 Update infochannel.py
4 years ago
Alexander Soloviev 7c08a5de0c Update infochannel.py
4 years ago

@ -3,6 +3,7 @@ import logging
import re
import discord
from discord.ext.commands import RoleConverter, Greedy, CommandError, ArgumentParsingError
from discord.ext.commands.view import StringView
from redbot.core import Config, checks, commands
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):
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
# 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:
argument = view.get_quoted_word()
value = await rc.convert(ctx, argument)
except (CommandError, ArgumentParsingError):
view.index = previous
break
else:
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):
@ -84,7 +108,7 @@ class CCRole(commands.Cog):
# Roles to add
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"
)
@ -106,7 +130,7 @@ class CCRole(commands.Cog):
# Roles to remove
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"
)
try:
@ -124,7 +148,7 @@ class CCRole(commands.Cog):
# Roles to use
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"
)

@ -7,7 +7,7 @@
"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`",
"requirements": [
"git+git://github.com/bobloy/ChatterBot@fox#egg=ChatterBot",
"git+git://github.com/bobloy/ChatterBot@fox#egg=ChatterBot>=1.1.0.dev4",
"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_md-3.1.0/en_core_web_md-3.1.0.tar.gz#egg=en_core_web_md"

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

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

@ -40,12 +40,12 @@ class LoveCalculator(Cog):
log.debug(f"{resp=}")
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:
description = "Dr. Love is busy right now"
else:
description = description.strip()
description = description.get_text().strip()
result_image = soup_object.find("img", class_="result__image").get("src")

@ -77,11 +77,13 @@ class LastSeen(Cog):
return
last_seen = self.get_date_time(last_seen)
# embed = discord.Embed(
# description="{} was last seen at this date and time".format(member.display_name),
# timestamp=last_seen)
embed = discord.Embed(
description="{} was last seen at this date and time".format(member.display_name),
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)
@commands.Cog.listener()

Loading…
Cancel
Save