import datetime from typing import cast import discord from redbot.core import commands, i18n, checks from redbot.core.utils.common_filters import ( filter_invites, filter_various_mentions, escape_spoilers_and_mass_mentions, ) from redbot.core.utils.mod import get_audit_reason from .abc import MixinMeta from .utils import is_allowed_by_hierarchy _ = i18n.Translator("Mod", __file__) class ModInfo(MixinMeta): """ Commands regarding names, userinfo, etc. """ async def get_names_and_nicks(self, user): names = await self.config.user(user).past_names() nicks = await self.config.member(user).past_nicks() if names: names = [ escape_spoilers_and_mass_mentions(name) for name in names if name ] if nicks: nicks = [
from .abc import MixinMeta import discord from redbot.core import commands, checks, i18n, modlog from redbot.core.utils.chat_formatting import ( bold, humanize_timedelta, humanize_list, pagify, format_perms_list, ) from redbot.core.utils.mod import get_audit_reason from .converters import MuteTime _ = i18n.Translator("Mutes", __file__) class VoiceMutes(MixinMeta): """ This handles all voice channel related muting """ @staticmethod async def _voice_perm_check(ctx: commands.Context, user_voice_state: Optional[discord.VoiceState], **perms: bool) -> Tuple[bool, Optional[str]]: """Check if the bot and user have sufficient permissions for voicebans. This also verifies that the user's voice state and connected channel are not ``None``.
import asyncio import logging import pathlib import typing import discord import gpt_2_simple from redbot import core from redbot.core import checks, commands, data_manager, i18n translator = i18n.Translator("Gpt2", __file__) log = logging.getLogger("red.gpt2") @i18n.cog_i18n(translator) class Gpt2(commands.Cog): """Interact with a Braacket league""" async def _begin_generator(self) -> asyncio.Future: async with self.config.model() as model: async with self.config.max_size() as max_size: self.generate_samples: asyncio.Future = asyncio.run_coroutine_threadsafe( self._generate_samples(model, max_size), self.bot.loop ) async def _generate_samples(self, model: typing.Optional[str] = None, max_size=31): if model == None: return cog_data_path = data_manager.cog_data_path(self) model_path: pathlib.Path = cog_data_path / "models" / model
from redbot.core import commands from redbot.core import Config from redbot.core import checks from redbot.core import i18n from redbot.core.utils.predicates import MessagePredicate from redbot.core.bot import Red import discord import random import asyncio from dpymenus import Page, PaginatedMenu _ = i18n.Translator("Core", __file__) class Teststore(commands.Cog): def __init__(self, bot: "Red"): self.bot = bot self.config = Config.get_conf(self, identifier=991991) self.config.register_user( comments={} ) #Kommentare hinzufügen @commands.command() async def addentry(self, ctx, Benutzer: discord.User,*text): zaehler = 0 while zaehler < 99: try: await self.config.user(Benutzer).comments.get_raw(zaehler) zaehler +=1
import logging from typing import Optional from redbot import version_info from redbot.core import Config, checks, commands, i18n from redbot.core.dev_commands import Dev log = logging.getLogger("red.trusty-cogs.loaddev") _ = i18n.Translator("LoadDev", __file__) class LoadDev(commands.Cog): """Allow live loading of Dev commands from Core""" __version__ = version_info __author__ = [ "TrustyJAID", ] def __init__(self, bot): self.bot = bot self.config = Config.get_conf(self, identifier=218773382617890828) self.config.register_global( replace_mock=None, auto_load_dev=False, ) self.bot.loop.create_task(self.initialize()) def cog_unload(self): if not self.bot._cli_flags.dev: